/* ============================================================================
   Phishmetry — administrator interface design system ("Specimen").

   Data is set, not drawn: one variable grotesk (Roboto Flex) whose weight axis
   carries magnitude, a fixed colour per outcome used everywhere, an ink-black
   rail, and one acid-lime mark that owns live and current state.

   Loaded only by templates/admin_app/base.html and base_auth.html. The
   participant-facing simulation templates (templates/sim/*) never link this
   file, and every rule is scoped under `.aw` on <body> so an accidental include
   still cannot restyle a simulation page.

   Presentation only: no rule changes a form's name, value, method or action.
   ========================================================================= */

/* --- 0. Faces (self-hosted; nothing is fetched from a third party) ------- */

@font-face {
  font-family: "Roboto Flex";
  src: url("fonts/roboto-flex-latin-full-normal.a7e7fe3efbff.woff2") format("woff2-variations"),
       url("fonts/roboto-flex-latin-full-normal.a7e7fe3efbff.woff2") format("woff2");
  font-weight: 100 1000; font-stretch: 25% 151%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght-normal.33d0fc2ba586.woff2") format("woff2-variations"),
       url("fonts/jetbrains-mono-latin-wght-normal.33d0fc2ba586.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
}

/* --- 1. Tokens ----------------------------------------------------------- */

.aw {
  color-scheme: light;

  /* Ground, surfaces, rules */
  /* One neutral paper: regions are ruled, not carded. Only fields are white. */
  --bg:            #f4f4f2;
  --surface:       #f4f4f2;
  --surface-sunk:  #ececea;
  --surface-alt:   #e4e4e1;
  --field:         #ffffff;
  --line:          #d9d9d5;
  /* Field borders and other control edges: ≥3:1 on paper, field and sunk. */
  --line-strong:   #86867f;

  /* Ink */
  --ink:           #0c0d10;
  --ink-2:         #3f4550;
  --ink-3:         #5a606b;

  /* The rail is always ink, in both schemes */
  --rail:          #0c0d10;
  --rail-2:        #1a1c21;
  --rail-line:     #2a2d34;
  --rail-ink:      #f3f4f6;
  --rail-ink-2:    #aeb3bd;

  /* The one mark: current, live, selected. Always carries ink text. */
  --mark:          #c6f432;
  --mark-ink:      #0c0d10;

  /* Actions are ink; focus is electric blue so it never reads as data */
  --accent:        #0c0d10;
  --accent-ink:    #0c0d10;
  --accent-soft:   #eceef1;
  --focus:         #2f5bff;
  --link:          #2343c8;

  /* Outcome palette — one colour per outcome, in every pill, bar and chart */
  --o-sent:        #3b5bdb;
  --o-open:        #7c4dea;
  --o-click:       #e8590c;
  --o-submit:      #d6336c;
  --o-report:      #12a150;
  --o-train:       #0b9aa6;
  --o-sent-soft:   #e8edfd;
  --o-open-soft:   #f0eafd;
  --o-click-soft:  #fdeee4;
  --o-submit-soft: #fbe8ef;
  --o-report-soft: #e2f5ea;
  --o-train-soft:  #e0f4f5;
  /* Text-safe versions of the outcome hues (≥4.5:1 on white) */
  --o-sent-ink:    #2c46b8;
  --o-open-ink:    #5f33c4;
  --o-click-ink:   #b6430a;
  --o-submit-ink:  #b0245a;
  --o-report-ink:  #0b7a3c;
  --o-train-ink:   #08727b;

  /* Semantic — always paired with text, never colour alone */
  --ok:            #0b7a3c;
  --ok-soft:       #e2f5ea;
  /* Amber, not orange: a warning must never read as the Clicked outcome. */
  --warn:          #7a5c00;
  --warn-soft:     #fbf3d5;
  --danger:        #c4231b;
  --danger-ink:    #a51d16;
  --danger-soft:   #fde9e7;
  --on-danger:     #ffffff;
  --info:          #2c46b8;
  --info-soft:     #e8edfd;
  --neutral:       #4c535e;
  --neutral-soft:  #eceef1;

  /* 4px spacing scale */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem;  --s7: 3rem;

  --radius:    0;
  --radius-sm: .25rem;

  --sans: "Roboto Flex", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --nav-w: 16rem;
}

@media (prefers-color-scheme: dark) {
  .aw {
    color-scheme: dark;
    --bg:            #0b0c0f;
    --surface:       #0b0c0f;
    --surface-sunk:  #121419;
    --surface-alt:   #1b1e24;
    --field:         #15171c;
    --line:          #262a32;
    --line-strong:   #666c7a;
    --ink:           #eef0f3;
    --ink-2:         #b9bec8;
    --ink-3:         #8e95a1;
    --rail:          #050608;
    --rail-2:        #14161b;
    --rail-line:     #22252c;
    --accent:        #eef0f3;
    --accent-ink:    #eef0f3;
    --accent-soft:   #1d2027;
    --focus:         #7c9bff;
    --link:          #9cb2ff;
    --o-sent:        #6d8bff;
    --o-open:        #a685ff;
    --o-click:       #ff8a3d;
    --o-submit:      #ff5c93;
    --o-report:      #34cf7a;
    --o-train:       #2cc7d2;
    --o-sent-soft:   #1b2347;
    --o-open-soft:   #261c45;
    --o-click-soft:  #3a2112;
    --o-submit-soft: #3a1626;
    --o-report-soft: #0f2e1d;
    --o-train-soft:  #0c2b2e;
    --o-sent-ink:    #9cb2ff;
    --o-open-ink:    #c2abff;
    --o-click-ink:   #ffab73;
    --o-submit-ink:  #ff8fb4;
    --o-report-ink:  #6be0a0;
    --o-train-ink:   #6ad9e0;
    --ok:            #6be0a0;
    --ok-soft:       #0f2e1d;
    --warn:          #e8c45a;
    --warn-soft:     #2e2610;
    /* A red button stays red in the dark, not salmon beside Submitted pink. */
    --danger:        #d13438;
    --danger-ink:    #ff8f85;
    --danger-soft:   #3a1714;
    --on-danger:     #ffffff;
    --info:          #9cb2ff;
    --info-soft:     #1b2347;
    --neutral:       #b9bec8;
    --neutral-soft:  #1d2027;
  }
}

/* --- 2. Base ------------------------------------------------------------- */

.aw {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  font-variation-settings: "opsz" 14;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--o-sent);
  caret-color: var(--focus);
  scrollbar-color: var(--line-strong) transparent;
}

.aw *, .aw *::before, .aw *::after { box-sizing: border-box; }
.aw ::selection { background: var(--mark); color: var(--mark-ink); }

.aw a { color: var(--link); text-decoration: none; text-underline-offset: .2em; }
.aw a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

.aw h1, .aw h2, .aw h3, .aw h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
.aw h1 {
  font-size: 2.125rem; font-weight: 760; letter-spacing: -.025em;
  font-stretch: 88%; font-variation-settings: "opsz" 48;
}
.aw h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; font-stretch: 92%; }
.aw h3 { font-size: 1rem; font-weight: 650; }
.aw p  { margin: 0 0 var(--s3); text-wrap: pretty; }
.aw p:last-child { margin-bottom: 0; }
.aw strong, .aw b { font-weight: 650; }

.aw code, .aw pre, .aw .mono, .aw kbd, .aw samp {
  font-family: var(--mono); font-size: .86em; font-weight: 450;
}
.aw code {
  background: var(--surface-alt); border-radius: var(--radius-sm); padding: .05em .35em;
}

/* Visible keyboard focus everywhere, including on native controls. */
.aw :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.aw .visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.aw .skip-link {
  position: absolute; left: var(--s3); top: var(--s3); z-index: 60;
  transform: translateY(calc(-100% - 2 * var(--s3)));
  background: var(--mark); color: var(--mark-ink); font-weight: 650;
  padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
  transition: transform .15s cubic-bezier(.2, .8, .2, 1);
}
.aw .skip-link:focus { transform: none; }

/* --- 3. Application shell ------------------------------------------------ */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-color: var(--rail-line) transparent;
}
.sidebar a { color: var(--rail-ink); }

/* Rail icons: one 24px stroke set, coloured by the link they sit in. */
.sidebar .ico {
  width: 1.125rem; height: 1.125rem; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.orgbar { padding: var(--s4) var(--s4) var(--s3); display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.orgbar__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s3); }
.orgbar__product {
  display: flex; align-items: center; gap: .55rem; margin: 0 .25rem;
  font-size: 1.25rem; font-weight: 820; letter-spacing: -.02em; font-stretch: 78%;
  color: var(--rail-ink);
}
/* The mark: four bars at the four outcome weights. Drawn in CSS because it is
   the outcome palette itself, not an illustration. */
