@import "tailwindcss";

/* ==========================================================================
   Manifest design system
   --------------------------------------------------------------------------
   Brand tokens, base type, and bespoke component styles for the worker
   portal. Ported from the Claude Design prototype (see
   `docs/01-architecture.md` "UI" and the design handoff in
   `manifest/project/README.md`). The previous slate-on-white Tailwind look
   has been replaced wholesale; Tailwind utilities are still available for
   one-off layout, but anything tied to the brand (toolbar, table, drawer)
   is hand-authored CSS so the tokens stay legible.

   Fonts are intentionally not preloaded. Strict CSP (font-src 'self', 'data:')
   forbids Bunny/Google CDN loads; the system-ui fallback stack reads close
   enough until we ship self-hosted Inter / JetBrains Mono in /public/fonts.
   ========================================================================== */

:root {
  /* Brand greens — primary accent across the app. */
  --green-950: #0B2A1F;
  --green-900: #143628;
  --green-800: #1F4A37;
  --green-700: #2A5E47;
  --green-500: #5C9A78;
  --green-300: #A6C9B5;
  --green-100: #DDE9E1;
  --green-50:  #F0F5F0;

  /* Creams — reserved for the label-preview stage. */
  --cream-100: #F7F2E7;
  --cream-200: #EDE6D5;
  --cream-300: #E1D8C2;

  /* Tans — accent emphasis. */
  --tan-700: #A87E45;
  --tan-600: #C09866;
  --tan-400: #D6B68B;

  /* Inks — slightly forest-tinted neutrals. */
  --ink-900: #131A14;
  --ink-700: #3A423C;
  --ink-500: #66706A;
  --ink-300: #ACB3AE;
  --ink-200: #D2D7D3;
  --ink-100: #E5E9E6;

  /* Surfaces. */
  --paper: #FAF6EE;
  --white: #FFFFFF;
  --page:  #F6F7F6;

  /* Semantic role mappings. */
  --bg: var(--page);
  --surface: var(--white);
  --surface-2: #F1F3F1;
  --surface-3: #E5E9E6;
  --ink-0: var(--ink-900);
  --ink-1: var(--ink-700);
  --ink-2: var(--ink-500);
  --ink-3: var(--ink-300);
  --line: var(--ink-100);
  --line-strong: var(--ink-200);
  --accent: var(--green-900);
  --accent-ink: #FFFFFF;
  --accent-soft: var(--green-100);
  --ok: var(--green-700);
  --warn: var(--tan-700);
  --err: #8C3A1F;
  --highlight: color-mix(in srgb, var(--green-700) 8%, transparent);

  /* Shadows — green-tinted, subtle. */
  --shadow-xs: 0 1px 0 rgba(20, 54, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(20, 54, 40, 0.06), 0 1px 1px rgba(20, 54, 40, 0.04);
  --shadow-md: 0 4px 12px -4px rgba(20, 54, 40, 0.08), 0 2px 4px rgba(20, 54, 40, 0.04);
  --shadow-lg: 0 24px 48px -16px rgba(20, 54, 40, 0.14), 0 8px 16px -8px rgba(20, 54, 40, 0.08);

  /* Radius. */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;

  /* Density (comfortable). */
  --row-h: 48px;

  /* Type. */
  --fs-display: clamp(26px, 2.8vw, 32px);
  --fs-h1: clamp(20px, 2vw, 24px);
  --fs-base: 14px;
  --fs-sm: 13px;
  --fs-xs: 12px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ==========================================================================
   Base
   ========================================================================== */
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss02"; }
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Tenant banner (super-admin acting-as)
   --------------------------------------------------------------------------
   Sits above the topnav. Tan/warn palette so it doesn't compete with
   green-accented action surfaces. Kept per Dan's constraint that the
   "Viewing as <tenant>" affordance has to remain visible.
   ========================================================================== */
.tenant-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--tan-400) 22%, var(--white));
  color: var(--ink-1);
  border-bottom: 1px solid color-mix(in srgb, var(--tan-700) 25%, transparent);
  font-size: 13px;
}
.tenant-banner strong { color: var(--ink-0); }
.tenant-banner .tb-exit {
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: 4px;
  color: var(--tan-700);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

/* ==========================================================================
   App shell + top nav
   ========================================================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-0);
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
}
.brand:hover { background: var(--surface-2); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.brand-mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
}

.nav-tabs {
  display: flex;
  align-items: stretch;
}
.nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .15s;
}
.nav-tab:hover { color: var(--ink-0); }
.nav-tab[aria-current="page"] {
  color: var(--ink-0);
  font-weight: 600;
}
.nav-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset: auto 14px -1px 14px;
  height: 2px;
  background: var(--accent);
}

/* Right side of the topbar — user chip + sign-out. */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}
.topbar-user .tu-email {
  font-weight: 500;
  color: var(--ink-1);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user .tu-signout {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.topbar-user .tu-signout:hover { background: var(--surface-2); color: var(--ink-0); }
/* Super-admin "Admin →" link inside .topbar-user. Mirrors
   .admin-back-link's muted-then-underline-on-hover style — the
   affordance is "I'm a super-admin, here's the way into /admin"
   without competing with the worker chrome's primary nav. Only
   rendered when Current.user.super_admin?; never visible to
   tenant members. */
.topbar-user .admin-forward-link {
  color: var(--tan-700);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-sm);
}
.topbar-user .admin-forward-link:hover {
  background: var(--surface-2);
  text-decoration: underline;
}

@media (max-width: 880px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .nav-tabs { overflow-x: auto; }
  .nav-tab { padding: 0 14px; }
  .topbar-user { display: none; }
}

/* ==========================================================================
   Nav search (embedded in topbar, drives /search)
   ========================================================================== */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px;
  min-width: 0;
}
.ns-form {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  width: 100%;
  max-width: 440px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-md);
  transition: border-color .12s, box-shadow .12s;
  margin: 0;
}
.ns-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.ns-form input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  color: var(--ink-0);
}
.ns-form input::placeholder { color: var(--ink-3); }
.ns-icon { width: 16px; height: 16px; color: var(--ink-2); display: inline-flex; flex-shrink: 0; }
.ns-icon svg { width: 100%; height: 100%; }
.ns-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  color: var(--ink-2);
  flex-shrink: 0;
  border-radius: var(--r-sm);
}

