/* ── Top Companies · modern data-tool theme ─────────────────────────────
   Cool neutral surfaces, one emerald accent, semantic status set, dark mode.
   Token-driven: components read tokens only, so both themes stay in sync. */

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e6e9ee;
  --line-strong: #d4d9e0;
  --ink: #14181c;
  --ink-2: #3d454e;
  --muted: #6a7480;
  /* sidebar rail — dark in both themes */
  --rail: #0e1319;
  --rail-2: #171d26;
  --rail-ink: #c6cdd6;
  --rail-muted: #7c8794;
  /* accent */
  --accent: #0a936b;
  --accent-strong: #077a58;
  --accent-soft: #e6f6f0;
  --accent-ink: #05513c;
  /* semantic — independent of accent */
  --ok: #16a34a; --ok-soft: #e7f6ec;
  --warn: #b9760a; --warn-soft: #fbf1de;
  --red: #d64545; --red-soft: #fbe9e9;
  --info: #2f6feb; --info-soft: #e8f0fe;

  --radius: 11px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(18,22,28,.05), 0 1px 3px rgba(18,22,28,.05);
  --shadow: 0 1px 2px rgba(18,22,28,.05), 0 14px 32px -18px rgba(18,22,28,.26);
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: var(--font-body);
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  color-scheme: light;
}

/* dark tokens — applied by OS preference, and forced by the toggle below */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d11; --card: #12161c; --surface-2: #161b22;
    --line: #242b34; --line-strong: #313a45;
    --ink: #e9ecf0; --ink-2: #b7bfc9; --muted: #838d9a;
    --rail: #06090c; --rail-2: #10151b;
    --accent: #14b487; --accent-strong: #0f9670; --accent-soft: #0e2a20; --accent-ink: #82ecc7;
    --ok: #3cbf6b; --ok-soft: #12271a; --warn: #d99a2b; --warn-soft: #2a2110;
    --red: #e56767; --red-soft: #2c1717; --info: #5f90ef; --info-soft: #13223c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow: 0 16px 40px -20px rgba(0,0,0,.72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0d11; --card: #12161c; --surface-2: #161b22;
  --line: #242b34; --line-strong: #313a45;
  --ink: #e9ecf0; --ink-2: #b7bfc9; --muted: #838d9a;
  --rail: #06090c; --rail-2: #10151b;
  --accent: #14b487; --accent-strong: #0f9670; --accent-soft: #0e2a20; --accent-ink: #82ecc7;
  --ok: #3cbf6b; --ok-soft: #12271a; --warn: #d99a2b; --warn-soft: #2a2110;
  --red: #e56767; --red-soft: #2c1717; --info: #5f90ef; --info-soft: #13223c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 16px 40px -20px rgba(0,0,0,.72);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

/* the browser hides [hidden] with display:none, which any author rule setting
   display beats — .check is inline-flex, so a hidden checkbox stayed on screen
   while JS believed it was gone. Say it once, here, rather than per component. */
[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 650; letter-spacing: -.012em; margin: 0; }

.tnum, .stat .num, .facts dd, td.num { font-variant-numeric: tabular-nums; }

/* ── shell ─────────────────────────────────────────────────────────── */

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

.sidebar {
  width: 236px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  /* the nav can be taller than the viewport — scroll it inside the rail so the
     gradient background always covers the whole nav area */
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  color: var(--rail-ink);
  background: linear-gradient(180deg, var(--rail-2), var(--rail));
  padding: 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
  padding: 6px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand:hover { text-decoration: none; }
.brand em { color: var(--accent); font-style: normal; }
.brand svg { width: 24px; height: 24px; color: var(--accent); }

.industry-switch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 6px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.industry-switch label {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--rail-muted);
  padding-left: 2px;
}
.industry-switch select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .05);
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%237c8794' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.industry-switch select:hover { border-color: rgba(255, 255, 255, .28); }
.industry-switch select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.industry-switch option { color: #1a1a1a; }

.sidebar nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }

.nav-label {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--rail-muted);
  margin: 15px 10px 6px;
}

.sidebar nav a {
  color: var(--rail-ink);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .14s, color .14s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar nav a.active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: #fff;
}