.orgbar__product::before {
  content: ""; width: 1.25rem; height: 1.25rem; flex: 0 0 auto;
  background:
    linear-gradient(var(--o-sent), var(--o-sent)) 0 100% / 22% 100% no-repeat,
    linear-gradient(var(--o-click), var(--o-click)) 33% 100% / 22% 70% no-repeat,
    linear-gradient(var(--o-submit), var(--o-submit)) 67% 100% / 22% 40% no-repeat,
    linear-gradient(var(--o-report), var(--o-report)) 100% 100% / 22% 85% no-repeat;
}
/* The organization in a card; a link to the chooser for those who may switch. */
.orgcard {
  display: flex; align-items: center; gap: .65rem; min-height: 2.75rem;
  padding: .45rem .6rem; border: 1px solid var(--rail-line); border-radius: .625rem;
  background: var(--rail-2); color: var(--rail-ink);
}
.sidebar a.orgcard { text-decoration: none; transition: border-color .15s ease; }
.sidebar a.orgcard:hover { border-color: var(--rail-ink-2); }
.orgcard > .ico { color: var(--rail-ink-2); }
.orgcard__badge {
  width: 1.875rem; height: 1.875rem; flex: 0 0 auto; border-radius: .45rem;
  display: grid; place-items: center;
  background: var(--mark); color: var(--mark-ink); font-weight: 800; font-size: .875rem;
}
.orgcard__badge .ico { stroke: var(--mark-ink); }
.orgcard__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.orgbar__name {
  font-size: .9375rem; font-weight: 650; color: var(--rail-ink); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.orgbar__slug { font-family: var(--mono); font-size: .75rem; color: var(--rail-ink-2); }
/* The script un-hides the toggle; this keeps it out of the wide layout, where
   the navigation is always open and the button would do nothing useful. */
.aw .orgbar [data-nav-toggle] { display: none; }

.nav { padding: var(--s1) var(--s2) var(--s3) var(--s4); flex: 1; display: flex; flex-direction: column; gap: var(--s3); }
.nav__list { list-style: none; margin: 0; padding: 0; }
.nav__list li { margin: 0; }
.nav__title {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 1.75rem; padding: 0 var(--s3); border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 700; font-stretch: 85%; letter-spacing: .08em; text-transform: uppercase;
  color: var(--rail-ink-2); cursor: pointer; list-style: none;
}
.nav__title::-webkit-details-marker { display: none; }
.nav__title:hover { color: var(--rail-ink); }
.nav__title .ico { width: .875rem; height: .875rem; transition: transform .15s ease; }
.nav__group:not([open]) > .nav__title .ico { transform: rotate(-90deg); }
.aw .nav__link {
  position: relative; display: flex; align-items: center; gap: .7rem;
  min-height: 2.125rem; padding: .25rem var(--s3); border-radius: .5rem;
  color: var(--rail-ink-2); font-size: .9375rem; font-weight: 450; line-height: 1.3;
  transition: background-color .15s ease, color .15s ease;
}
.aw .nav__link:hover { background: var(--rail-2); color: var(--rail-ink); text-decoration: none; }
.aw .nav__link[aria-current="page"] { background: var(--rail-2); color: var(--rail-ink); font-weight: 650; }
/* The lime bar marks where you are; the icon takes the same colour. */
.aw .nav__link[aria-current="page"]::before {
  content: ""; position: absolute; left: calc(-1 * var(--s2)); top: .5rem; bottom: .5rem;
  width: 3px; border-radius: 2px; background: var(--mark);
}
.aw .nav__link[aria-current="page"] .ico { color: var(--mark); }
/* A plan-gated link keeps its full-width hit area; the lock sits over its right edge. */
.nav__item { position: relative; display: flex; }
.nav__item > .nav__link { flex: 1; }
.aw .nav__lock {
  position: absolute; right: var(--s3); top: 50%; transform: translateY(-50%);
  display: flex; padding: .25rem; color: var(--rail-ink-2); border-radius: .375rem;
}
.aw .nav__lock:hover { color: var(--rail-ink); background: var(--rail-2); }
.aw .nav__lock .ico { width: .875rem; height: .875rem; }
/* Settings and platform administration sit at the foot, apart from daily work. */
.nav__group:not(.nav__group--foot) + .nav__group--foot {
  margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--rail-line);
}

/* Pinned to the foot of the rail, so Sign out is one click away however long
   the navigation grows. */