/* Search dropdown panel (mounted when not on /search). */
.ns-pop {
  position: absolute;
  top: calc(100% - 2px);
  right: 16px;
  width: 440px;
  max-width: calc(100vw - 32px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ns-pop[hidden] { display: none; }

@media (max-width: 720px) {
  .nav-search { padding: 8px 10px; }
  .ns-form { max-width: 280px; }
  .ns-kbd { display: none; }
  .ns-pop { right: 10px; width: calc(100vw - 20px); }
}

/* ==========================================================================
   Page container
   ========================================================================== */
.page {
  flex: 1;
  padding: 24px clamp(16px, 3vw, 40px);
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  font-size: var(--fs-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink-0);
}
.page-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 400;
}
.page-sub .sep { color: var(--ink-3); }
.page-empty {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}
.page-empty h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-0);
  margin: 0 0 6px;
}

/* Date-nav cluster (Today screen). */
.day-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.day-nav input[type="date"] {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--ink-0);
  border-radius: var(--r-md);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-0);
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
  border-radius: var(--r-md);
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-2);
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  border-color: var(--line);
  color: var(--ink-3);
  background: var(--surface);
  cursor: not-allowed;
}
.btn:disabled:hover { background: var(--surface); color: var(--ink-3); border-color: var(--line); }

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--green-800);
  border-color: var(--green-800);
}
.btn.primary:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  border-color: var(--line);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink-0); border-color: transparent; }

.btn.icon { width: 36px; padding: 0; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }

/* ==========================================================================
   Input
   ========================================================================== */
.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  outline: none;
  min-width: 0;
  border-radius: var(--r-md);
  color: var(--ink-0);
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--ink-3); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input.mono { font-family: var(--font-mono); }

/* ==========================================================================
   Toolbar + table (Today)
   ========================================================================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
}
.toolbar .spacer { flex: 1; }
.toolbar .toolbar-filter { min-width: 220px; }
.toolbar .toolbar-vendor { min-width: 160px; }

.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* The row grid. 7 tracks: checkbox · order # · invoice · customer · vendor · time · action.
   Order # and Invoice lead because they're the identifiers warehouse staff
   scan or look up by; name and vendor are context. */
