#adm-trends {
  background: var(--study-sheet);
  border: 1px solid var(--study-rule);
  border-radius: .85rem;
  color: var(--study-ink);
  padding: clamp(1rem, 3vw, 1.8rem);
}
#adm-trends h2 { font: 500 clamp(1.25rem, 2vw, 1.75rem)/1.2 var(--study-title); }
.admin-series-controls { display: flex; flex-wrap: wrap; gap: .35rem; margin-block: 1rem; }
.admin-series-controls button, #adm-overview-retry {
  min-height: 44px; padding: .45rem .75rem; border-radius: .55rem;
  border: 1px solid var(--study-rule); color: var(--study-ink); background: var(--study-sheet);
}
.admin-series-controls button[aria-pressed="true"] {
  background: var(--study-action); color: white; border-color: transparent;
}
#view-admin #adm-daily-trend-bars table { table-layout: auto; white-space: normal; background: var(--study-sheet); color: var(--study-ink); width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .875rem; }
#adm-daily-trend-bars caption { text-align: start; font-weight: 650; padding-block-end: .4rem; }
#adm-daily-trend-bars :is(th,td) { background: transparent; color: inherit; white-space: normal; overflow-wrap: anywhere; padding: .4rem .25rem; border-inline: 0; border-bottom: 1px solid var(--study-rule); }
#adm-daily-trend-bars th { text-align: start; font-weight: 500; color: var(--study-muted); }
#adm-daily-trend-bars td:last-child { text-align: end; }
#adm-overview-error { color: var(--study-ink); padding: 1rem; }
#adm-overview-retry { margin-inline-start: .5rem; }
@media(max-width: 520px) {
  #adm-trends { padding: .8rem; }
  #adm-overview-body .grid > div { min-width: 0; }
  #adm-overview-body .truncate { white-space: normal; overflow-wrap: anywhere; }
  #adm-overview-body > .grid.grid-cols-2 { grid-template-columns: 1fr; }
  #adm-overview-body > .grid > div > .flex { flex-wrap: wrap; }
}

.admin-workspace { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: clamp(1rem, 2.5vw, 2rem); align-items: start; }
.admin-content { min-width: 0; }
.admin-destinations { position: sticky; top: 0; }
.admin-destination-list { display: grid; gap: .125rem; border-inline-end: 1px solid var(--study-rule); padding-inline-end: .6rem; }
#view-admin .admin-destination-list button {
  min-height: 44px; padding: .55rem .75rem; text-align: start; line-height: 1.3;
  background: transparent; color: var(--study-muted); border-inline-start: 3px solid transparent;
}
#view-admin .admin-destination-list button:hover { color: var(--study-ink); background: var(--study-wash); }
#view-admin .admin-destination-list button[aria-current] { border-color: var(--study-accent); color: var(--study-accent); background: var(--study-wash); font-weight: 650; }
#adm-destination, #adm-series-picker { display: none; color: var(--study-ink); background: var(--study-sheet); width: 100%; min-height: 44px; padding: .45rem .65rem; border: 1px solid var(--study-rule); border-radius: .5rem; }
#adm-live-poll-indicator { min-height: 44px; padding-inline: .65rem; font-size: .8rem; }
#view-admin :is(.admin-destination-list button, select, summary, #adm-live-poll-indicator):focus-visible { outline: 2px solid var(--study-accent); outline-offset: -2px; }
.admin-trend-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-block: 1.3rem .8rem; }
.admin-trend-heading h3 { font: 550 clamp(1.2rem,2vw,1.6rem)/1.2 var(--study-title); }
.admin-trend-heading p, .admin-column small { color: var(--study-muted); font-size: .8rem; }
.admin-trend-heading strong { font-size: clamp(1.4rem,3vw,2.5rem); font-variant-numeric: tabular-nums; }
.admin-columns { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .3rem; text-align: center; font-variant-numeric: tabular-nums; }
.admin-column { display: grid; grid-template-rows: auto 5.5rem auto; gap: .3rem; }
.admin-column > span { font-size: clamp(.68rem,1.3vw,.9rem); overflow-wrap: anywhere; }
.admin-column-track { display: flex; align-items: flex-end; border-block-end: 1px solid var(--study-rule); background: transparent; }
.admin-column-track i { display: block; width: 65%; margin-inline: auto; background: var(--study-muted); border-radius: .22rem .22rem 0 0; }
.admin-column:last-child i { background: var(--study-accent); }
#adm-daily-trend-bars summary { min-height: 44px; padding-block: .8rem; cursor: pointer; color: var(--study-accent); }
@media (max-width: 980px) {
  .admin-workspace { display: block; }
  .admin-destinations { position: static; margin-block-end: 1rem; }
  .admin-destination-list { display: none; }
  #adm-destination { display: block; }
}
@media (max-width: 620px) {
  #adm-series-picker { display: block; margin-block-start: .8rem; }
  .admin-series-controls { display: none; }
}