.account {
  position: sticky; bottom: 0; background: var(--rail);
  border-top: 1px solid var(--rail-line); padding: var(--s2) var(--s3);
  font-size: .8125rem; color: var(--rail-ink-2);
}
.account__summary {
  display: flex; align-items: center; gap: .65rem; min-height: 2.75rem;
  padding: .25rem .4rem; border-radius: .5rem; cursor: pointer; list-style: none;
}
.account__summary::-webkit-details-marker { display: none; }
.account__summary:hover, .account[open] .account__summary { background: var(--rail-2); }
.account__summary > .ico { color: var(--rail-ink-2); }
.account__avatar {
  width: 2rem; height: 2rem; flex: 0 0 auto; border-radius: 999px;
  display: grid; place-items: center; background: var(--rail-line); color: var(--rail-ink);
  font-weight: 700; font-size: .8125rem;
}
.account__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account__who { font-weight: 600; color: var(--rail-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__role { font-size: .75rem; color: var(--rail-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Opens upward, over the navigation, inside the rail. */
.account__links {
  position: absolute; left: var(--s3); right: var(--s3); bottom: calc(100% - var(--s1));
  list-style: none; margin: 0; padding: var(--s1);
  background: var(--rail-2); border: 1px solid var(--rail-line); border-radius: .625rem;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
.account__links li { margin: 0; }
.account__links a {
  display: flex; align-items: center; min-height: 2.25rem; padding: 0 var(--s3);
  border-radius: .4rem; color: var(--rail-ink) !important; font-size: .875rem; text-decoration: none;
}
.account__links a:hover { background: var(--rail); color: var(--mark) !important; }
.account__signout { border-top: 1px solid var(--rail-line); margin-top: var(--s1) !important; padding-top: var(--s1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { display: none; }

/* Full desktop width: the content column grows with the screen and only caps
   where a line of prose would become unreadable (prose sets its own measure). */
.content {
  flex: 1; width: 100%; max-width: 112rem;
  margin: 0; padding: var(--s6) clamp(1.5rem, 3vw, 3.5rem) var(--s7);
}

/* --- 4. Page header ------------------------------------------------------ */

.crumbs {
  font-family: var(--mono); font-size: .8125rem; color: var(--ink-3);
  margin-bottom: var(--s3); display: flex; flex-wrap: wrap; gap: .4rem;
}
.crumbs ol { list-style: none; margin: 0; padding: 0; display: contents; }
.crumbs li { display: flex; align-items: center; gap: .4rem; }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current="page"] { color: var(--ink); }

/* Two columns: the head's text, and its actions held to the right, wrapping
   inside their own column rather than dropping under the title. */
.page-head {
  display: grid; grid-template-columns: minmax(20rem, 1fr) minmax(0, max-content);
  gap: var(--s4) var(--s6); align-items: end;
  margin-bottom: var(--s6); padding-bottom: var(--s5);
  border-bottom: 2px solid var(--ink);
}
.page-head__text { min-width: 0; }
.page-head__actions { justify-content: flex-end; max-width: 30rem; }
/* Plan-usage badge: only shown to a capped (Free) org; turns red at the cap. */
.usage-badge {
  display: inline-flex; align-items: center; gap: .6rem;
  margin: var(--s3) 0 0; font-size: .8125rem; color: var(--ink-3);
}
.usage-badge__fig { font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-badge__track {
  width: 5rem; height: .375rem; border-radius: 999px; overflow: hidden;
  background: var(--line);
}
.usage-badge__fill { display: block; height: 100%; background: var(--ink-3); }
.usage-badge--full .usage-badge__fig { color: var(--danger-ink); font-weight: 600; }
.usage-badge--full .usage-badge__fill { background: var(--danger); }
.usage-badge__up {
  font-weight: 600; color: var(--danger-ink); text-decoration: underline;
}
/* A mono readout line: the facts a reader checks before trusting a figure. */
.readout {
  display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: var(--s3) 0 0;
  font-size: .875rem; color: var(--ink-3);
}
.readout b { color: var(--ink); font-weight: 600; }
.page-head__lede { color: var(--ink-2); font-size: 1rem; margin: var(--s3) 0 0; max-width: 64ch; }
.page-head__meta {
  color: var(--ink-3); font-size: .875rem; margin: var(--s3) 0 0;
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
}
.page-head__actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

.section { margin-top: var(--s7); }
.section__head {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  align-items: baseline; justify-content: space-between; margin-bottom: var(--s4);
}
.section__head h2 { font-size: 1.375rem; }
.section__note { color: var(--ink-2); font-size: .9375rem; margin: 0 0 var(--s3); max-width: 80ch; }

/* --- 5. Panels ----------------------------------------------------------- */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel + .panel { margin-top: var(--s4); }
.panel__head {
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: var(--s3);
  align-items: baseline; justify-content: space-between;
}
.aw .panel__title { font-size: 1.0625rem; font-weight: 700; }
.panel__body { padding: var(--s5); }
.panel__foot {
  padding: var(--s3) var(--s5); border-top: 1px solid var(--line);
  background: var(--surface-sunk);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center;
}

/* --- 6. Buttons and controls -------------------------------------------- */

.aw .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.375rem; padding: .45rem 1rem;
  border: 1.5px solid var(--ink); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .875rem; font-weight: 600; letter-spacing: .005em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.aw .btn:hover { background: var(--surface-alt); text-decoration: none; }
.aw .btn:active { transform: translateY(1px); }
.aw .btn--primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.aw .btn--primary:hover { background: var(--rail); border-color: var(--rail); color: var(--mark); }
.aw .btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.aw .btn--danger:hover { filter: brightness(.85); }
.aw .btn--ghost { background: transparent; border-color: transparent; color: var(--link); }
.aw .btn--ghost:hover { background: var(--surface-alt); }
.aw .btn--sm { min-height: 1.95rem; padding: .2rem .7rem; font-size: .8125rem; border-width: 1px; }
.aw .btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.aw .btn[disabled], .aw .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

/* A link that must post. Looks like a link, behaves like a button. */
.aw .linkish {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--link); font: inherit; font-size: inherit;
  cursor: pointer; text-decoration: none;
}
.aw .linkish:hover { text-decoration: underline; }
.aw .linkish--danger { color: var(--danger-ink); }

/* A flex container's min-content width is its widest child, so inside a
   `width: 1%` table cell a wrapping row of actions collapses to one item per
   line and trebles the row height. Keeping it on one line lets the column take
   its max-content width instead. */
.row-actions {
  display: inline-flex; gap: var(--s2); align-items: center;
  flex-wrap: nowrap; white-space: nowrap; font-size: .8125rem;
}
.row-actions > * { white-space: nowrap; }
.row-actions .sep { color: var(--line-strong); }
/* On a phone the actions sit outside a scrolling table (or in a full-width card), so a long
   link such as "Export every event as CSV" must wrap instead of widening the page. */
@media (max-width: 560px) {
  .row-actions { flex-wrap: wrap; white-space: normal; }
  .row-actions > * { white-space: normal; }
}

/* Two lines, for a row whose action set has outgrown one (the participant row:
   everyday actions first, the two privacy actions on a subordinate second).
   Each line stays `nowrap`; the cell drops `white-space: nowrap` or the group
   cannot break and the table grows wider than the page. */
.cell-actions { white-space: normal !important; }
.row-actions--stacked { display: block; }
.row-actions--stacked .row-actions__line {
  display: flex; gap: var(--s2); align-items: center; flex-wrap: nowrap;
}
.row-actions--stacked .row-actions__line + .row-actions__line { margin-top: .2rem; }
.row-actions--stacked .row-actions__line--minor { color: var(--ink-3); }

/* --- 7. Forms ------------------------------------------------------------ */

.aw input[type="text"], .aw input[type="email"], .aw input[type="password"],
.aw input[type="number"], .aw input[type="url"], .aw input[type="search"],
.aw input[type="tel"], .aw input[type="date"], .aw input[type="time"],
.aw input[type="datetime-local"], .aw input:not([type]),
.aw select, .aw textarea {
  width: 100%; max-width: 100%;
  min-height: 2.5rem; padding: .45rem .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--field); color: var(--ink);
  font: inherit; font-size: .9375rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.aw input:hover, .aw select:hover, .aw textarea:hover { border-color: var(--ink-3); }
/* Fields get the same solid ring as every other control; a tinted halo read as
   no focus at all against the paper ground. */
.aw input:focus-visible, .aw select:focus-visible, .aw textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
.aw input::placeholder, .aw textarea::placeholder { color: var(--ink-3); }
.aw input[disabled], .aw select[disabled], .aw textarea[disabled] {
  background: var(--surface-alt); color: var(--ink-3); cursor: not-allowed;
}
.aw textarea { min-height: 6rem; line-height: 1.5; resize: vertical; }
.aw select { padding-right: var(--s5); }
.aw input[type="file"] { font: inherit; font-size: .875rem; max-width: 100%; padding: .4rem 0; }
.aw input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: var(--s3);
  padding: .35rem .8rem; border: 1.5px solid var(--ink); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.aw input[type="checkbox"], .aw input[type="radio"] {
  width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--ink);
  flex: 0 0 auto; cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .aw input[type="checkbox"], .aw input[type="radio"] { accent-color: var(--mark); }
}

.form { max-width: 52rem; }
.form--wide { max-width: none; }

.fieldset { border: 0; margin: 0 0 var(--s6); padding: 0; }
.fieldset:last-of-type { margin-bottom: 0; }
.fieldset__legend {
  padding: 0; font-size: 1.0625rem; font-weight: 700; color: var(--ink);
  margin-bottom: var(--s1);
}
.fieldset__note { color: var(--ink-2); font-size: .875rem; margin: 0 0 var(--s3); max-width: 72ch; }
.fieldset__body {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: var(--s5);
}

.field { margin-bottom: var(--s5); }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block; font-size: .875rem; font-weight: 650;
  color: var(--ink); margin-bottom: .35rem;
}
.field__optional { font-weight: 400; color: var(--ink-3); }
.field__req { color: var(--danger-ink); font-weight: 400; }
.field__help { font-size: .8125rem; color: var(--ink-2); margin: .35rem 0 0; max-width: 72ch; }
.field__error { font-size: .8125rem; color: var(--danger-ink); margin: .35rem 0 0; font-weight: 600; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--danger); }
/* A checkbox reads as "control, then label". */
.field--check { display: flex; gap: var(--s2); align-items: flex-start; }
.field--check .field__label { margin-bottom: 0; font-weight: 500; }
.field--check .field__body { padding-top: .15rem; }
/* Django wraps a multi-input widget in a <fieldset>; its default border would
   sit around the list's own. */
.field__fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field__fieldset > .field__label { padding: 0; }
/* Checkbox / radio lists produced by CheckboxSelectMultiple. */
.field ul { list-style: none; margin: 0; padding: 0;
  max-height: 16rem; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s2); background: var(--surface-sunk); }
.field ul li { margin: 0; }
.field ul label {
  display: flex; gap: var(--s2); align-items: center;
  padding: .25rem var(--s2); font-size: .875rem; cursor: pointer; border-radius: var(--radius-sm);
}
.field ul label:hover { background: var(--surface-alt); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s5); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }

.form-actions {
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center;
  margin-top: var(--s6); padding-top: var(--s5); border-top: 2px solid var(--ink);
}
.form-actions--plain { border-top: 0; padding-top: 0; }

/* --- 8. Filter bar ------------------------------------------------------- */

.filters {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
}
.filters__row { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: flex-end; }
.filters__field { display: flex; flex-direction: column; gap: .3rem; min-width: 9rem; }
.filters__field--grow { flex: 1 1 14rem; }
.filters__field label { font-size: .75rem; font-weight: 700; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.filters__actions { display: flex; gap: var(--s2); align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--mark); color: var(--mark-ink);
  border-radius: var(--radius-sm); padding: .15rem .6rem; font-size: .8125rem; font-weight: 500;
}
.chip b { font-weight: 700; }

.result-bar {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  align-items: center; justify-content: space-between;
  margin: var(--s5) 0 var(--s3);
}
.result-bar__count { font-size: .9375rem; color: var(--ink-2); }
.result-bar__count b { color: var(--ink); font-weight: 750; }

/* --- 9. Tables ----------------------------------------------------------- */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  position: relative;
}
/* `position: relative` is load-bearing, not decoration. Without it the
   absolutely-positioned .visually-hidden labels inside the cells have no
   positioned ancestor, so their containing block is the viewport: they escape
   the scroll container and stretch the document to the table's full width,
   giving every wide table a horizontal page scrollbar. */
.table-scroll { overflow-x: auto; position: relative; }
/* Scroll edges: a shadow shows where more columns sit. The surface-coloured
   covers scroll with the content (local) and hide each shadow once its edge is
   reached; .table-wrap paints the surface, so the table itself stays clear. */
.table-scroll {
  --edge: color-mix(in srgb, var(--ink) 18%, transparent);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 2.5rem 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 2.5rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--edge), transparent) left / .875rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--edge), transparent) right / .875rem 100% no-repeat scroll;
}