.rows { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 36px minmax(180px, 220px) 150px 1fr 150px 70px 110px;
  gap: 14px;
  align-items: center;
  min-height: var(--row-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.row:last-child { border-bottom: 0; }
.row:hover:not(.row-head) { background: var(--surface-2); }
.row.is-selected { background: var(--highlight); }
.row.is-clickable { cursor: pointer; }
.row-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  min-height: 36px;
  height: 36px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.row-head .cell-action { justify-content: flex-end; }

.checkbox-cell { display: flex; align-items: center; justify-content: center; }

.cb {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink-2);
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 3px;
  transition: background .1s, border-color .1s;
}
.cb:hover { border-color: var(--ink-1); }
.cb:checked { background: var(--accent); border-color: var(--accent); }
.cb:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border: solid var(--accent-ink);
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg) translate(1px, -1px);
}

.cell-order {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-head .cell-order,
.row-head .cell-id,
.row-head .cell-contact,
.row-head .cell-vendor {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.cell-id {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-contact {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-vendor {
  font-size: 13px;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
.cell-action {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

@media (max-width: 880px) {
  .row {
    grid-template-columns: 32px 1fr auto;
    padding: 14px;
    row-gap: 4px;
    column-gap: 12px;
  }
  .row-head { display: none; }
  .row .checkbox-cell { grid-row: 1 / span 3; }
  .row .cell-order { grid-column: 2; font-size: 18px; }
  .row .cell-id { grid-column: 2; font-size: 12px; color: var(--ink-2); font-weight: 500; }
  .row .cell-contact { grid-column: 2; font-size: 13px; font-weight: 600; color: var(--ink-1); }
  .row .cell-vendor { grid-column: 2; font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
  .row .cell-time { display: none; }
  .row .cell-action { grid-column: 3; grid-row: 1 / span 3; }
}

.rows-overflow {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  text-align: center;
}

/* ==========================================================================
   Tag (vendor pill, "Ready" badge)
   ========================================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.tag .tag-dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.tag.ok { color: var(--ok); }
.tag.warn { color: var(--warn); }

/* ==========================================================================
   Pack station
   ========================================================================== */
.pack-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.scan-frame {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--shadow-sm);
}
.pk-input {
  width: 100%;
  height: 72px;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  outline: 0;
  color: var(--ink-0);
  padding: 8px 0;
}
.pk-input::placeholder { color: var(--ink-3); }

.pk-hint {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}
.pk-hint .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}

.pk-matches {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.pk-matches-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 8px;
}
.pk-matches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pk-match {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  font: inherit;
  width: 100%;
}
.pk-match:hover { background: var(--surface-2); }
.pk-match.is-top {
  border-color: var(--accent);
  background: var(--highlight);
}
.pk-match-idx {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}
.pk-match-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-0);
}
.pk-match-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
.pk-match-enter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

.pk-section-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 12px;
}

.recent-list {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}
.recent-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row .rr-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
.recent-row .rr-name { font-weight: 500; color: var(--ink-0); }
.recent-row .rr-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.recent-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

/* ==========================================================================
   Search screen
   ========================================================================== */
.search-stage {
  max-width: 980px;
  margin: 0 auto;
}
.search-shell {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  box-shadow: var(--shadow-sm);
  margin: 0;
}
.search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.search-shell .search-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--ink-2);
  display: inline-flex;
}
.search-shell .search-icon svg { width: 100%; height: 100%; }
.search-shell input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  padding: 18px 0;
  font: inherit;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-0);
}

.search-recents {
  margin-top: 24px;
}
.search-recents-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 8px;
}
.search-recents-list {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
}
.search-recents-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.search-recents-row:last-child { border-bottom: 0; }
.search-recents-row:hover { background: var(--surface-2); }
.search-recents-row .rr-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.search-recents-row .rr-q {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-0);
}

.search-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.sr-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  padding: 14px 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
}
.sr-row:last-child { border-bottom: 0; }
.sr-row:hover { background: var(--surface-2); }
.sr-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-0);
}
.sr-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}
.sr-row mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink-0);
  padding: 0 2px;
  border-radius: 2px;
}

.search-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.search-empty h3 {
  font-size: 16px;
  color: var(--ink-1);
  margin: 0 0 6px;
  font-weight: 600;
}