.logout { color: var(--rail-muted); padding: 12px 10px 4px; font-size: 12.5px; margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, .08); }
.logout:hover { color: #fff; text-decoration: none; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px; margin: 8px 4px 2px;
  padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.11);
  background: transparent; color: var(--rail-muted); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,.05); }
.theme-toggle svg { width: 15px; height: 15px; }

.main { flex: 1; padding: 30px 40px 60px; max-width: 1180px; }

/* ── page header ───────────────────────────────────────────────────── */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); margin: 5px 0 0; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── cards ─────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* minmax(0, …) rather than a bare fr: a grid track's default minimum is its
   content, so one long unbreakable value would otherwise widen the column
   and push the next one off the page */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px; align-items: start; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── stats ─────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-size: 28px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.alert .num { color: var(--accent); }
/* a stat that links through to its queue. Blockified anyway as a grid child;
   the declarations are here to drop the anchor's colour and underline. */
.publish-flags { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.publish-flags label { display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 550; }
.publish-flags .help { flex-basis: 100%; margin: 0; }
a.stat { display: block; color: inherit; }
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow);
  text-decoration: none; }

/* ── reveal ────────────────────────────────────────────────────────── */

@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: fadeUp .38s ease backwards; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
@media (prefers-reduced-motion: reduce) { .stagger > * { animation: none; } }

/* ── buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 13.5px var(--font-body);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-gold:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 550; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-danger { background: transparent; border-color: transparent; color: var(--red); font-weight: 550; }
.btn-danger:hover { background: var(--red-soft); }
/* a toggle that is off and wants to be noticed — the unset half of a pair like
   Ready for Mag. Filled rather than ghost, so an unset row reads as unfinished
   at a glance instead of as an empty cell. Not btn-danger: nothing here is
   destructive, it is simply not done yet. */
.btn-pending { background: var(--red-soft); border-color: transparent; color: var(--red); font-weight: 550; }
.btn-pending:hover { background: var(--red-soft); border-color: var(--red); }

/* ── tables ────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td .cell-main { font-weight: 600; }
td .cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.empty { text-align: center; color: var(--muted); padding: 34px 12px !important; font-size: 14px; }

.cell-select {
  padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 12.5px;
  max-width: 150px; cursor: pointer;
}
.cell-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ── badges & pills ────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-pet-food { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge-poultry { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-feed { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge-broiler { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-turkey { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-stale { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge-open { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-closed { background: var(--surface-2); color: var(--muted); }
.badge-cyc-awaiting { background: var(--surface-2); color: var(--muted); }
.badge-cyc-updated { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-cyc-approved { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-cyc-needs_work { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
/* what is waiting on a cycle row. These are links, so the anchor underline is
   dropped — on a pill it reads as a broken shape rather than as a link. */
