body:has(.is-admin) { background: #edf0f3; }
.app-shell.is-admin {
  height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  --blue: #246ce5; --blue-soft: #edf3fe; --muted: #636e7c; --line: #dee4eb;
  font-size: 13px;
}
.app-shell.is-admin * { min-width: 0; letter-spacing: 0; }
.app-shell.is-admin .topbar { flex: none; background: #ffffffaa; border-bottom: 1px solid #fff; backdrop-filter: blur(20px); }
.app-shell.is-admin .topbar-inner { width: 100%; min-height: 62px; padding: 0 28px; }
.app-shell.is-admin .nav-links { display: none; }
.app-shell.is-admin .main { padding: 18px 24px 24px; width: 100%; max-width: none; margin: 0; flex: 1; min-height: 0; display: flex; }
.app-shell.is-admin .brand-title { font-size: 15px; }
.app-shell.is-admin .brand-subtitle { font-size: 11px; }
.ad-shell { width: min(1560px,100%); min-height: 0; margin: 0 auto; display: grid; grid-template-columns: 212px minmax(0,1fr); border: 1px solid #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 12px 36px #3444560b; }
.ad-sidebar { padding: 24px 12px 0; display: flex; flex-direction: column; background: #f8fafcc9; border-right: 1px solid var(--line); backdrop-filter: blur(24px); overflow: auto; }
.ad-nav-group { margin-bottom: 22px; }
.ad-nav-group > span { display: block; font-size: 10px; color: var(--muted); margin: 0 12px 10px; }
.ad-nav-item, .ad-nav-group summary { display: flex; align-items: center; width: 100%; text-align: left; gap: 10px; min-height: 42px; padding: 10px 12px; margin-bottom: 3px; border-radius: 6px; font-size: 12px; color: #344052; background: transparent; cursor: pointer; }
.ad-nav-item > span, .ad-nav-group summary > span { width: 18px; text-align: center; font-size: 17px; color: #5b6a7e; line-height: 1; }
.ad-nav-item img, .ad-nav-group summary img { width: 18px; height: 18px; display: block; opacity: .65; }
.ad-mobile-exit { display: none; }
.ad-nav-item.active { background: #e5effe; color: var(--blue); font-weight: 600; }
.ad-nav-item:hover, .ad-nav-group summary:hover { background: #eaf0f7; }
.ad-nav-group summary { list-style: none; }
.ad-nav-group summary::-webkit-details-marker { display: none; }
.ad-nav-group summary::after { content: "›"; margin-left: auto; transform: rotate(0deg); font-size: 16px; color: var(--muted); }
.ad-nav-group details[open] summary::after { transform: rotate(90deg); }
.ad-device-nav { margin: 3px 0 12px 22px; border-left: 1px solid #dbe3ec; padding-left: 8px; }
.ad-device-nav button { text-align: left; background: transparent; width: 100%; min-height: 36px; padding: 8px; border-radius: 4px; font-size: 11px; color: var(--muted); cursor: pointer; line-height: 1.6; overflow-wrap: anywhere; }
.ad-device-nav button.selected { background: #e5effe; color: var(--blue); font-weight: 600; }
.ad-sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid var(--line); padding: 18px 6px; }
.ad-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e5ebf1; font-size: 11px; color: #556473; }
.ad-sidebar-bottom strong { display: block; font-size: 11px; }
.ad-sidebar-bottom small { display: block; font-size: 9px; color: var(--muted); margin-top: 4px; }
.ad-workspace { display: flex; flex-direction: column; min-height: 0; background: #fff; }
.ad-heading { padding: 24px 28px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; }
.ad-heading h1 { font-size: 21px; font-weight: 650; line-height: 1.4; margin: 6px 0 0; }
.ad-header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 28px; border-top: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4; flex: none; }
.ad-toolbar > span, .ad-toolbar strong small { color: var(--muted); font-size: 11px; font-weight: 400; }
.ad-toolbar > strong { font-size: 13px; font-weight: 550; }
.ad-batch-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.4fr) auto; align-items: end; gap: 12px; }
.ad-batch-filters .field { max-width: none; }
.app-shell.is-admin :is(.ad-portal-filters, .ad-batch-filters) :is(input, select),
.app-shell.is-admin .ad-portal .ad-portal-filters > .btn,
.app-shell.is-admin .ad-batch-filters > .btn { height: 44px; min-height: 44px; padding-block: 0; }
.ad-batch-directory .row-actions { justify-content: flex-start; gap: 8px; }
.app-shell.is-admin .ad-batch-directory .btn { height: 36px; min-height: 36px; padding: 0 12px; white-space: nowrap; }
.ad-batch-directory td { vertical-align: middle; }
.ad-batch-directory td:first-child { width: 35%; }
.ad-batch-directory td strong, .ad-batch-directory td small, .ad-batch-history td small { display: block; overflow-wrap: anywhere; }
.ad-batch-directory td small, .ad-batch-history td small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.ad-batch-history > h2 { font-size: 15px; margin: 20px 0 14px; }
.ad-report-filters .field { flex: 1 1 140px; max-width: 190px; }
.ad-report-filters .field:first-child { flex-basis: 200px; max-width: 260px; }
.ad-report-filters .row-actions { margin-top: auto; }
.ad-report-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 20px 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.ad-report-metrics .ad-stat strong { font-size: 26px; }
.ad-report-columns { display: grid; grid-template-columns: 3fr 2fr; gap: 28px; padding: 24px 0; }
.ad-report-columns h2, .ad-report-entries h2 { font-size: 14px; margin: 0 0 16px; }
.ad-report-columns .ad-status-bars { margin-top: 0; }
.ad-table-wrap { overflow-x: auto; }
.ad-report-entries { border-top: 1px solid var(--line); padding-top: 20px; }
.ad-report-entry { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ad-report-entry > div:first-child { flex: 1 1 250px; }
.ad-report-entry span { display: inline-block; margin-left: 12px; font-size: 11px; color: var(--muted); }
.ad-report-entry p { margin: 8px 0 0; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-toolbar strong small { margin-left: 12px; }
.ad-scroll { flex: 1; min-height: 0; padding: 24px 28px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c5cfda transparent; }
.ad-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 28px; min-height: 73px; border-top: 1px solid #e8edf3; background: #fbfcfe; flex: none; }
.ad-footer > span { color: var(--muted); font-size: 11px; line-height: 1.6; }
.app-shell.is-admin .btn { border-radius: 6px; font-size: 12px; padding: 9px 14px; min-height: 36px; background: #fff; color: #344052; border: 1px solid #dfe5ee; box-shadow: 0 1px 2px #22354a05; cursor: pointer; }
.app-shell.is-admin .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: inset 0 1px 0 #ffffff20, 0 2px 5px #246ce514; }
.app-shell.is-admin .btn:disabled { opacity: .5; cursor: not-allowed; }
.app-shell.is-admin .btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.app-shell.is-admin .pill { font-size: 10px; font-weight: 500; padding: 4px 8px; }
.app-shell.is-admin .pill.amber { color: #85601d; background: #faf2df; }
.app-shell.is-admin .pill.green { color: #267454; background: #eaf5ef; }
.app-shell.is-admin input, .app-shell.is-admin select, .app-shell.is-admin textarea { border-radius: 6px; font-size: 12px; border: 1px solid #dce3ec; min-height: 38px; padding: 9px 11px; background: #fff; color: #253246; }
.app-shell.is-admin textarea { line-height: 1.8; resize: vertical; }
.app-shell.is-admin .field { margin: 0; display: grid; gap: 8px; }
.app-shell.is-admin .field > span { font-size: 11px; color: var(--muted); }
.app-shell.is-admin :focus-visible { outline: 3px solid #246ce560; outline-offset: 2px; }
.ad-device-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-content: start; }
.ad-device-card { border: 1px solid #e1e6ee; border-radius: 8px; padding: 22px; background: #fff; }
.ad-device-title { display: flex; align-items: center; gap: 12px; }
.ad-device-title img { object-fit: contain; flex: none; }
.ad-device-title h2 { font-size: 15px; font-weight: 600; margin: 0 0 7px; line-height: 1.5; overflow-wrap: anywhere; }
.ad-device-title .btn { margin-left: auto; font-size: 10px; padding: 7px; }
.ad-device-counts { display: grid; grid-template-columns: repeat(3,1fr); margin: 24px 0; }
.ad-device-counts > div { border-right: 1px solid #edf0f3; padding-left: 16px; }
.ad-device-counts > div:first-child { padding-left: 0; }
.ad-device-counts > div:last-child { border: 0; }
.ad-device-counts dt { font-size: 10px; color: var(--muted); }
.ad-device-counts dd { font-size: 22px; font-weight: 550; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.ad-device-links { display: flex; flex-wrap: wrap; gap: 8px 16px; border-top: 1px solid #edf0f3; padding-top: 15px; }
.ad-device-links button { display: flex; gap: 10px; background: transparent; color: var(--blue); font-size: 11px; padding: 8px 0; cursor: pointer; }
.ad-device-links span { font-size: 12px; }
.ad-editor-split { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 0; flex: 1; }
.ad-resource-list { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid #e7ecf2; }
.ad-list-search { padding: 14px; border-bottom: 1px solid #edf0f4; }
.ad-list-search input { width: 100%; background: #f9fbfd !important; }
.ad-list-scroll { overflow: auto; min-height: 0; flex: 1; scrollbar-width: thin; }
.ad-resource-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 62px; border-bottom: 1px solid #f0f3f6; border-left: 2px solid transparent; padding: 12px; background: #fff; cursor: pointer; color: #344052; }
.ad-resource-item > span { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
.ad-resource-item > strong { font-size: 11px; font-weight: 500; line-height: 1.65; flex: 1; overflow-wrap: anywhere; }
.ad-resource-item > small { font-size: 9px; white-space: nowrap; background: #f0f3f7; padding: 3px 5px; border-radius: 3px; color: var(--muted); }
.ad-resource-item.selected { border-left-color: var(--blue); color: var(--blue); background: #edf4ff; }
.ad-list-count { padding: 16px; font-size: 10px; color: var(--muted); border-top: 1px solid #e7ecf2; }
.ad-editor-body { padding: 22px 24px; }
.ad-editor-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.ad-editor-title h2 { font-size: 15px; font-weight: 600; margin: 0; }
.ad-editor-body form { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; }
.ad-editor-body .question-editor { border: 0; background: none; border-radius: 0; padding: 0; display: grid; gap: 16px; }
.ad-editor-body .question-editor-head { padding: 0; }
.ad-editor-body .question-editor-head > span { color: var(--muted); font-size: 12px; }
.ad-editor-body .question-option-grid { gap: 12px; }
.ad-editor-body .form-row.two { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.ad-editor-body .question-editor input[type="checkbox"] { min-height: auto; width: 16px; height: 16px; }
.ad-editor-body .question-editor fieldset { border: 0; padding: 0; }
.app-shell.is-admin .question-type-single .multi-answer-field,
.app-shell.is-admin .question-type-single .type-judge,
.app-shell.is-admin .question-type-single .type-blank,
.app-shell.is-admin .question-type-multiple .single-answer-field,
.app-shell.is-admin .question-type-multiple .type-judge,
.app-shell.is-admin .question-type-multiple .type-blank,
.app-shell.is-admin .question-type-judge .type-options,
.app-shell.is-admin .question-type-judge .type-blank,
.app-shell.is-admin .question-type-blank .type-options,
.app-shell.is-admin .question-type-blank .type-judge { display: none; }
.ad-video-preview { aspect-ratio: 16/9; max-height: 330px; width: 100%; border-radius: 6px; overflow: hidden; background: #19212a; color: #bec9d4; display: grid; place-items: center; font-size: 12px; }
.ad-video-preview video { width: 100%; height: 100%; object-fit: contain; }
.ad-file-button { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.ad-file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.ad-file-path { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; margin: 0; }
.ad-empty { padding: 32px 20px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
.ad-empty-center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; height: 100%; }
.ad-empty-center img { margin-bottom: 18px; opacity: .55; }
.ad-empty-center h2 { font-size: 16px; font-weight: 500; color: #455569; margin: 0 0 6px; }
.ad-empty-center p { font-size: 12px; margin: 0; }
.ad-document-content textarea { min-height: 320px; }
.ad-inline-field { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); flex: 1; }
.ad-inline-field select { max-width: 390px; }
.ad-roster-toolbar { align-items: end; }
.ad-roster-selectors { display: grid; grid-template-columns: minmax(150px,1fr) minmax(220px,1.5fr); gap: 12px; flex: 1 1 440px; max-width: 640px; min-width: 0; }
.ad-roster-selectors .field { margin: 0; min-width: 0; }
.ad-roster-selectors .field > span { white-space: nowrap; }
.ad-roster-selectors select { width: 100%; min-width: 0; }
.roster-secondary { display: grid; gap: 12px; }
.roster-secondary h3 { margin: 0; font-size: 13px; }
.roster-secondary .row-actions { flex-wrap: wrap; }
.ad-portal-shell { --portal-inset: 28px; }
.ad-portal-shell :is(.ad-heading, .ad-toolbar, .ad-subtabs, .ad-portal-settings, .ad-portal-inbox, .ad-footer) { padding-inline: var(--portal-inset); }
.ad-portal-shell .ad-inline-field { display: grid; gap: 8px; flex: 0 1 390px; }
.ad-portal-shell .ad-inline-field select { width: 100%; }
.app-shell.is-admin .ad-portal-settings form { margin-inline: 0; width: min(900px, 100%); }
.ad-context-strip { display: flex; justify-content: space-between; gap: 16px; padding: 16px 28px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.ad-context-strip strong { color: #344052; font-weight: 600; }
.ad-subtabs { display: flex; flex-wrap: wrap; gap: 0 24px; padding: 0 28px; border-bottom: 1px solid #e7ecf2; }
.ad-subtabs button { min-height: 40px; padding: 8px 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.ad-subtabs button.active { border-color: var(--blue); color: var(--blue); }
.ad-batch-form form { max-width: 900px; margin: 0 auto; gap: 18px; }
.ad-batch-form form > button[type="submit"], .ad-batch-form .notice-editor-actions > button[type="submit"] { display: none; }
.ad-batch-form .micro-note { font-size: 10px; line-height: 1.7; }
.ad-batch-form .form-row { gap: 16px; }
.ad-pagination { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); }
.ad-roster { padding: 0 28px; }
.ad-roster table, .ad-plain-table { width: 100%; border-collapse: collapse; min-width: 0; }
.ad-roster th, .ad-plain-table th { font-size: 11px; font-weight: 500; text-align: left; color: var(--muted); background: #fafbfd; padding: 14px 12px; border-bottom: 1px solid #e7ecf2; position: sticky; top: 0; }
.ad-roster td, .ad-plain-table td { padding: 16px 12px; font-size: 12px; border-bottom: 1px solid #edf1f5; }
.ad-roster small { display: block; font-size: 10px; margin-top: 6px; color: var(--muted); }
.ad-roster .pill { white-space: nowrap; }
.roster-summary { display: flex; flex-wrap: wrap; gap: 12px 28px; padding: 14px 28px; background: #f7f9fc; color: var(--muted); font-size: 12px; }
.roster-summary strong { color: var(--ink); margin-left: 8px; font-size: 17px; font-variant-numeric: tabular-nums; }
.roster-filters select { width: 180px; max-width: 100%; }
.roster-filters input { width: 150px; }
.roster-filters > .row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ad-roster th:first-child, .ad-roster td:first-child { min-width: 120px; }
.roster-complete { color: #368b6a; }
#ad-device-dialog.roster-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 24px; overflow: hidden; }
#ad-device-dialog.roster-dialog form { max-height: calc(100dvh - 90px); display: flex; flex-direction: column; gap: 16px; }
.roster-dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.roster-dialog-body { min-height: 0; overflow: auto; display: grid; gap: 16px; padding-right: 4px; }
.roster-dialog-body .field { margin: 0; }
.roster-renew-confirm { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.roster-renew-confirm input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; margin: 0; }
.roster-dialog-body textarea { width: 100%; resize: vertical; }
.roster-record-status { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.roster-dates { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; margin: 0; font-size: 12px; }
.roster-dates dt { color: var(--muted); }
.roster-dates dd { margin: 0; overflow-wrap: anywhere; }
#ad-device-dialog .roster-primary-actions { justify-content: flex-start; flex-wrap: wrap; }
.roster-more { border-block: 1px solid #edf1f5; padding: 12px 0; font-size: 12px; }
.roster-more summary { cursor: pointer; }
.roster-more .row-actions { padding-top: 12px; flex-wrap: wrap; }
.roster-history h3 { font-size: 12px; font-weight: 600; margin: 0 0 8px; }
.roster-history p { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin: 0; padding: 10px 0; border-bottom: 1px solid #edf1f5; font-size: 12px; }
.roster-history small { color: var(--muted); }
@media (max-width: 640px) {
  .roster-summary { padding: 10px 16px; gap: 8px 18px; }
  .roster-summary strong { font-size: 14px; }
  .roster-filters .tabs { gap: 4px; }
  .roster-filters .tab { padding: 6px 9px; }
}
.ad-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 4px 0 28px; border-bottom: 1px solid #e7ecf2; gap: 24px; }
.ad-stat { display: flex; flex-direction: column; gap: 12px; }
.ad-stat > span { color: #536174; font-size: 12px; }
.ad-stat > strong { font-size: 34px; font-weight: 550; font-variant-numeric: tabular-nums; line-height: 1; }
.ad-stat > small { font-size: 10px; color: var(--muted); line-height: 1.6; }
.ad-stats-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 28px 0; border-bottom: 1px solid #e7ecf2; }
.ad-stats-columns h2 { font-size: 14px; font-weight: 600; margin: 0 0 24px; }
.ad-rate { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.ad-rate > strong { font-size: 32px; color: #267454; font-weight: 550; }
.ad-rate small { font-size: 16px; margin-left: 3px; }
.ad-rate > span { font-size: 11px; color: var(--muted); line-height: 1.7; }
.ad-status-bars { display: grid; gap: 18px; }
.ad-status-bars > div { display: grid; grid-template-columns: 110px minmax(0,1fr) 22px; gap: 12px; align-items: center; font-size: 11px; }
.ad-status-bars span { color: var(--muted); }
.ad-status-bars strong { font-weight: 550; text-align: right; }
.ad-status-bars progress { width: 100%; height: 6px; border-radius: 3px; overflow: hidden; border: 0; accent-color: var(--bar-color); background: #edf0f4; }
.ad-status-bars progress::-webkit-progress-bar { background: #edf0f4; }
.ad-status-bars progress::-webkit-progress-value { background: var(--bar-color); border-radius: 3px; }
.ad-pending-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; padding-top: 26px; }
.ad-pending-stats > div { display: grid; gap: 10px; }
.ad-pending-stats span { font-size: 11px; color: #536174; }
.ad-pending-stats strong { font-size: 16px; color: #7a8796; font-weight: 450; }
.ad-pending-stats small { font-size: 10px; color: var(--muted); }
.app-shell.is-admin .toast { bottom: 110px; right: 40px; max-width: min(400px,calc(100% - 32px)); font-size: 12px; pointer-events: none; }
#ad-device-dialog::backdrop { background: #16202a35; backdrop-filter: blur(3px); }
#ad-device-dialog { position: fixed; z-index: 50; inset: 0; margin: auto; width: min(420px,calc(100% - 32px)); height: fit-content; padding: 28px; border: 1px solid #fff; border-radius: 8px; box-shadow: 0 20px 80px #172a4a25; background: #fff; }
#ad-device-dialog form { display: grid; gap: 24px; }
#ad-device-dialog h2 { margin: 0; font-size: 18px; font-weight: 600; }
#ad-device-dialog .row-actions { justify-content: flex-end; }
.app-shell.is-admin #ad-device-dialog.ad-account-dialog { padding: 20px; max-height: calc(100dvh - 32px); overflow: auto; }
#ad-device-dialog.ad-account-dialog[open] { display: grid; gap: 16px; }
#ad-device-dialog .ad-account-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#ad-device-dialog .ad-account-heading h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#ad-device-dialog .ad-account-heading .btn { flex: none; width: auto; white-space: nowrap; }
.app-shell.is-admin #ad-device-dialog.ad-account-dialog :is(#ad-portal-profile, #ad-portal-code, .ad-detail-list, .ad-account-history) { margin: 0; }
.app-shell.is-admin #ad-device-dialog.ad-account-dialog .ad-account-history > summary { margin: 0; }
.app-shell.is-admin #ad-device-dialog.ad-account-dialog .ad-account-history[open] > summary { margin-bottom: 12px; }
.app-shell.is-admin #ad-device-dialog.ad-account-dialog .ad-account-actions { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); justify-content: flex-start; gap: 8px; }
#ad-device-dialog.ad-account-dialog .ad-account-actions > :last-child { margin-left: auto; }
#ad-device-dialog.ad-reminder-dialog fieldset { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; gap: 16px; }
#ad-device-dialog.ad-reminder-dialog textarea { width: 100%; resize: vertical; }
#ad-device-dialog.ad-reminder-dialog .ad-portal-record { overflow-wrap: anywhere; }
#ad-device-dialog.ad-reminder-dialog .ad-portal-record small { display: block; margin-top: 4px; color: var(--muted); }
#ad-device-dialog.ad-rules-dialog { max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; }
#ad-device-dialog.ad-rules-dialog form { gap: 16px; }
.ad-policy-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.ad-policy-heading h2, #ad-device-dialog.ad-rules-dialog h2 { margin: 0; font-size: 14px; font-weight: 600; }
.ad-policy-steps { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 0; padding: 12px 0; border: 0; }
.ad-policy-steps legend { font-size: 12px; color: var(--muted); }
.ad-policy-steps label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.app-shell.is-admin .ad-policy-steps input { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--blue); }
.ad-policy-numbers { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.ad-policy-numbers .field:last-child { grid-column: 1 / -1; }
.ad-policy-numbers input:disabled { color: var(--muted); background: var(--blue-soft); }
.ad-batch-rules { display: grid; }
.ad-policy-section { border-top: 1px solid var(--line); padding-top: 18px; }
.ad-policy-summary { display: grid; gap: 12px; margin: 16px 0 0; font-size: 12px; line-height: 1.7; }
.ad-policy-summary > div { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 12px; }
.ad-policy-summary dt { color: var(--muted); }
.ad-policy-summary dd { margin: 0; overflow-wrap: anywhere; }
.ad-batch-rules select { width: 100%; max-width: 100%; }
@media (max-width: 640px) {
  .ad-batch-form:has(.ad-batch-rules) + .ad-footer > span { max-width: 100%; }
  .ad-policy-summary > div { grid-template-columns: 72px minmax(0,1fr); gap: 8px; }
  #ad-device-dialog.ad-rules-dialog { padding: 20px; }
}
.app-shell.is-admin .admin-login-page { width: min(440px,100%); margin: auto; overflow: auto; max-height: 100%; }
.app-shell.is-admin .admin-login-card { border-radius: 8px; padding: 28px; background: #ffffffd9; }
.app-shell.is-admin .admin-login-card h1 { font-size: 22px; }
@media (max-width: 1150px) {
  .ad-report-metrics { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 16px; }
  .ad-report-columns { grid-template-columns: 1fr; }
  .ad-portal-shell { --portal-inset: 20px; }
  .ad-shell { grid-template-columns: 188px minmax(0,1fr); }
  .ad-editor-split { grid-template-columns: 205px minmax(0,1fr); }
  .ad-device-grid { grid-template-columns: 1fr; }
  .ad-heading, .ad-toolbar, .ad-scroll { padding-left: 20px; padding-right: 20px; }
  .ad-stat-grid { gap: 16px; }
  .ad-stats-columns { gap: 24px; }
}
@media (max-width: 760px) {
  .ad-report-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ad-batch-directory th:nth-child(2), .ad-batch-directory td:nth-child(2), .ad-batch-directory th:nth-child(3), .ad-batch-directory td:nth-child(3) { display: none; }
  .ad-batch-directory td:first-child { width: 45%; }
  .ad-batch-directory td .row-actions { gap: 6px; }
  .ad-batch-filters .field, .ad-report-filters .field { max-width: none; }
  .ad-batch-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ad-batch-filters .field:last-of-type { grid-column: 1 / -1; }
  .ad-batch-filters > .btn { justify-self: start; }
  .app-shell.is-admin .ad-batch-directory .btn { height: 44px; min-height: 44px; }
  .ad-portal-shell { --portal-inset: 16px; }
  .ad-mobile-exit { display: inline-flex; }
  .app-shell.is-admin .topbar-inner { padding: 0 16px; min-height: 52px; }
  .app-shell.is-admin .brand-subtitle { display: none; }
  .app-shell.is-admin .main { padding: 8px; }
  .ad-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); }
  .ad-sidebar { padding: 10px; max-height: 142px; display: block; border-right: 0; border-bottom: 1px solid var(--line); }
  .ad-nav-group { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 4px; }
  .ad-nav-group > span, .ad-sidebar-bottom { display: none; }
  .ad-nav-item { width: auto; font-size: 10px; min-height: 36px; padding: 8px; gap: 5px; margin: 0; }
  .ad-nav-item > span { font-size: 13px; width: 12px; }
  .ad-nav-group details { flex: 1; }
  .ad-nav-group summary { min-height: 34px; padding: 6px 8px; font-size: 10px; gap: 5px; margin: 0; }
  .ad-nav-group summary > span { font-size: 13px; width: 12px; }
  .ad-device-nav { margin: 0 0 4px; padding: 0; border: 0; }
  .ad-device-nav button { font-size: 10px; min-height: 34px; }
  .ad-heading { padding: 16px; gap: 10px; }
  .ad-heading h1 { font-size: 18px; }
  .ad-header-actions { gap: 6px; justify-content: flex-end; }
  .ad-header-actions .pill { display: none; }
  .ad-toolbar { padding: 12px 16px; gap: 10px; }
  .ad-toolbar > strong { font-size: 12px; }
  .ad-scroll { padding: 18px 16px; }
  .ad-footer { padding: 12px 16px; min-height: 69px; }
  .ad-footer > span { font-size: 10px; max-width: 55%; }
  .app-shell.is-admin .btn { min-height: 40px; padding: 9px 12px; font-size: 11px; }
  .ad-device-card { padding: 16px; }
  .ad-device-title h2 { font-size: 14px; }
  .ad-editor-split { display: flex; flex-direction: column; }
  .ad-resource-list { flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .ad-list-search { padding: 8px 16px; }
  .ad-list-scroll { max-height: 92px; display: flex; overflow: auto; }
  .ad-resource-item { width: 168px; flex: 0 0 168px; min-height: 58px; }
  .ad-resource-item strong { font-size: 10px; }
  .ad-resource-item small { display: none; }
  .ad-list-count { display: none; }
  .ad-editor-body { min-height: 0; flex: 1; }
  .ad-editor-body .form-row.two, .ad-editor-body .question-option-grid { grid-template-columns: 1fr; }
  .ad-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 16px; }
  .ad-stat > strong { font-size: 28px; }
  .ad-stats-columns { grid-template-columns: 1fr; gap: 32px; }
  .ad-pending-stats { grid-template-columns: 1fr; }
  .ad-context-strip { padding: 12px 16px; flex-wrap: wrap; font-size: 10px; }
  .ad-subtabs { padding: 0 16px; }
  .ad-inline-field { flex-basis: 100%; }
  .ad-inline-field select { width: 100%; }
  .ad-roster { padding: 0 12px; }
  .ad-roster table { min-width: 0; table-layout: fixed; }
  .ad-roster th:nth-child(2), .ad-roster td:nth-child(2),
  .ad-roster th:nth-child(3), .ad-roster td:nth-child(3),
  .ad-roster th:nth-child(4), .ad-roster td:nth-child(4) { display: none; }
  .ad-roster th:first-child, .ad-roster td:first-child { width: 38%; min-width: 0; overflow-wrap: anywhere; }
  .ad-roster th:nth-child(5), .ad-roster td:nth-child(5) { width: 28%; }
  .ad-roster th, .ad-roster td { padding: 12px 6px; }
  .ad-toolbar .tabs { flex-wrap: wrap; }
  .ad-toolbar .row-actions { flex-wrap: wrap; }
  .ad-batch-form .form-row { grid-template-columns: 1fr 1fr; }
  .app-shell.is-admin .toast { right: 16px; bottom: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell.is-admin * { transition: none !important; animation: none !important; }
}