/* ==========================================================================
   Label drawer
   ========================================================================== */
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.drawer-root[hidden] { display: none; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 42, 31, 0.32);
  border: 0;
  padding: 0;
  cursor: pointer;
}
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(920px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto 1fr;
}
.drawer-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dh-row { display: flex; align-items: center; gap: 12px; }
.dh-spacer { flex: 1; }
.vendor-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  background: var(--green-50);
  color: var(--green-900);
  border: 1px solid color-mix(in srgb, var(--green-700) 18%, transparent);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dh-invoice {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-0);
}
.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-1);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  padding: 0;
}
.drawer-close:hover { background: var(--surface-2); color: var(--ink-0); }
.dh-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-2);
}
.dh-sub .sep { color: var(--ink-3); }
.dh-customer { font-weight: 600; color: var(--ink-1); }
.dh-sub .mono { color: var(--ink-1); font-weight: 500; }
.dh-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.dh-rowid {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.drawer-body {
  overflow: hidden;
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(360px, 1fr);
  min-height: 0;
}
.drawer-left {
  border-right: 1px solid var(--line);
  overflow: auto;
  background: var(--surface-2);
}
.drawer-right {
  overflow: auto;
  background: var(--surface);
}
.ds-block {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.ds-block:last-child { border-bottom: 0; }
.ds-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.ds-foot-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}
.ds-label-wrap {
  background: var(--cream-100);
  border: 1px solid var(--cream-200);
  border-radius: var(--r-md);
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}
.label-frame {
  width: 100%;
  max-width: 320px;
  /* Mirrors the printed 75 × 100 mm thermal label so the preview's
     proportions match what comes out of the printer. */
  aspect-ratio: 75 / 100;
  background: var(--white);
  border: 1px solid #1A1A1A;
  padding: 16px;
  box-shadow: 0 6px 18px -8px rgba(20, 54, 40, 0.18);
  display: flex;
  flex-direction: column;
}

@media (max-width: 720px) {
  .drawer { width: 100vw; }
  .drawer-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .drawer-left, .drawer-right { overflow: visible; }
  .label-frame { max-width: 260px; }
}

/* On-label type — Helvetica-y to mimic the thermal print. */
.lbl {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #000;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.lbl-section { display: flex; flex-direction: column; gap: 1px; }
.lbl-strong { font-weight: 700; }
.lbl-line { font-size: 12px; }
.lbl-line span { font-weight: 700; }
.lbl-kv { border-collapse: collapse; }
.lbl-kv td {
  padding: 1px 0;
  font-size: 11px;
  vertical-align: top;
}
.lbl-kv td:first-child {
  padding-right: 6px;
  white-space: nowrap;
}
.lbl-spacer { flex: 1; }
.lbl-foot {
  margin-top: auto;
  font-size: 12px;
}

/* Drawer inspector key/value table. */
.dt {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
}
.dt-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.4fr) 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.dt-row:last-child { border-bottom: 0; }
.dt-k {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
}
.dt-v {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-0);
  word-break: break-word;
  font-family: var(--font-mono);
}

/* The hidden iframe the print controller stages the presigned PDF in
   before calling window.print(). Off-screen, zero-size, no border — the
   browser still loads and prints, just with no visible chrome.
   This used to be set via inline `style=""` from JS, which strict CSP
   denies; using a class avoids that. */
.print-iframe {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0;
}

/* Screen-reader / off-screen utility — for the Pack station's hidden
   fast-print button. We can't use display:none because click() on a
   display:none button is OK in modern browsers but historically
   inconsistent; clipping it preserves the click affordance for the
   Stimulus controller while keeping it out of the visual flow and the
   tab order. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Sign-in / passwords (auth surfaces stay simple — match the page palette
   but don't pull in the full topnav)
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.auth-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: var(--ink-0);
}
.auth-card label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  margin: 12px 0 4px;
}
.auth-card .form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.auth-card .form-link {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: underline;
}
.auth-flash {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  background: color-mix(in srgb, var(--err) 8%, transparent);
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 24%, transparent);
}

/* ==========================================================================
   Admin shell (M7.1+)
   --------------------------------------------------------------------------
   Stripped-down chrome for /admin/* pages. Reuses the brand tokens from the
   worker portal so the platform feels coherent, but drops the worker topnav
   (Today / Pack station tabs, embedded search, drawer mount) in favor of an
   admin-specific nav. The admin tabs render inline with the brand mark; new
   tabs land here as M7.2 (users), M7.4 (audit), M7.6 (email preview), and
   M8 (manifests) ship.
   ========================================================================== */