.aw table.table { width: 100%; border-collapse: collapse; }
.aw table.table caption { text-align: left; padding: var(--s3) var(--s4); color: var(--ink-2); font-size: .875rem; }
.aw table.table th, .aw table.table td {
  padding: .65rem var(--s4); text-align: left; font-size: .9rem;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.aw table.table thead th {
  background: var(--surface); color: var(--ink-2);
  font-size: .75rem; font-weight: 700; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
  border-bottom: 2px solid var(--ink);
}
.aw table.table tbody tr:last-child td { border-bottom: 0; }
.aw table.table tbody tr { transition: background-color .12s ease; }
.aw table.table tbody tr:hover { background: var(--surface-sunk); }
.aw table.table td.num, .aw table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.aw table.table td.num { font-weight: 550; }
.aw table.table .nowrap { white-space: nowrap; }
.aw table.table .shrink { width: 1%; white-space: nowrap; }

.sortlink { display: inline-flex; align-items: center; gap: .25rem; color: var(--ink-2) !important; }
.sortlink:hover { color: var(--ink) !important; text-decoration: none !important; }
.sortlink__dir { font-size: .75rem; color: var(--ink); }
th[aria-sort] .sortlink { color: var(--ink) !important; font-weight: 700; }

.cell-name { font-weight: 650; color: var(--ink); }
a.cell-name { color: var(--ink); }
a.cell-name:hover { color: var(--link); }
.cell-sub { display: block; color: var(--ink-3); font-size: .8125rem; font-weight: 400; }
.ts { font-family: var(--mono); font-size: .86em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ts__zone { font-family: var(--mono); color: var(--ink-3); font-size: .75rem; font-weight: 400; }
/* In a column header the zone sits straight after the header's own word, and an
   IANA name is two words with a slash in it: "STARTED EUROPE/LONDON" reads as
   one phrase. Parentheses separate them. Not applied to the inline use beside a
   value, where "14:00 Europe/London" already reads correctly. */
.aw table.table th .ts__zone::before { content: "("; }
.aw table.table th .ts__zone::after { content: ")"; }
.muted { color: var(--ink-3); }

/* --- 10. Status pills ---------------------------------------------------- */
/* Outcomes wear their outcome colour; lifecycle states wear semantics; RUNNING
   wears the one mark, because it is the live state. */

.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .15rem .55rem; border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 650; white-space: nowrap; line-height: 1.35;
  background: var(--neutral-soft); color: var(--neutral);
}
.pill::before {
  content: ""; width: .45rem; height: .45rem; flex: 0 0 auto; background: currentColor;
}
.pill--neutral, .pill--draft, .pill--queued, .pill--skipped, .pill--cancelled,
.pill--scheduled, .pill--sending {
  background: var(--neutral-soft); color: var(--neutral);
}
.pill--info { background: var(--info-soft); color: var(--info); }
.pill--sent, .pill--accepted { background: var(--o-sent-soft); color: var(--o-sent-ink); }
.pill--opened    { background: var(--o-open-soft);   color: var(--o-open-ink); }
.pill--clicked   { background: var(--o-click-soft);  color: var(--o-click-ink); }
.pill--submitted { background: var(--o-submit-soft); color: var(--o-submit-ink); }
.pill--reported  { background: var(--o-report-soft); color: var(--o-report-ink); }
.pill--trained   { background: var(--o-train-soft);  color: var(--o-train-ink); }
.pill--accent, .pill--running { background: var(--mark); color: var(--mark-ink); }
/* Fine and finished statuses are ink with a check, never green: green belongs to the
   Reported outcome alone (The Fixed Outcome Rule). */
.pill--ok, .pill--completed {
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.pill--ok::before, .pill--completed::before {
  width: .28rem; height: .55rem; margin: -.15rem .1rem 0 .1rem; background: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.pill--warn, .pill--expired, .pill--retry, .pill--uncertain, .pill--retrying {
  background: var(--warn-soft); color: var(--warn);
}
.pill--danger, .pill--failed { background: var(--danger-soft); color: var(--danger-ink); }
.pill--running::before { border-radius: 50%; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }

/* --- 11. Metrics: the specimen ------------------------------------------ */
/* A metric's value is set in the variable face at display size. Where a page
   passes `--rate` (a percentage, 0–100) the weight axis carries it: 250 at
   nothing, 900 at forty per cent and above. The number beside it is always
   printed, so weight is a second reading, never the only one. `--c` names the
   outcome colour; its bar shows the same rate as length. */

/* Flex, not grid: a row always fills, so an odd count never leaves a hole.
   Cell rules are inset shadows, which tile without doubling. */
.metrics {
  display: flex; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.metric {
  --c: var(--ink);
  position: relative;
  padding: var(--s5) var(--s5) var(--s5);
  flex: 1 1 10rem;
  box-shadow: inset -1px 0 var(--line), inset 0 -1px var(--line);
  margin: 0 -1px -1px 0;
  display: flex; flex-direction: column;
}
.metric::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c);
}
.metric__value {
  display: block;
  font-size: clamp(2.5rem, 3.4vw, 3.75rem); line-height: 1;
  font-weight: 640; font-stretch: 80%;
  letter-spacing: -.035em; font-variation-settings: "opsz" 144;
  color: var(--ink); margin: var(--s3) 0 var(--s2);
}
.metric[style*="--rate"] .metric__value {
  font-weight: clamp(250, calc(250 + var(--rate) * 6.5), 900);
  letter-spacing: -.02em;
}
.metric__label { display: block; font-size: .9375rem; font-weight: 650; color: var(--ink); }
.metric__scope { display: block; order: 4; font-size: .8125rem; color: var(--ink-2); margin-top: .3rem; }
a.metric__label:hover { color: var(--link); }
.metric--lead { flex: 2 1 18rem; }
/* Counts that are usually zero: a readout row, not a wall of display figures. */
.metrics--compact .metric { padding: var(--s3) var(--s4); flex-basis: 8rem; }
.metrics--compact .metric::before { height: 3px; }
.metrics--compact .metric__value { font-size: 1.75rem; margin: var(--s1) 0 0; font-weight: 600; }
.metrics--compact .metric__label { font-size: .8125rem; }
.metrics--compact .metric__scope { font-size: .75rem; }
.metric--lead .metric__value { font-size: clamp(3.5rem, 5.5vw, 6rem); }
/* The bar under a rate: length = rate, colour = outcome. */
.metric[style*="--rate"]::after {
  content: ""; order: 3; display: block; height: .5rem; margin-top: var(--s1);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / calc(var(--rate) * 1%) 100% no-repeat,
    var(--surface-alt);
}

/* Outcome colour classes, for any element that takes `--c`. */
.o-sent   { --c: var(--o-sent); }
.o-open   { --c: var(--o-open); }
.o-click  { --c: var(--o-click); }
.o-submit { --c: var(--o-submit); }
.o-report { --c: var(--o-report); }
.o-train  { --c: var(--o-train); }
.o-live   { --c: var(--mark); }

/* A horizontal meter: label, bar, figure. Used for funnels and breakdowns. */
.meters { display: grid; gap: var(--s3); }
.meter {
  display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr 5.5rem;
  gap: var(--s4); align-items: center; font-size: .9375rem;
}
.meter__label { font-weight: 550; overflow-wrap: anywhere; }
.meter__track { height: 1.25rem; background: var(--surface-alt); position: relative; }
.meter__fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--rate) * 1%);
  background: var(--c, var(--ink)); min-width: 2px;
}
.meter__value {
  text-align: right; font-size: 1.25rem; letter-spacing: -.01em; font-stretch: 85%;
  font-weight: clamp(300, calc(300 + var(--rate) * 6), 900);
}
.meter__value small { display: block; font-family: var(--mono); font-size: .72rem; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }

.deflist { margin: 0; display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: .5rem var(--s5); }
.deflist dt { color: var(--ink-3); font-size: .875rem; font-weight: 600; font-stretch: 90%; padding-top: .05rem; }
.deflist dd { margin: 0; font-size: .9375rem; }

/* --- 12. Notices, empty states, details ---------------------------------- */
/* A notice is a tinted field with a square of its colour, not a side stripe. */

.notice {
  --n: var(--ink-3);
  position: relative;
  border-radius: var(--radius-sm);
  padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) + 1.1rem);
  margin-bottom: var(--s3);
  background: var(--surface); border: 1px solid var(--line); font-size: .9375rem;
}
.notice::before {
  content: ""; position: absolute; left: var(--s4); top: 1.32rem;
  width: .6rem; height: .6rem; background: var(--n);
}
.notice__title { font-weight: 700; margin-bottom: .2rem; }
.notice ul { margin: var(--s2) 0 0; padding-left: 1.1rem; }
.notice li { margin-bottom: .2rem; }
.notice--info    { --n: var(--info);    background: var(--info-soft);    border-color: transparent; }
.notice--ok      { --n: var(--ink);     background: var(--neutral-soft); border-color: transparent; }
/* Site-wide dunning strip: full width above the shell. Warn for past due, danger
   for suspended. */
.billing-strip { background: var(--warn-soft); border-bottom: 2px solid var(--warn); }
.billing-strip--suspended { background: var(--danger-soft); border-bottom-color: var(--danger); }
.billing-strip__in {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s5);
}
.billing-strip__msg { flex: 1; font-size: .9rem; color: var(--ink); }
.billing-strip form { margin: 0; }
.notice--warn    { --n: var(--warn);    background: var(--warn-soft);    border-color: transparent; }
.notice--danger  { --n: var(--danger);  background: var(--danger-soft);  border-color: transparent; }
.notice--neutral { --n: var(--ink-3);   background: var(--surface-sunk); }

.messages { margin-bottom: var(--s5); }