.admin-masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block-end: 1rem; border-block-end: 1px solid var(--study-rule); }
#view-admin .admin-masthead h1 { font: 500 clamp(1.6rem,3vw,2.5rem)/1.15 var(--study-title); color: var(--study-ink); overflow-wrap: anywhere; }
.admin-actions, #view-admin #adm-quick-export-toolbar, #view-admin #adm-scope-selector-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .6rem; min-width: 0; }
#view-admin #adm-scope-selector-wrap { color: var(--study-muted); font-size: .85rem; }
.admin-actions select, .admin-actions button { min-height: 44px; max-width: 100%; font-size: .85rem; padding: .45rem .65rem; border-radius: .45rem; color: var(--study-ink); }
.admin-actions select { background: var(--study-sheet); border: 1px solid var(--study-rule); }
.admin-actions button:hover { background: var(--study-wash); }
#view-admin .admin-actions .admin-add { background: var(--study-action); color: #fff; }
.admin-destinations { max-height: calc(100dvh - 5rem); overflow-y: auto; }
body:has(:is(#view-admin,#view-org_admin,#view-teacher):not(.hidden)) #notif-permission-banner { display: none; }

#view-admin .admin-reset-filters {
  display: inline-flex; align-items: center; min-height: 44px; padding: .4rem .75rem;
  border: 1px solid var(--study-rule); border-radius: .45rem; color: var(--study-accent);
}
#view-admin table[data-record-table] { color: var(--study-ink); }
#view-admin table[data-record-table] th { text-align: start; letter-spacing: normal; }
@media (max-width: 47.99rem) {
  #view-admin table[data-record-table] { display: block; min-width: 0; width: 100%; }
  #view-admin table[data-record-table] thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  #view-admin table[data-record-table] tbody { display: grid; gap: .75rem; padding: .5rem; }
  #view-admin table[data-record-table] tr { display: block; padding: .6rem; background: var(--study-sheet); border: 1px solid var(--study-rule); border-radius: .6rem; }
  #view-admin table[data-record-table] td { white-space: normal; overflow-wrap: anywhere; padding: .4rem .25rem; }
  #view-admin table[data-record-table] td[data-field] { display: grid; grid-template-columns: minmax(5.4rem,.8fr) minmax(0,1.5fr); align-items: baseline; gap: .1rem .6rem; text-align: start; }
  #view-admin table[data-record-table] td[data-field]::before { content: attr(data-field); content: attr(data-field) / ""; color: var(--study-muted); font-size: .76rem; }
  #view-admin table[data-record-table] td[data-field] > * { grid-column: 2; max-width: 100%; }
  #view-admin table[data-record-table] button { min-height: 44px; min-width: 44px; }
}

/* The admin workspace shares its paper and accent with the current organization. */
#view-admin .admin-workspace { gap: clamp(1rem, 2.4vw, 2.25rem); }
#view-admin .admin-masthead { align-items: baseline; padding-block: .5rem 1.1rem; }
#view-admin .admin-actions { gap: .5rem; }
#view-admin .admin-actions select { border-radius: .6rem; }
#view-admin .admin-add { padding-inline: 1rem; }
#view-admin .admin-destination-list { gap: .2rem; padding-inline-end: .8rem; }
#view-admin .admin-destination-list button {
  display: flex; align-items: center; gap: .7rem; border: 0;
  border-radius: .55rem; font-size: .87rem; font-weight: 550;
}
#view-admin .admin-destination-list i { width: 1.1rem; text-align: center; opacity: .8; }
#view-admin .admin-destination-list [aria-current="page"] {
  color: var(--study-accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--study-accent) 30%, transparent);
}
#view-admin .admin-content > [id^="adm-panel-"] { min-width: 0; }
#view-admin .admin-content :is(input[type="search"], input[type="text"], select) {
  max-width: 100%; min-height: 42px; font-size: .85rem; border-radius: .6rem;
}
#view-admin .admin-content table[data-record-table] { font-size: .84rem; }
#view-admin .admin-content table[data-record-table] thead th {
  min-width: 0; font-size: .73rem; font-weight: 650; white-space: normal;
  line-height: 1.35; text-transform: none; background: var(--study-wash); color: var(--study-muted);
}
#view-admin table[data-record-table] tbody tr:hover { background-color: var(--study-wash); }