.admin-shell {
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink-0);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.admin-shell-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-shell-wordmark {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-0);
}
.admin-shell-wordmark-emphasis {
  color: var(--tan-700);
  font-weight: 500;
  margin-left: 2px;
}

.admin-shell-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.admin-nav-tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--ink-1);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.admin-nav-tab:hover { background: var(--surface-2); color: var(--ink-0); }
.admin-nav-tab[aria-current="page"] {
  background: var(--surface-2);
  color: var(--ink-0);
}

.admin-shell-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-back-link {
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
}
.admin-back-link:hover { color: var(--ink-0); text-decoration: underline; }

.admin-flash {
  max-width: 1600px;
  width: 100%;
  margin: 12px auto 0;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  box-sizing: border-box;
}
.admin-flash-notice {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--ink-0);
}
.admin-flash-alert {
  background: color-mix(in srgb, var(--err) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 24%, transparent);
  color: var(--err);
}

.admin-main {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px);
  box-sizing: border-box;
}

.admin-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.admin-page-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--ink-0);
}
.admin-page-sub {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}
.admin-page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Inline button-to form so two buttons can sit on one row. */
.inline-form { display: inline; margin: 0; }

.btn-view-as { /* same dimensions as .btn; lets specs target the affordance */ }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-0);
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table .admin-table-num { text-align: right; }
.admin-table .admin-table-actions {
  text-align: right;
  white-space: nowrap;
}
.admin-table .admin-table-actions .btn,
.admin-table .admin-table-actions .inline-form { margin-left: 6px; }
.admin-row-name {
  color: var(--ink-0);
  text-decoration: none;
  font-weight: 500;
}
.admin-row-name:hover { text-decoration: underline; }

.admin-empty-state {
  margin-top: 24px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 13px;
}

.admin-detail-list {
  display: grid;
  grid-template-columns: minmax(160px, max-content) 1fr;
  gap: 8px 24px;
  margin: 0 0 32px;
  font-size: 14px;
}
.admin-detail-list dt {
  color: var(--ink-2);
  font-weight: 500;
}
.admin-detail-list dd { margin: 0; color: var(--ink-0); }

.admin-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--ink-0);
}
.admin-recent-audits {
  margin-bottom: 32px;
}
.admin-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.admin-audit-list li {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.admin-audit-list li:last-child { border-bottom: 0; }
.admin-audit-time { color: var(--ink-2); }
.admin-audit-action { color: var(--ink-0); font-weight: 500; }
.admin-audit-actor { color: var(--ink-2); justify-self: end; }

.admin-page-foot { margin-top: 24px; }

/* Admin form — generic enough to share across future admin CRUDs. */
.admin-form {
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 24px;
}
.admin-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.admin-form .form-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-0);
}
.admin-form .form-row input[type="text"],
.admin-form .form-row input[type="number"],
.admin-form .form-row input[type="email"] {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  border-radius: var(--r-md);
  color: var(--ink-0);
}
.admin-form .form-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.admin-form .form-hint {
  color: var(--ink-2);
  font-size: 12px;
}
.admin-form .form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}
.admin-form .form-errors {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--err) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 24%, transparent);
  color: var(--err);
  font-size: 13px;
}
.admin-form .form-errors-title {
  margin: 0 0 6px;
  font-weight: 500;
}
.admin-form .form-errors ul {
  margin: 0;
  padding-left: 20px;
}

/* ==========================================================================
   Admin shell — user-management additions (M7.2)
   --------------------------------------------------------------------------
   Pills + chips for the users list / detail page, checklist fieldset for
   tenant-membership multi-select, and the toggle row for the super_admin
   checkbox. All reuse the existing brand tokens (surface, line, accent,
   etc.) defined at the top of this file.
   ========================================================================== */