.badge-stack { display: flex; flex-wrap: wrap; gap: 4px; }
a.badge:hover { text-decoration: none; border-color: currentColor; }
.badge-queue-survey { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-queue-ai { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  transition: all .14s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── toolbar (search + filters) ────────────────────────────────────── */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
/* a select that narrows the list, sitting in a row of pills — so it takes the
   pill's shape and weight rather than the browser's default control, and turns
   accent when it is actually filtering something */
.toolbar select {
  font: 550 12.5px var(--font-body);
  color: var(--muted);
  padding: 6px 30px 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838d9a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center / 13px;
  appearance: none;
  cursor: pointer;
  transition: all .14s;
  max-width: 220px;
}
.toolbar select:hover { border-color: var(--accent); color: var(--accent); }
.toolbar select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* the chevron is baked into the background, so the active state needs its own
   white one — the grey disappears against the accent */
.toolbar select.on {
  background-color: var(--accent); border-color: var(--accent); color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.toolbar select.on:hover { color: #fff; }
.search { flex: 1; min-width: 220px; position: relative; }
.search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  font: 14px var(--font-body);
  color: var(--ink);
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ── forms ─────────────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }

.form-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.form-field input[type="text"], .form-field input[type="number"],
.form-field input[type="email"], .form-field input[type="date"],
.form-field input[type="url"], .form-field input[type="password"],
.form-field select, .form-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  font: 14px var(--font-body);
  color: var(--ink);
}
.form-field :is(input, select, textarea):focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.form-field .help { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.form-field .req { color: var(--accent); }
/* the unit beside a field label: opts out of the label's uppercasing, since
   units are case-sensitive (lbs./bird, MM/year) */
.form-field label .unit { text-transform: none; letter-spacing: 0; font-weight: 500; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 400; margin-right: 4px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.checklist { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.ranking-group + .ranking-group { margin-top: 10px; }
.check-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 4px; }
.brand-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.brand-row input { flex: 1; }

/* staff-typed prose: keep the typed line breaks, and never let one long token
   (a tracking url, mostly) push the page sideways */
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.note-body a { word-break: break-all; }

/* survey email misconfiguration — shown before the send button, not after */
.mail-warning { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; color: var(--red); background: var(--red-soft);
  border: 1px solid var(--red); }

/* draggable field ordering */
.sort-handle { cursor: grab; color: var(--muted); font-size: 15px; line-height: 1;
  padding: 2px 6px 2px 0; user-select: none; letter-spacing: -2px; }
.sort-handle:active { cursor: grabbing; }
/* .suggestion is justify-content: space-between, so adding the handle as a
   third child split the slack into two gaps and pushed the content an
   arbitrary distance from the grip. Let the content absorb it instead. */
[data-sortable] .suggestion .change { flex: 1; min-width: 0; }
/* a sortable row is a thing you pick up, so it needs an edge: the negative
   margin lets its background sit slightly proud of the column without moving
   the content, and hovering shows what the grip is about to lift */
[data-sortable] .suggestion {
  align-items: flex-start; border-radius: 9px;
  padding: 12px 10px; margin: 0 -10px;
  transition: background .12s ease;
}
[data-sortable] .suggestion:hover { background: var(--surface-2); }
[data-sortable] .suggestion:hover .sort-handle { color: var(--ink); }
/* a section block: its own card-within-a-card so the heading reads as the
   handle for everything under it */
.sort-section + .sort-section { margin-top: 14px; }
.sort-section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 0 -10px 2px;
  border-radius: 8px; background: var(--surface-2);
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
}
.sort-section-head strong { font-size: 12px; letter-spacing: .04em; }
.sort-section-head .muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
.sort-section.is-dragging { opacity: .55; outline: 1px solid var(--accent);
  border-radius: 9px; }
.sort-section.is-dragging .sort-section-head { background: transparent; }

/* the chip that follows the cursor while dragging; parked offscreen because
   the browser only needs to snapshot it */
.sort-ghost {
  position: fixed; top: -1000px; left: -1000px; z-index: 9999;
  padding: 7px 13px; border-radius: 8px; pointer-events: none;
  background: var(--accent); color: #fff;
  font: 600 13px var(--font-body); white-space: nowrap;
  box-shadow: 0 6px 16px rgb(0 0 0 / .28);
}
/* outline rather than border, so lifting a row doesn't shift the list */
[data-sortable] .suggestion.is-dragging {
  opacity: .55; background: var(--surface-2);
  outline: 1px solid var(--accent); border-bottom-color: transparent;
}

/* sandbox industries — a standing reminder that nothing here is real */
.sandbox-banner { margin-bottom: 18px; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn); }

/* survey roster editors — repeatable personnel / plant rows */
.roster-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 8px;
  margin-bottom: 12px; background: var(--surface-2); }
.roster-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.roster-actions [data-roster-undo], .roster-flag { display: none; }
.roster-row.is-removed .form-grid { opacity: .45; pointer-events: none; }
.roster-row.is-removed [data-roster-remove] { display: none; }
.roster-row.is-removed [data-roster-undo] { display: inline-flex; }
.roster-row.is-removed .roster-flag { display: inline; font-size: 12px; color: var(--red); }
.roster-empty { margin-bottom: 8px; }
.roster-change { padding: 12px 0; border-bottom: 1px solid var(--line); }
.roster-change:last-child { border-bottom: none; }
.roster-change .head { display: flex; gap: 8px; align-items: center; }

/* the heading over a group of fields. It sits directly above a run of dt
   labels that are also small, uppercase and letter-spaced, so muted grey left
   the two almost indistinguishable and a long card read as one undivided list.
   Full-strength ink, a heavier weight and a firmer rule separate them, and the
   wider top margin gives each group air to start in. */
.field-section {
  font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink); margin: 26px 0 6px; padding-bottom: 7px;
  border-bottom: 1px solid var(--line-strong);
}
.field-section:first-child { margin-top: 4px; }