#adm-panel-campaigns .campaign-intro { display: grid; gap: 1rem; }
.campaign-heading, .campaign-controls, .campaign-files, .campaign-swatches, .campaign-link {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
}
.campaign-heading { justify-content: space-between; gap: .75rem; }
#view-admin .campaign-heading h2, .campaign-share-heading h2 {
  color: var(--study-ink); font: 500 clamp(1.55rem, 2.4vw, 2.25rem)/1.15 var(--study-title);
  letter-spacing: -.025em; margin: 0;
}
.campaign-controls button, .campaign-files button, .campaign-swatches button, .campaign-link button,
#view-admin .campaign-row-qr, .campaign-close {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .5rem .85rem; border-radius: .65rem;
  border: 1px solid var(--study-rule); background: var(--study-sheet); color: var(--study-ink);
  font-family: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.campaign-controls button:hover, .campaign-files button:hover, .campaign-link button:hover,
.campaign-swatches button:hover, .campaign-close:hover { background: var(--study-wash); }
:is(.campaign-controls, .campaign-files) button.campaign-primary {
  color: white; background: var(--study-action); border-color: transparent;
}
.campaign-sections { display: flex; border-bottom: 1px solid var(--study-rule); gap: 1rem; }
.campaign-sections button {
  min-height: 44px; padding: .5rem .2rem; border-bottom: 3px solid transparent;
  color: var(--study-muted); font-weight: 550; font-size: .9rem;
}
.campaign-sections [aria-pressed="true"] { color: var(--study-accent); border-color: currentColor; }
#view-admin .campaign-row-qr { margin-inline-start: .3rem; color: var(--study-accent); background: var(--study-wash); padding-inline: .65rem; }
#adm-panel-campaigns [data-camp-panel="manage"] { padding: clamp(.7rem,2vw,1.35rem); }
#adm-campaigns-table-body td:first-child > div { flex-wrap: wrap; overflow-wrap: anywhere; }