.admin-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink-1);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-pill-super {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

/* Manifest status pills (M8.1).
   open    — muted (default admin-pill colors are already gray; no override).
   sealed  — tan/warn palette: "in a special state, not the default flow."
             Mirrors .tenant-banner's "you are in a special mode" cue.
   emailed — accent palette: "delivered, the happy terminal state."
*/
.admin-pill-status-sealed {
  background: color-mix(in srgb, var(--tan-400) 22%, var(--white));
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--tan-700) 28%, transparent);
}
.admin-pill-status-emailed {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

/* PDF status pills (M8.1, used on the manifest show page line list).
   pending — muted (default).
   ready   — ok palette (green).
   failed  — err palette (red).
*/
.admin-pill-pdf-ready {
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 24%, transparent);
}
.admin-pill-pdf-failed {
  background: color-mix(in srgb, var(--err) 8%, var(--surface));
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 24%, transparent);
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin: 0 4px 4px 0;
  background: var(--surface-2);
  color: var(--ink-0);
  border-radius: 4px;
  font-size: 12px;
}
.admin-chip-link {
  color: var(--ink-0);
  text-decoration: none;
  font-weight: 500;
}
.admin-chip-link:hover { text-decoration: underline; }
.admin-muted { color: var(--ink-2); }

.admin-checklist {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: var(--surface);
}
.admin-checklist legend {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-0);
  padding: 0 6px;
  margin-left: -6px;
}
.admin-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink-0);
  cursor: pointer;
}
.admin-checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.admin-form-row-toggle {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.admin-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-0);
  cursor: pointer;
}
.admin-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.admin-form .form-row input[type="email"]:disabled {
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: not-allowed;
}

/* ==========================================================================
   Admin shell — audit log additions (M7.4)
   --------------------------------------------------------------------------
   Filter bar (5-column grid + actions), per-row collapsed payload
   disclosure, and the pagy_nav link cluster. Reuses the brand tokens.
   ========================================================================== */
.admin-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.admin-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.admin-filter-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.admin-filter-field select,
.admin-filter-field input[type="date"] {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 13px;
  color: var(--ink-0);
  min-width: 0;
}
.admin-filter-field select:focus,
.admin-filter-field input[type="date"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.admin-filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}

.admin-audit-table td.admin-audit-time {
  white-space: nowrap;
  color: var(--ink-1);
}
.admin-audit-table td.admin-audit-action {
  color: var(--ink-0);
  font-weight: 500;
}
.admin-audit-table .admin-payload-cell {
  max-width: 480px;
}

.admin-payload-details {
  display: inline-block;
}
.admin-payload-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-2);
  user-select: none;
}
.admin-payload-details summary:hover { color: var(--ink-0); }
.admin-payload-details[open] summary {
  margin-bottom: 6px;
  color: var(--ink-0);
}
.admin-payload-json {
  margin: 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-0);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
}

/* pagy_nav defaults — keep them quiet and tabular. The default markup
   is a flat sequence of <a> / <span> elements; we just style them as
   clickable chips. */
.admin-pagy {
  margin-top: 16px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.admin-pagy a,
.admin-pagy span.page {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink-1);
  text-decoration: none;
  font-size: 12px;
  background: var(--surface);
}
.admin-pagy a:hover { background: var(--surface-2); color: var(--ink-0); }
.admin-pagy span.current,
.admin-pagy .active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.admin-pagy span.disabled,
.admin-pagy .gap {
  color: var(--ink-3);
  background: transparent;
  border-color: transparent;
}
.admin-pagy-info {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

/* ==========================================================================
   Admin shell — email preview (M7.6)
   --------------------------------------------------------------------------
   The iframe carries the mailer's HTML body, which ships its own
   `<head>` / `<body>` / inline styles. We only style the *frame*, not
   the contents. Height is generous so most preview emails render
   without scroll-in-scroll; users can resize their browser window
   for taller ones.
   ========================================================================== */
.admin-email-preview-meta {
  margin: 0 0 12px;
}
.admin-email-preview-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--tan-400) 22%, var(--white));
  border: 1px solid color-mix(in srgb, var(--tan-700) 25%, transparent);
  border-radius: var(--r-md);
  color: var(--ink-1);
  font-size: 13px;
}
.admin-email-preview-notice strong {
  color: var(--ink-0);
}
.admin-email-preview-notice code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: color-mix(in srgb, var(--tan-700) 10%, transparent);
  padding: 1px 4px;
  border-radius: 3px;
}
.admin-email-preview-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--white);
}