.form-actions { display: flex; gap: 9px; margin-top: 20px; align-items: center; }
/* the plant form's custom fields are a second grid straight after the location
   one, which reads as a single long run of inputs without this. Slightly wider
   than the grid's own 14px row gap so the break registers as a break. */
.plant-fields { margin-top: 20px; }

.errors {
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
}
.errors ul { margin: 0; padding-left: 18px; }

/* ── definition lists (company facts) ──────────────────────────────── */

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; margin: 0; }
@media (max-width: 700px) { .facts { grid-template-columns: 1fr; } }
.facts > div { padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
/* a value can be a 200-character url; without this the grid column grows to
   fit it and shoves the whole right-hand column off the page */
.facts dd { margin: 3px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.facts dd a { word-break: break-all; }
/* a boolean fact: a ticked box scans far quicker than a column of Yes / No */
.tick { display: inline-block; width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid var(--line-strong); vertical-align: -2px; position: relative; }
.tick.on { background: var(--accent); border-color: var(--accent); }
.tick.on::after { content: ''; position: absolute; left: 4px; top: 1px;
  width: 3px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg); }

/* ── activity feed ─────────────────────────────────────────────────── */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.feed li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}
.feed .when { color: var(--muted); font-size: 12px; }

/* ── suggestion rows ───────────────────────────────────────────────── */

.suggestion { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.suggestion:last-child { border-bottom: none; }
.suggestion .change { font-size: 14px; }
.suggestion .from { color: var(--muted); text-decoration: line-through; }
.suggestion .to { color: var(--accent-ink); font-weight: 600; }
.suggestion .src { font-size: 12px; color: var(--muted); }

/* ── toasts ────────────────────────────────────────────────────────── */

#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: #12161c;
  color: #f2f4f7;
  padding: 12px 18px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: fadeUp .25s ease;
  max-width: 340px;
}
.toast.err { border-left-color: var(--red); }
.toast.fade { opacity: 0; transition: opacity .4s; }