#modal-adm-campaign-share { padding: clamp(.5rem,2vw,1.5rem); align-items: center; justify-content: center; }
#modal-adm-campaign-share .campaign-share-sheet {
  width: min(54rem, 100%); max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--study-sheet); color: var(--study-ink); border: 1px solid var(--study-rule);
  border-radius: 1.25rem; box-shadow: 0 20px 80px #06071955;
}
.campaign-share-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem clamp(1rem,3vw,1.7rem); border-bottom: 1px solid var(--study-rule);
}
.campaign-close { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.6rem; }
.campaign-share-layout {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: clamp(1rem,3vw,2rem);
  padding: clamp(.85rem,3vw,1.7rem); align-items: start;
}
#modal-adm-campaign-share .campaign-ticket {
  --ticket-color: #373796;
  display: grid; justify-items: center; gap: .4rem; text-align: center; overflow-wrap: anywhere;
  min-width: 0; padding: clamp(.9rem,3vw,1.55rem); border-radius: .85rem; border: 1px solid #d9dae4;
  border-top: .42rem solid var(--ticket-color); color: #25263a; background: #fff;
}
.ticket-brand { font: 700 .76rem/1.4 system-ui,sans-serif; letter-spacing: .09em; text-transform: uppercase; color: var(--ticket-color); }
#adm-campaign-flyer-card h3 { font: 600 clamp(1.25rem,2vw,1.6rem)/1.2 var(--study-title); color: #232438; }
#adm-camp-qr-svg-container { width: min(100%, 16rem); background: white; aspect-ratio: 1; }
#adm-camp-qr-svg-container svg { width: 100%; height: auto; display: block; }
#adm-flyer-promo-badge { color: var(--ticket-color); font-size: 1.05rem; }
#adm-flyer-perks-list, #adm-flyer-exp-date { color: #55596c; font-size: .8rem; }
.campaign-ticket :is(p,small):empty { display: none; }
#adm-flyer-code-pill { width: 100%; padding: .65rem .25rem .1rem; margin-top: .4rem; border-top: 1px dashed #c6c8d4; font: 600 .9rem/1.4 monospace; color: #393c4e; }
#adm-flyer-code-pill i { margin-inline-start: .5rem; }
.campaign-share-tools { display: grid; align-content: start; gap: 1.3rem; }
.campaign-share-tools fieldset { min-width: 0; border: none; padding: 0; }
.campaign-share-tools :is(legend,label) { display: block; margin-block-end: .5rem; font-size: .9rem; font-weight: 650; }
.campaign-swatches button { min-height: 44px; padding-inline: .65rem; }
.campaign-swatches i { width: .85rem; height: .85rem; background: var(--swatch); border-radius: 50%; }
.campaign-swatches [aria-pressed="true"] { border-color: var(--study-accent); box-shadow: inset 0 0 0 1px var(--study-accent); }
.campaign-files { align-items: stretch; }
.campaign-files .campaign-primary { flex: 1 1 100%; }
.campaign-files button { flex: 1; }
.campaign-link { flex-wrap: nowrap; }
.campaign-link input { min-width: 0; width: 100%; height: 42px; border: 1px solid var(--study-rule); border-radius: .6rem; padding-inline: .65rem; color: var(--study-ink); background: var(--study-paper); font: .82rem monospace; }
.campaign-link button { flex-shrink: 0; }
.campaign-share-tools details { border-top: 1px solid var(--study-rule); font-size: .86rem; }
.campaign-share-tools summary { padding-block: .85rem; cursor: pointer; color: var(--study-accent); font-weight: 600; }
.campaign-share-tools details label:not(:first-of-type) { margin-top: .7rem; }
#modal-adm-campaign-share :focus-visible { outline: 2px solid var(--study-accent); outline-offset: 2px; }

@media (max-width: 680px) {
  .campaign-share-layout { grid-template-columns: minmax(0,1fr); }
  .campaign-share-heading { position: sticky; top: 0; z-index: 1; background: var(--study-sheet); }
  #adm-camp-qr-svg-container { width: min(100%, 13rem); }
  #view-admin .admin-masthead { gap: .55rem; }
  #view-admin .admin-destinations { margin-block-end: .75rem; }
  #view-admin .admin-content [class*="min-w-["]:is(.flex-1, .flex-wrap) { min-width: 0; }
  .campaign-controls button { min-height: 44px; }
}