.empty {
  background: var(--surface); border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius); padding: var(--s7) var(--s5); text-align: center;
}
.empty__title { font-size: 1.25rem; font-weight: 750; letter-spacing: -.01em; margin-bottom: var(--s2); }
.empty__body { color: var(--ink-2); font-size: .9375rem; max-width: 56ch; margin: 0 auto var(--s4); }
.empty__actions { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }
td .empty { border: 0; background: none; padding: var(--s5); }

.aw details.explain {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: var(--s3);
}
.aw details.explain > summary {
  cursor: pointer; padding: var(--s3) var(--s4);
  font-size: .9375rem; font-weight: 650; color: var(--ink);
  list-style-position: inside;
}
.aw details.explain > summary:hover { color: var(--link); }
.aw details.explain[open] > summary { border-bottom: 1px solid var(--line); }
.aw details.explain .explain__body { padding: var(--s4); font-size: .9375rem; color: var(--ink-2); }
.aw details.explain .explain__body p { max-width: 80ch; }

/* --- 13. Checklist (empty-organization guidance) ------------------------- */

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; gap: var(--s4); align-items: flex-start;
  padding: var(--s4) 0; border-bottom: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: 0; }
.checklist__mark {
  flex: 0 0 auto; width: 2rem; height: 2rem;
  display: grid; place-items: center;
  font-size: 1rem; font-weight: 800; font-stretch: 80%;
  background: var(--surface-alt); color: var(--ink-2);
}
.checklist__mark--done { background: var(--mark); color: var(--mark-ink); }
.checklist__text { min-width: 0; }
/* Both are spans so they can live inside a span; they still need to stack. */
.checklist__title { display: block; font-weight: 700; font-size: 1rem; }
.checklist__title .pill { vertical-align: 1px; margin-left: var(--s1); }
.checklist__why { display: block; color: var(--ink-2); font-size: .875rem; margin-top: .2rem; max-width: 80ch; }
.checklist__why a { white-space: nowrap; }

/* --- 14. Step indicator (mirrors the real screens, nothing more) ---------- */
/* The current step carries the reserved mark and nothing else does. */

.steps { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: var(--s5); padding: 0; list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm); width: fit-content; max-width: 100%; overflow: hidden; }
.steps li {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; color: var(--ink-3);
  background: var(--surface); padding: .45rem .9rem;
  border-right: 1px solid var(--line);
}
.steps li:last-child { border-right: 0; }
.steps li b { font-weight: 650; }
.steps li[aria-current="step"] { background: var(--mark); color: var(--mark-ink); font-weight: 700; }
.steps li.is-done { color: var(--ink-2); }
.steps__n {
  width: 1.4rem; height: 1.4rem;
  background: var(--surface-alt); color: inherit;
  display: grid; place-items: center; font-size: .75rem; font-weight: 800;
}
.steps li[aria-current="step"] .steps__n { background: var(--mark-ink); color: var(--mark); }

/* --- 15. Charts and code editors ---------------------------------------- */

.chart { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s5); }
/* The chart is server-rendered SVG with a fixed height attribute and a wider
   viewBox, which letterboxes it into the centre at full width. Overriding the
   height lets it scale on its own aspect ratio instead. */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .grid text { fill: var(--ink-3); font-family: var(--mono); font-size: .75rem; }
.chart .series { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { stroke: none; opacity: .1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .s-click  { stroke: var(--o-click);  fill: var(--o-click); }
.chart .s-report { stroke: var(--o-report); fill: var(--o-report); }
.chart .series.s-click, .chart .series.s-report { fill: none; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s5); font-size: .875rem; color: var(--ink-2); margin-bottom: var(--s3); }
.legend span { display: inline-flex; align-items: center; gap: .5rem; font-weight: 550; }
.legend b { color: var(--ink); font-weight: 750; }
.legend i { width: 1rem; height: .3rem; display: inline-block; background: var(--c); }

/* The authored-content editors hold raw HTML. Django renders the widget, so the
   class cannot be set on it; the ids it generates are stable and are what these
   rules hang off. */
.aw #id_html_body, .aw #id_text_body, .aw #id_html {
  font-family: var(--mono); font-size: .8125rem; line-height: 1.6; min-height: 18rem;
  background: var(--surface-sunk); tab-size: 2;
}
.aw #id_text_body { min-height: 10rem; }
.aw textarea.code {
  font-family: var(--mono); font-size: .8125rem; line-height: 1.55; min-height: 20rem;
  background: var(--field); white-space: pre; overflow-wrap: normal;
}

.tokenbar { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; margin-bottom: var(--s2); }
.tokenbar__label { font-family: var(--mono); font-size: .75rem; color: var(--ink-2); margin-right: var(--s1); }
.aw .token-btn {
  font-family: var(--mono); font-size: .75rem; padding: .2rem .5rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.aw .token-btn:hover { background: var(--mark); color: var(--mark-ink); border-color: var(--mark); }

.aw pre.codes {
  background: var(--surface-sunk); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--s4); margin: 0 0 var(--s4);
  font-size: 1rem; line-height: 1.8; letter-spacing: .04em; overflow-x: auto;
}

/* --- 16. Selection bar (participant bulk actions) ----------------------- */

.selectbar {
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center;
  padding: var(--s3) var(--s4); border-top: 2px solid var(--ink);
  background: var(--surface-sunk);
}
.selectbar__count { font-size: .9375rem; color: var(--ink-2); }
.selectbar__count b { color: var(--ink); font-weight: 750; }

/* --- 17. Authentication pages ------------------------------------------- */
/* Sign-in is the rail at full height: ink ground, the specimen word, a plain
   form on a surface beside it. */

.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--rail);
}
.auth::before {
  content: "Phishmetry";
  align-self: end; padding: clamp(2rem, 5vw, 5rem);
  color: var(--rail-ink); font-family: var(--sans);
  font-size: clamp(4rem, 9vw, 9.5rem); line-height: .85; letter-spacing: -.04em;
  font-weight: 900; font-stretch: 70%; font-variation-settings: "opsz" 144;
  background:
    linear-gradient(90deg,
      var(--o-sent) 0 24%, transparent 24% 25.3%,
      var(--o-click) 25.3% 49.3%, transparent 49.3% 50.6%,
      var(--o-submit) 50.6% 74.6%, transparent 74.6% 75.9%,
      var(--o-report) 75.9% 100%) clamp(2rem, 5vw, 5rem) clamp(1.4rem, 3.4vw, 3.4rem) / min(32vw, 30rem) .6rem no-repeat;
}
.auth__card {
  align-self: stretch; display: flex; flex-direction: column; justify-content: center;
  width: 100%;
  background: var(--surface);
  padding: clamp(2rem, 6vw, 6rem) clamp(1.5rem, 5vw, 5rem);
}
.auth__card > * { max-width: 28rem; }
.aw .auth__title { font-size: 2rem; margin-bottom: var(--s2); }
.auth__lede { color: var(--ink-2); font-size: .9375rem; margin-bottom: var(--s5); }
.auth__card .btn { width: 100%; min-height: 2.75rem; font-size: .9375rem; }
.auth__foot { margin-top: var(--s5); font-size: .8125rem; color: var(--ink-3); }
.auth__qr {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s3); width: fit-content; margin: 0 0 var(--s3);
}
.auth__qr svg, .auth__qr img { display: block; max-width: 11rem; height: auto; }

/* --- 18. Report layout and print ---------------------------------------- */

.report { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s7) clamp(1.5rem, 4vw, 4rem); }
.report__masthead { border-bottom: 3px solid var(--ink); padding-bottom: var(--s4); margin-bottom: var(--s5); }
.report__org { font-family: var(--mono); font-size: .8125rem; color: var(--ink-3); }
.aw .report__title { font-size: 2.5rem; margin: var(--s2) 0; }
.report h2 {
  font-size: 1.25rem; margin: var(--s7) 0 var(--s3);
  padding-bottom: var(--s2); border-bottom: 1px solid var(--ink);
}
.report h2:first-of-type { margin-top: var(--s5); }
.report .table-wrap { box-shadow: none; }