/* ── login & public pages ──────────────────────────────────────────── */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--rail-2) 0%, var(--rail) 75%);
  padding: 24px;
}
.gate-card { width: 100%; max-width: 380px; text-align: center; padding: 32px 30px; }
.gate-card .brandmark { font-size: 22px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.gate-card .brandmark em { color: var(--accent); font-style: normal; }
.gate-card p { color: var(--muted); font-size: 14px; }
.gate-card form { text-align: left; margin-top: 18px; }

.public-band {
  background: var(--surface-2);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 30px 24px 70px;
  text-align: center;
}
.public-band .brandmark { font-size: 20px; font-weight: 650; }
.public-band .brandmark em { color: var(--accent); font-style: normal; }
.public-wrap { max-width: 760px; margin: -44px auto 60px; padding: 0 20px; }
.public-wrap .card { padding: 28px; }
.public-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ── misc ──────────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.small { font-size: 13px; }
code.snippet {
  display: block;
  background: #0e1319;
  color: #cdd6df;
  border-radius: 10px;
  padding: 16px 18px;
  font: 13px/1.6 var(--mono);
  overflow-x: auto;
  white-space: pre;
}
details.editor summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
details.editor[open] summary { margin-bottom: 12px; }
details.editor { margin-top: 8px; }

/* AI copyedit suggestion panel (inline under the edited textarea) */
.copyedit-result {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.copyedit-head { margin-bottom: 8px; }
.copyedit-text {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
.copyedit-changes {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.copyedit-result .form-actions { margin-top: 12px; }

/* ── ad-hoc reports ────────────────────────────────────────────────── */
/* a note about what the numbers mean — mixed units, a year's snapshot. Warn
   rather than danger: the report is fine, it just needs reading correctly. */
.callout { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn); }
/* Collapsible card sections. The builder is six cards deep and most of them are
   set once and left, so they start shut and each says what it is holding —
   collapsing a card that gives no account of itself just hides things. */
.fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline;
  gap: 9px; font-size: 15px; font-weight: 650;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: '▸'; color: var(--muted); font-weight: 400; font-size: 11px;
  line-height: 1.5; transition: transform .12s ease; display: inline-block;
}
.fold[open] > summary::before { transform: rotate(90deg); }
.fold[open] > summary { margin-bottom: 14px; }
.fold > summary:hover::before { color: var(--accent); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fold-title { flex-shrink: 0; }
/* what is inside, so a shut fold is still an answer */
.fold-count { color: var(--muted); font-size: 12.5px; font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .fold > summary::before { transition: none; }
}

/* a button that belongs in a run of links — same colour and underline, no
   chrome, so a row's actions read as one list rather than two kinds of control */
.link-btn { background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn[disabled] { color: var(--muted); cursor: default; text-decoration: none; }

/* only appears when the clipboard is unavailable, so the staffer still has
   something to copy by hand */
.copy-fallback { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; width: 100%; max-width: 420px; margin-top: 6px;
  padding: 6px 8px; border: 1px solid var(--warn); border-radius: 8px;
  background: var(--warn-soft); color: var(--ink); }

/* the column and ranking pickers: many short checkboxes, so they wrap into
   columns rather than running down one long list */
.check-grid { display: grid; gap: 4px 18px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.filter-row { display: grid; gap: 8px; margin-bottom: 8px; align-items: center;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; }
@media (max-width: 700px) { .filter-row { grid-template-columns: 1fr; } }
/* the field picker: 200+ checkboxes once the year and change series are
   counted, so it scrolls inside the card instead of burying the results */
.field-picker { max-height: 42vh; overflow-y: auto; padding-right: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px 10px 10px; background: var(--surface-2); }
.field-picker .field-section:first-child { margin-top: 8px; }
.field-search { width: 100%; margin-bottom: 10px; }

/* the report builder's action bar. Sticks to the top of the viewport for the
   whole length of a long form, so Run is never something to go and look for.
   Negative margins let it span the gutter the cards sit in. */
/* The bar reads as its own surface rather than a gap at the top of the page:
   a card ground, a left accent edge, and the one gold button on the screen
   above the fold. It used to be a small button floating to the right, which is
   how it got lost. */
.builder-bar { position: sticky; top: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 12px 18px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.builder-bar-what { display: flex; flex-direction: column; min-width: 0; }
.builder-bar-title { font-weight: 650; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* what pressing the button would actually produce, counted from the form */
.builder-bar-summary { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.builder-bar-go { display: flex; align-items: center; gap: 10px; }
.builder-bar-stale { font-size: 12.5px; font-weight: 600; color: var(--warn);
  background: var(--warn-soft); border: 1px solid var(--warn);
  border-radius: 999px; padding: 3px 10px; }

/* so a re-run does not land the table underneath the bar that triggered it */
#report-results { scroll-margin-top: 64px; }

/* the report's chosen-columns list: name, its heading override, and reorder */
.chosen-col { display: grid; gap: 8px; align-items: center; margin-bottom: 6px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) 68px auto auto auto auto; }
.chosen-col-skip { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chosen-col input[type="number"] { width: 100%; }
.chosen-col-name { font-size: 13px; color: var(--ink-2); }
@media (max-width: 700px) { .chosen-col { grid-template-columns: 1fr 1fr 60px auto auto auto auto; } }
/* a report's totals footer — separated from the rows it sums, with the
   percentage called out because it is the figure the table is making */
/* names the section below it — the country, the region — so a long table
   reads as a set of short ones */
.row-heading td { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  font-size: 12px; background: var(--surface-2); color: var(--ink);
  border-top: 1px solid var(--line-strong); }
.totals-row td { border-top: 2px solid var(--line-strong); font-weight: 600; }
.totals-row .totals-headline { background: var(--accent-soft); color: var(--accent-ink);
  font-variant-numeric: tabular-nums; }
/* a report's standing text — a disclaimer or source note, part of the table
   rather than a warning about it, so it reads quietly */
.report-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted);
  max-width: 68ch;
  /* the text is typed as lines — a footnote qualifying one column belongs on
     its own line, not run into the sentence before it */
  white-space: pre-line; }