@media print {
  body.allow-print.printing-campaign-flyer > :not(#modal-adm-campaign-share),
  body.printing-campaign-flyer .campaign-share-heading,
  body.printing-campaign-flyer .campaign-share-tools,
  body.printing-campaign-flyer #adm-flyer-code-pill i { display: none !important; }
  body.allow-print.printing-campaign-flyer { display: block !important; height: auto !important; overflow: visible !important; background: white !important; }
  body.printing-campaign-flyer #modal-adm-campaign-share:not(.hidden),
  body.printing-campaign-flyer #modal-adm-campaign-share .campaign-share-sheet,
  body.printing-campaign-flyer .campaign-share-layout {
    display: block !important; position: static !important; width: 100% !important; max-height: none !important;
    padding: 0; overflow: visible; background: transparent !important; border: none; box-shadow: none;
    backdrop-filter: none !important;
  }
  body.printing-campaign-flyer .campaign-ticket { max-width: 125mm; margin: 12mm auto; break-inside: avoid; print-color-adjust: exact; }
  body.printing-campaign-flyer #adm-camp-qr-svg-container { width: 65mm; }
}

#view-admin .admin-record-heading { font: 500 clamp(1.4rem,2.5vw,2rem)/1.2 var(--study-title); color: var(--study-ink); }
#view-admin [data-section][hidden] { display: none !important; }
.admin-section-nav { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--study-rule); }
.admin-section-nav button { white-space: nowrap; padding: .6rem .75rem; min-height: 44px; color: var(--study-muted); font-size: .9rem; border-bottom: 3px solid transparent; }
.admin-section-nav button[aria-pressed="true"] { color: var(--study-accent); border-color: currentColor; font-weight: 650; }

.admin-global-tools { position: relative; }
.admin-global-tools summary {
  cursor: pointer; padding: .65rem .85rem; min-height: 44px; font-weight: 600;
  border: 1px solid var(--study-rule); border-radius: .6rem; color: var(--study-ink);
}
.admin-tool-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + .25rem); z-index: 12; min-width: 12rem;
  background: var(--study-sheet); border: 1px solid var(--study-rule); border-radius: .8rem;
  padding: .5rem; box-shadow: 0 6px 24px #10102022;
}
#view-admin .admin-tool-list #adm-quick-export-toolbar { display: grid; gap: .1rem; }
.admin-tool-list button { width: 100%; text-align: start; }
#view-admin table.campaign-records { width: 100%; border-collapse: collapse; table-layout: auto; }
#view-admin .campaign-records :is(th,td) { padding: .7rem; text-align: start; }
#view-admin .campaign-records td {
  color: var(--study-ink); white-space: normal; overflow-wrap: anywhere;
  border-inline: 0; background: transparent; vertical-align: middle; font-variant-numeric: tabular-nums;
}
#view-admin .campaign-records td strong { font-size: .95rem; }
#view-admin .campaign-records td small { display: block; color: var(--study-muted); margin-block: .2rem; font-size: .78rem; }
#view-admin .campaign-records .campaign-row-qr { margin: .25rem 0 0; min-height: 36px; }
@media (min-width: 768px) {
  #view-admin .campaign-records td:first-child { width: 30%; max-width: 15rem; }
}
@media (max-width: 680px) {
  #view-admin .admin-actions { width: 100%; justify-content: space-between; }
  #view-admin #adm-scope-selector-wrap { flex: 1; }
  #view-admin #adm-scope-org-filter { max-width: 60vw; }
  #adm-panel-questions > div > .flex-shrink-0, #adm-questions-pagination-controls { flex-wrap: wrap; min-width: 0; }
  #adm-panel-questions > div:has(#adm-questions-pagination-controls) { flex-wrap: wrap; gap: .5rem; }
  #adm-panel-campaigns [data-camp-panel="manage"] .flex:has(> #adm-camp-channel-filter) {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%;
  }
  #adm-panel-campaigns [data-camp-panel="manage"] div:has(> #adm-camp-search) { grid-column: 1/-1; max-width: none; }
  #view-admin .campaign-records tbody { padding: 0; }
  #view-admin .campaign-records tr { background: var(--study-sheet); }
  #view-admin .campaign-records tr td:first-child[data-field] { display: block; border-bottom: 1px solid var(--study-rule); padding-bottom: .7rem; }
  #view-admin .campaign-records tr td:first-child::before { display: none; }
  #view-admin .campaign-records td[data-field] { padding: .3rem .4rem; border-inline: 0; }
}
@media (max-width: 680px) {
  #view-admin #adm-panel-questions > div:has(#adm-questions-search) {
    display: grid; grid-template-columns: minmax(0,1fr);
  }
  #view-admin #adm-panel-questions .flex-shrink-0:has(button) {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; max-width: 100%;
  }
  #adm-panel-questions .flex-shrink-0 button { min-width: 0; white-space: normal; }
}