@media print {
  .aw { background: #fff; color: #000; font-size: 10.5pt; }
  .noprint, .sidebar, .topbar, .messages, .page-head__actions, .skip-link { display: none !important; }
  /* Paper has no scrollbar: a table clipped on screen must print in full. */
  .table-wrap, .table-scroll { overflow: visible !important; }
  .content { max-width: none; padding: 0; margin: 0; }
  .shell { display: block; }
  .report { border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  .panel, .table-wrap, .metrics, .metric, .chart { box-shadow: none; border-color: #999; break-inside: avoid; }
  .aw table.table thead th { position: static; background: #fff; color: #000; }
  .aw table.table { break-inside: auto; }
  .aw table.table tr { break-inside: avoid; break-after: auto; }
  .aw table.table thead { display: table-header-group; }
  .pill { background: #fff !important; color: #000 !important; outline: 1px solid #999; }
  .report h2 { break-after: avoid; }
  .aw a { color: #000; text-decoration: none; }
  .metric, .metric--lead { flex: 1 1 0; }
  .metric__value, .metric--lead .metric__value { font-size: 22pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 16mm; }
}

/* --- 19. Responsive ------------------------------------------------------ */

@media (max-width: 1100px) {
  .content { padding: var(--s5) var(--s5) var(--s6); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar {
    position: static; width: auto; height: auto; flex: none;
    border-bottom: 1px solid var(--rail-line);
  }
  /* Collapsed by default on a phone, but only when the toggle is present —
     without JavaScript the nav simply stays open rather than disappearing. */
  .sidebar.is-collapsible .nav,
  .sidebar.is-collapsible .account { display: none; }
  .sidebar.is-collapsible.is-open .nav { display: flex; }
  .sidebar.is-collapsible.is-open .account { display: block; }
  .orgbar { padding: var(--s3) var(--s4); }
  .orgbar__slug { display: none; }
  .aw .orgbar [data-nav-toggle]:not([hidden]) {
    display: inline-flex; background: var(--rail-2); color: var(--rail-ink); border-color: var(--rail-line);
  }
  .topbar { display: block; }
  .content { padding: var(--s4) var(--s4) var(--s6); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-head__actions { justify-content: flex-start; max-width: none; }
  .aw h1 { font-size: 1.75rem; }
  .aw table.table th, .aw table.table td { padding: .55rem var(--s3); }
  .meter { grid-template-columns: minmax(6rem, 9rem) 1fr 4.5rem; gap: var(--s3); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth::before { font-size: 3.5rem; padding: var(--s6) var(--s4) var(--s5); align-self: start;
    background-position: var(--s4) var(--s4); background-size: 60% .5rem; }
}

@media (max-width: 560px) {
  .metric, .metric--lead { flex: 1 1 45%; padding: var(--s4); }
  .metric__value { font-size: 2.25rem; }
  .metric--lead .metric__value { font-size: 2.75rem; }
  .filters__field { min-width: 0; flex: 1 1 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .panel__body, .fieldset__body { padding: var(--s4); }
  .report { padding: var(--s4); }
  .meter { grid-template-columns: 1fr 4.5rem; }
  .meter__track { grid-column: 1 / -1; grid-row: 2; }
  /* Two columns of definitions do not fit a phone; stack them instead of
     letting the term column squeeze the value into an overflow. */
  .deflist { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .deflist dt { margin-top: var(--s3); }
  .deflist dt:first-child { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .aw *, .aw *::before, .aw *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------------------------------------------------------------
   Landing page builder
   A code editor and a preview stage. Both want more height than a form field
   and neither may introduce a second scrollbar, so the editor grows and the
   preview stage scrolls inside itself rather than nesting page scroll.
   --------------------------------------------------------------------------- */

/* `.aw #id_html` already styles the content editors by id -- the widget is
   Django's, so a class cannot be put on it -- and an id outranks any number of
   classes. The builder's editor therefore has to name the id too, or it keeps
   the 18rem height the smaller editors use. */
.aw .editor #id_html,
.aw .editor textarea.code,
.aw .editor textarea {
  min-height: 600px; line-height: 1.55; tab-size: 2;
  white-space: pre;        /* horizontal scrolling for long lines, not wrapping */
  overflow: auto; resize: vertical;
}
@media (max-width: 720px) {
  .aw .editor #id_html,
  .aw .editor textarea { min-height: 22rem; }
}

.editor__status {
  display: flex; gap: var(--s2); align-items: baseline;
  margin: var(--s2) 0 0; font-size: .75rem; color: var(--ink-3); font-family: var(--mono);
}

.preview { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.preview__bar {
  display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center;
  padding: var(--s3); border-bottom: 1px solid var(--line); background: var(--surface-sunk);
}
.preview__widths { margin-left: auto; display: flex; gap: var(--s2); }
/* The stage is the scroll container, so a tall preview never adds a second
   scrollbar to the page itself. */
.preview__stage {
  padding: var(--s3); background: var(--surface-alt);
  max-height: 46rem; overflow: auto; display: flex; justify-content: center;
}
.preview__stage iframe {
  width: 100%; max-width: 100%; height: 42rem;
  border: 1px solid var(--line); background: #fff;
}
/* An empty stage is a hint, not a large blank rectangle pretending to be a
   page that failed to load. */
.preview__stage--empty { min-height: 0; padding: var(--s5) var(--s3); }
.preview__hint { margin: 0; color: var(--ink-3); font-size: .8125rem; }

.section__actions { margin: var(--s3) 0 0; }

/* --- 20. Pagination ------------------------------------------------------ */
/* Server-side only. There is no "show all": the cap is the point, and the CSV
   export is the answer to wanting the whole set. Disabled controls are rendered
   rather than omitted, so the row does not shift under the pointer. The current
   page is marked with aria-current, the mark *and* a heavier weight; a disabled
   control carries aria-disabled. */

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); margin: var(--s4) 0 0; }
.pager__status { margin: 0; font-size: .875rem; color: var(--ink-2); }
.pager__status b { color: var(--ink); font-weight: 750; }
.pager__list { display: flex; flex-wrap: wrap; gap: var(--s1); list-style: none; margin: 0; padding: 0; }
.pager__link {
  display: inline-block; min-width: 2.375rem; text-align: center;
  padding: .35rem .6rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink) !important; text-decoration: none !important; font-size: .875rem; font-weight: 550;
}
a.pager__link:hover { background: var(--surface-alt); border-color: var(--ink); }
a.pager__link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pager__link--now { background: var(--mark); border-color: var(--ink); color: var(--mark-ink) !important; font-weight: 800; }
.pager__link--off { color: var(--ink-3) !important; background: var(--surface-alt); border-color: var(--line); }
.pager__note { flex-basis: 100%; margin: 0; font-size: .8125rem; color: var(--ink-3); }
.pager__note code { background: var(--surface-alt); padding: 0 .25rem; border-radius: var(--radius-sm); }
@media print { .pager { display: none; } }

/* --- 21. Preview provenance ---------------------------------------------- */
/* Which organization, which content and which saved revision a preview shows.
   Rendered outside the frame on purpose: a full-page landing preview runs the
   author's own script, and a caption the previewed document could rewrite is
   not a caption. See templates/admin_app/_c/preview_label.html. */

.preview__origin {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem;
  margin: 0 0 var(--s2); font-size: .8125rem; color: var(--ink-2);
}
/* One wrapping unit per piece, so a line never begins with the comma that
   belongs to the name on the line above. */
.preview__origin-item { display: inline-flex; align-items: baseline; gap: .35rem; }
.preview__origin-item + .preview__origin-item::before { content: "\00b7"; color: var(--line-strong); margin-right: .35rem; }
.preview__origin-key { font-size: .75rem; font-weight: 700; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.preview__origin strong { color: var(--ink); font-weight: 650; }
.preview__origin-sep { color: var(--line-strong); }
.preview__origin-note { margin: 0 0 var(--s3); font-size: .8125rem; color: var(--ink-3); }

/* The widest column in the delivery log and the participant timeline alike. An
   SMTP server's reply is an arbitrary string; letting this one wrap inside a
   bounded width keeps the whole row visible without a horizontal scroll.
   It is shown in full, never truncated: a containment refusal or a provider's
   rejection carries the remedy in its tail. The string is already capped at
   MAX_RESPONSE_CHARS (500) and scrubbed by `sending.mailer.scrub`. */
.response { max-width: 26rem; }
.response .mono { overflow-wrap: anywhere; }

/* --- 22. Composition bars and in-cell bars ------------------------------- */

.o-fail  { --c: var(--danger); }
.o-warn  { --c: var(--warn); }
.o-muted { --c: var(--line-strong); }
.o-dim   { --c: var(--line-strong); }
.o-pending { --c: var(--ink-2); }   /* a delivery state, so never an outcome hue */
.o-hatch i, .stack .o-hatch {
  background: repeating-linear-gradient(135deg, var(--c) 0 4px, transparent 4px 7px) !important;
}

/* A stacked bar: each child's flex-grow is its count, so no arithmetic happens
   in the template and the segments always sum to the whole. */
.stack {
  display: flex; height: 1.5rem; margin-top: var(--s4);
  background: var(--surface-alt); overflow: hidden; gap: 2px;
}
.stack > span { flex: 0 1 0; min-width: 0; background: var(--c); }
.stack > span[style*="flex-grow:0"] { display: none; }

/* A rate in a table cell, with its bar beneath: length = rate. */
.cellbar {
  display: inline-block; min-width: 7rem; text-align: right;
  padding-bottom: .3rem;
  background:
    linear-gradient(var(--c), var(--c)) 100% 100% / calc(var(--rate) * 1%) 4px no-repeat,
    linear-gradient(var(--surface-alt), var(--surface-alt)) 0 100% / 100% 4px no-repeat;
  font-weight: clamp(400, calc(400 + var(--rate) * 5), 900);
}

.chart .dot.s-click, .chart .dot.s-report { stroke: var(--surface); stroke-width: 2; }

/* --- 23. Row stacking, inline undo, selection-bar controls ---------------- */

/* A table marked .table--stack folds its secondary columns into the name cell on
   a phone, so the row's action stays on screen instead of behind a sideways
   scroll. */
.show-sm { display: none; }
@media (max-width: 900px) {
  .table--stack .hide-sm { display: none; }
  .table--stack .show-sm { display: block; }
}
label.cell-name { cursor: pointer; }

.inline-undo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.inline-undo span { flex: 1 1 auto; }

.selectbar__select { width: auto !important; min-height: 1.95rem !important; padding: .15rem 1.6rem .15rem .5rem !important; font-size: .8125rem !important; }

.messages:focus { outline: none; }

/* --- 24. Compose: a form beside a live specimen of what it produces ------- */

.compose {
  display: grid; grid-template-columns: minmax(0, 52rem) minmax(17rem, 22rem);
  gap: var(--s6); align-items: start;
}
.compose > .form { max-width: none; }
.journey {
  position: sticky; top: var(--s5);
  border: 1px solid var(--line); border-top: 2px solid var(--ink);
  background: var(--surface); padding: var(--s5);
}
.journey__title { font-size: 1.0625rem; font-weight: 700; margin: 0 0 var(--s4); }
.journey__steps { list-style: none; margin: 0; padding: 0; }
.journey__step { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: var(--s3); }
.journey__step + .journey__step { border-top: 1px solid var(--line); margin-top: var(--s4); padding-top: var(--s4); }
.journey__n {
  font-family: var(--mono); font-size: .8125rem; font-weight: 600;
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: var(--radius-sm);
}
.journey__kind {
  margin: 0; font-size: .75rem; font-weight: 700; font-stretch: 85%;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.journey__main { margin: .2rem 0 0; font-weight: 650; overflow-wrap: anywhere; }
.journey__sub { margin: .15rem 0 0; font-size: .8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.journey__sub:empty { display: none; }
.journey__link { display: inline-block; margin-top: var(--s2); font-size: .875rem; }
/* A 1280x800 page drawn at a quarter of its size: a thumbnail, not a viewer. */
.journey__thumb {
  position: relative; margin-top: var(--s2); width: 100%; aspect-ratio: 16 / 10;
  overflow: hidden; border: 1px solid var(--line); background: var(--field);
}
.journey__thumb iframe {
  position: absolute; inset: 0 auto auto 0; width: 400%; height: 400%; border: 0;
  transform: scale(.25); transform-origin: 0 0; pointer-events: none;
}
.journey__note { margin: var(--s4) 0 0; font-size: .8125rem; color: var(--ink-2); }
/* A setup panel's current step carries the reserved mark, as in .steps. */
.journey__step[aria-current="step"] .journey__n { background: var(--mark); color: var(--mark-ink); border-color: var(--mark); }
@media (max-width: 1100px) {
  .compose { grid-template-columns: minmax(0, 1fr); }
  .journey { position: static; }
}

/* The one section whose choice reverses a platform default. */
.fieldset--danger .fieldset__legend { display: flex; align-items: center; gap: var(--s2); }
.fieldset--danger .fieldset__legend::before {
  content: ""; width: .6rem; height: .6rem; background: var(--danger); flex: 0 0 auto;
}
.fieldset--danger .fieldset__body { border-color: var(--danger); border-top-width: 2px; }

/* RadioSelect renders <div><div><label><input> text</label></div>...</div>. */
.field__fieldset > div > div > label {
  display: flex; gap: var(--s2); align-items: center;
  padding: .3rem 0; font-size: .9375rem; cursor: pointer;
}
.aw [hidden] { display: none !important; }

/* --- 25. Row "More": one visible action, the rest one click away ---------- */

/* Opens in the row rather than as a popover: tables sit in a scroll box that
   would clip anything positioned outside it. Works without JavaScript. */
.row-more { display: inline-block; vertical-align: top; margin-left: var(--s2); text-align: left; }
.row-more > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
  min-height: 1.95rem; padding: .2rem .55rem; font-size: .8125rem; font-weight: 600;
  color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary::after {
  content: ""; width: .4rem; height: .4rem; margin-top: -.2rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease;
}
.row-more[open] > summary::after { transform: rotate(-135deg); margin-top: .15rem; }
.row-more > summary:hover { background: var(--surface-alt); }
.row-more__menu {
  display: flex; flex-direction: column; gap: .1rem; margin-top: var(--s1);
  padding: var(--s1) 0; border-top: 1px solid var(--line); font-size: .875rem;
}
.row-more__menu a, .row-more__menu button { padding: .25rem .1rem; text-align: left; }
.table .col-name { width: 26%; }
.table .cellbar { min-width: 5.5rem; }
/* A row's main action with its "More" beneath it, so the column stays narrow. */
.row-act { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); }
.row-act .row-more { margin-left: 0; }
.row-act .row-more__menu { min-width: 9rem; }

/* --- 26. Organization tabs and a tighter rail ----------------------------- */

.tabs {
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5);
  border-bottom: 1px solid var(--line); margin-bottom: var(--s5);
}
.aw .tabs__tab {
  padding: var(--s2) 0 calc(var(--s2) - 1px); margin-bottom: -1px;
  border-bottom: 3px solid transparent; color: var(--ink-2);
  font-size: .9375rem; font-weight: 550; text-decoration: none;
}
.aw .tabs__tab:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.aw .tabs__tab[aria-current="page"] { color: var(--ink); font-weight: 750; border-bottom-color: var(--ink); }

/* In dark mode the rail and the page are both near-black; a rule keeps the edge. */
.sidebar { border-right: 1px solid var(--rail-line); }
/* The irreversible item sits apart at the foot of a More menu. */
.row-more__last { border-top: 1px solid var(--line); margin-top: var(--s1); padding-top: var(--s2) !important; }

/* Campaign controls: routine and destructive acts at the foot of results, each
   with the consequence beside it. */
.controls__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s4); }
.controls__item { border: 1px solid var(--line); padding: var(--s4); }
.controls__item--danger { border-color: var(--danger); }
.controls__note { margin: var(--s2) 0 0; font-size: .875rem; color: var(--ink-2); max-width: 60ch; }

/* Prose stays readable at any width: about 75 characters a line. Zero
   specificity, so a component that sets its own measure keeps it. */
:where(.aw .content) :where(p, li, dd) { max-width: 60ch; }
.section__note, .field__help, .fieldset__note, .page-head__lede { max-width: 60ch; }

/* --- 27. One person across campaigns -------------------------------------- */
.person-sum { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 var(--s5); border: 1px solid var(--line); }
.person-sum > div { flex: 1 1 10rem; padding: var(--s4) var(--s5); border-top: 4px solid var(--c, var(--ink)); }
.person-sum > div + div { border-left: 1px solid var(--line); }
.person-sum dt { font-size: .75rem; font-weight: 700; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.person-sum dd { margin: .2rem 0 0; font-size: 2rem; font-weight: 700; font-stretch: 80%; line-height: 1; }
.person-sum__of { font-family: var(--mono); font-size: .8125rem; font-weight: 450; color: var(--ink-2); }

/* A page that holds several independent settings opens with their state. */
.status-row { list-style: none; margin: 0 0 var(--s6); padding: 0; display: flex; flex-wrap: wrap; border: 1px solid var(--line); }
.status-row li { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); flex: 1 1 auto; max-width: none; }
.status-row li + li { border-left: 1px solid var(--line); }
.status-row a { font-weight: 650; }

/* In-page sections of a long page: sticky, so any section is one click away. */
.jump {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5);
  margin: var(--s5) 0 0; padding: var(--s3) 0; background: var(--bg);
  border-bottom: 1px solid var(--line); font-size: .875rem; font-weight: 600;
}
.aw .jump a { color: var(--ink-2); }
.aw .jump a:hover { color: var(--ink); }
/* Anchored sections land below the sticky bar, not under it. */
html:has(.jump) { scroll-padding-block-start: 6rem; }
/* A metric label that links somewhere is still a label: ink, underlined on hover. */
.aw a.metric__label { color: var(--ink-2); text-decoration: none; }
.aw a.metric__label:hover { color: var(--ink); text-decoration: underline; }

/* --- 28. Readable help text; tables as labelled cards on a phone ---------- */

.field__help, .fieldset__note { font-size: .875rem; color: var(--ink-2); }
.cell-sub { font-size: .8125rem; color: var(--ink-2); }

@media (max-width: 900px) {
  .table--cards thead { display: none; }
  /* A sortable table keeps its sort: the sortable headings become a row of links. */
  .table--cards thead:has(.sortlink) { display: block; }
  .table--cards thead:has(.sortlink) tr {
    display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4);
    padding: var(--s2) var(--s4); border-bottom: 2px solid var(--ink);
  }
  .aw .table--cards thead th { display: none; }
  .aw .table--cards thead th:has(.sortlink) { display: block; position: static; padding: 0; border: 0; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { border-bottom: 1px solid var(--line); padding: var(--s3) 0; }
  .aw .table--cards td { border: 0; padding: .3rem var(--s4); text-align: left; white-space: normal; }
  .table--cards td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: .1rem;
    font-size: .75rem; font-weight: 700; font-stretch: 85%; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ink-2);
  }
  /* A blank header (the actions column) needs no label. */
  .table--cards td[data-label=""]::before, .table--cards td:not([data-label])::before { display: none; }
  .table--cards .cellbar { min-width: 0; width: 100%; text-align: left; }
  .table--cards .row-act { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .table-scroll:has(.table--cards) { overflow-x: visible; }
}
@media (max-width: 560px) {
  /* Touch targets: at least 44px on a phone. */
  .aw .row-more > summary, .aw .btn--sm { min-height: 2.75rem; }
  .row-more__menu a, .row-more__menu button { padding: .6rem .1rem !important; }
  .aw input[type="checkbox"], .aw input[type="radio"] { width: 1.5rem; height: 1.5rem; }
}
@media (max-width: 900px) {
  .aw .table--cards td, .aw .table--cards td.shrink { width: 100% !important; border-bottom: 0 !important; }
  .table--cards .row-act { gap: var(--s2); }
}
@media (max-width: 900px) {
  .aw .table--cards td, .aw .table--cards td * { text-align: left !important; }
  .table--cards td[data-label]::before { font-family: var(--sans); }
}
.aw .empty__body { margin-left: auto; margin-right: auto; }
.mail-frame { display: block; width: 100%; height: 75vh; border: 1px solid var(--line); background: #fff; }

/* --- 29. Split button: main action with its menu beside it ---------------- */

.row-act { flex-direction: row; align-items: stretch; gap: 0; justify-content: flex-end; flex-wrap: nowrap; }
.row-act > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.row-act > .btn + .row-more > summary { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.row-act .row-more { margin-left: 0; }
.row-act > .btn + .row-more > summary { min-height: 1.95rem; padding: .2rem .5rem; border: 1px solid var(--ink); border-left: 0; }
/* A lone menu (no main action beside it) keeps its own outline. */
.row-act > .row-more:first-child > summary { border-left: 1px solid var(--line-strong); }
.row-more > summary .row-more__word { margin-right: .1rem; }

/* With the script, the open menu floats beside its button instead of growing the row. */
.has-popmenus .row-more__menu {
  position: fixed; z-index: 40; margin: 0; padding: var(--s1) 0;
  background: var(--surface); border: 1px solid var(--line-strong); border-top: 2px solid var(--ink);
  box-shadow: 0 8px 24px rgb(12 13 16 / .14);
}
.has-popmenus .row-more__menu a, .has-popmenus .row-more__menu button {
  display: block; width: 100%; padding: .45rem var(--s4) !important; white-space: nowrap; text-align: left;
}
.has-popmenus .row-more__menu a:hover, .has-popmenus .row-more__menu button:hover { background: var(--surface-alt); text-decoration: none; }
.has-popmenus .row-more__menu form { margin: 0; }
.has-popmenus .row-more__last { margin-top: var(--s1); padding-top: .45rem !important; }
.filterbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin: 0 0 var(--s2); }
.aw .filterbar input { flex: 1 1 10rem; }
.aw .filterbar input[type="search"] { max-width: 18rem; min-height: 2.25rem; }
.filterbar__count { font-family: var(--mono); font-size: .8125rem; color: var(--ink-2); white-space: nowrap; }
@media (max-width: 560px) {
  .aw .row-act > .btn, .aw .row-act > .btn + .row-more > summary, .aw .row-more > summary { min-height: 2.75rem; }
}

/* The rail colour runs the full height of the page, not just the sticky
   viewport-tall sidebar: a long page (or a full-page capture) keeps its ink
   column to the very bottom. */
.shell { background: linear-gradient(to right, var(--rail) var(--nav-w), transparent var(--nav-w)); }
@media (max-width: 900px) { .shell { background: none; } }
@media print { .shell { background: none; } }


/* --- 30. One heading rhythm ------------------------------------------------ */
/* A heading that follows a block (panel, table, notice, form, metrics) gets the
   section gap; without it "Who receives this" sat flush under its panel. */
.aw :is(.panel, .table-wrap, .notice, form, .metrics, .form-actions, details.explain)
  + :is(h2, h3, .section__head, .section) { margin-top: var(--s6); }
.aw .panel + .panel, .aw .panel + form, .aw .notice + .panel { margin-top: var(--s5); }
/* (A minimum name width here pushed the most-used tables past their frame at
   1440px; names wrap by the column's own width instead.) */
.response { max-width: 18rem; }
.mail-frame:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* A wide log table lets its headings wrap rather than pushing past its box. */
.aw table.table.table--wraphead thead th { white-space: normal; }

.filterbar__none { font-size: .875rem; color: var(--warn); }

/* --- 32. Less on screen ----------------------------------------------------- */
.page-head__lede.is-clamped {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.aw .lede-toggle {
  background: none; border: 0; padding: 0; margin-top: var(--s1);
  color: var(--link); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.aw .lede-toggle:hover { text-decoration: underline; }
/* A fold: a form that is set up opens closed, showing only its summary. */
details.fold { border: 1px solid var(--line); background: var(--surface); }
details.fold > summary {
  cursor: pointer; padding: var(--s3) var(--s4); font-weight: 650; list-style: none;
  display: flex; align-items: center; gap: var(--s2);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: ""; width: .45rem; height: .45rem; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease;
}
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > :not(summary) { padding: 0 var(--s4) var(--s4); }

/* --- 33. Help ---------------------------------------------------------------- */
.help-flow { margin: 0; padding-left: 1.4rem; display: grid; gap: var(--s3); max-width: 70ch; }
.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); gap: 0; margin: 0;
  border: 1px solid var(--line); }
.glossary > div { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); scroll-margin-top: var(--s5); }
.glossary > div:target { background: var(--surface-sunk); outline: 2px solid var(--focus); outline-offset: -2px; }
.glossary dt { font-weight: 700; margin-bottom: var(--s1); }
.glossary dd { margin: 0; color: var(--ink-2); font-size: .9375rem; }
/* A domain word that links to its glossary entry. */
.aw a.term { color: inherit; text-decoration: underline dotted; text-underline-offset: .2em; }
.aw a.term:hover { color: var(--link); text-decoration-style: solid; }
/* Two plain actions sit joined, like the split button. */
.row-act > .btn + .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.audience-estimate { font-family: var(--mono); font-size: .8125rem; color: var(--ink-2); }

/* --- 34. Not colour alone; 44px on a phone --------------------------------- */
/* The report-rate line is dashed and its legend swatch matches, so the two
   series differ by shape as well as hue. */
.chart .series.s-report { stroke-dasharray: 7 5; }
.chart .legend .o-report i {
  background: repeating-linear-gradient(90deg, var(--c) 0 .35rem, transparent .35rem .55rem);
}
@media (max-width: 560px) {
  .aw .btn { min-height: 2.75rem; }
  .aw input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .aw select, .aw textarea { min-height: 2.75rem; font-size: 1rem; }
  /* A long label wraps on a phone rather than pushing the button past the edge. */
  .aw .form-actions .btn, .aw .page-head__actions .btn { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 560px) { .selectbar__select { min-height: 2.75rem !important; font-size: 1rem !important; } }
/* Dim the options, not the sentence explaining why they are dimmed. */
.is-ignored > * { opacity: .45; }
.is-ignored::after { content: "Everyone is selected, so these are ignored."; display: block; font-size: .8125rem; color: var(--ink-2); margin-top: var(--s1); }
.section__note.is-clamped {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.section__note + .lede-toggle { margin: calc(var(--s2) * -1) 0 var(--s3); display: block; }
.jump__select { display: none; }
@media (max-width: 560px) {
  .jump a { display: none; }
  .aw .jump__select { display: flex; gap: var(--s2); width: 100%; }
  .aw .jump__select select { flex: 1 1 auto; }
}
.copyurl { display: flex; flex-wrap: wrap; gap: var(--s2); }
.copyurl__input { flex: 1 1 14rem; min-width: 0; }
.aw .pager__size { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); background: none; border: 0; padding: 0; }
.aw .pager__size select { width: auto; min-height: 2rem; }
@media (max-width: 560px) { .aw .pager__size select { min-height: 2.75rem; } }

/* --- Plan usage meters (dashboard) -------------------------------------- */
.usage { margin-bottom: var(--s5); }
.usage__head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.usage__head .pill--plan { margin-right: auto; }
.usage__act { display: inline-flex; margin: 0; }
.pill--plan { background: var(--accent-soft); color: var(--accent-ink); }
.btn--sm { padding: .3rem .7rem; font-size: .8rem; }
.usage__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.meter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); }
.meter__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.meter__label { font-weight: 600; font-size: .9rem; }
.meter__fig { font-variant-numeric: tabular-nums; font-weight: 650; }
.meter__track { height: 6px; border-radius: 999px; background: var(--surface-sunk); margin: .55rem 0 .4rem; overflow: hidden; }
.meter__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter__foot { font-size: .8rem; }
.meter__limit { color: var(--danger); font-weight: 600; }
.meter--full { border-color: var(--danger); }
.meter--full .meter__fill { background: var(--danger); }
@media (max-width: 720px) { .usage__grid { grid-template-columns: repeat(2, 1fr); } }
