/* ===========================================================================
   SAMEQO Feedback
   Palette, type and proportions from the SAMEQO GROUP brand guidelines.
   Navy carries ~45% of surface area, white 30%, gold 25%, grey the rest.

   Responsive strategy: fluid by default, breakpoints only where the layout
   genuinely has to change shape.
     1440+  large desktop - content capped so lines stay readable
     1024   tablet landscape - narrower rail
      820   tablet portrait - rail becomes a top bar
      640   phone - tables become cards, single column throughout
      380   small phone - tightened spacing
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Brand */
  --navy:        #0f123a;
  --navy-raised: #191d4b;
  --navy-line:   #262b5e;
  --gold:        #DAA520;
  --gold-deep:   #b8891a;
  --gold-pale:   #f5e7c2;
  --white:       #fffefb;
  --grey:        #9a9aa4;

  /* Derived text tones */
  --ink:         #0f123a;
  --ink-soft:    #545872;
  --on-navy:     #e6e7f0;
  --on-navy-dim: #9ea2bd;

  /* Functional only - kept to the 5% the palette allows */
  --ok:      #1f6f4a;
  --ok-bg:   #e4f0ea;
  --stop:    #a3342f;
  --stop-bg: #f8e8e7;

  --radius: 4px;
  --rail:   250px;

  /* Fluid type. Headings shrink with the viewport rather than jumping at a
     breakpoint, so tablet sizes in between never look wrong. */
  --t-hero: clamp(1.65rem, 1.15rem + 2.4vw, 2.5rem);
  --t-h1:   clamp(1.35rem, 1.10rem + 1.1vw, 1.63rem);
  --t-h2:   clamp(1.15rem, 1.02rem + .55vw, 1.31rem);
  --t-stat: clamp(1.75rem, 1.35rem + 1.7vw, 2.13rem);

  /* Fluid gutters - one knob for page padding at every size. */
  --gut:       clamp(1rem, .55rem + 2vw, 2.13rem);
  --gut-tight: clamp(1.13rem, .8rem + 1.5vw, 1.88rem);

  /* Minimum comfortable touch target. */
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;   /* nothing should ever cause a sideways scrollbar */
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, .display {
  font-family: 'Righteous', 'Inter', sans-serif;
  font-weight: 400;
  letter-spacing: .005em;
  line-height: 1.18;
  overflow-wrap: break-word;
}

a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--gold); color: var(--navy);
  padding: 10px 16px; font-weight: 600; border-radius: var(--radius);
  z-index: 100; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------------------
   Eyebrow - taken from the logo, where gold rules flank the word GROUP.
   --------------------------------------------------------------------------- */
.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 14px;
}
.eyebrow::before,
.eyebrow::after { content: ""; height: 1px; background: var(--gold); flex: 0 0 22px; }
.eyebrow::after { flex: 1; opacity: .35; }
.eyebrow--on-navy { color: var(--gold); }

/* ===========================================================================
   PUBLIC SIDE
   =========================================================================== */

.public {
  min-height: 100vh;
  min-height: 100dvh;          /* iOS: avoids the URL-bar height jump */
  background: var(--navy);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(218,165,32,.10), transparent 45%),
    radial-gradient(circle at 92% 8%, rgba(218,165,32,.06), transparent 40%);
  display: flex;
  flex-direction: column;
}

.public__bar {
  padding: 1.13rem var(--gut);
  padding-top: max(1.13rem, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--navy-line);
}
.public__bar img { height: clamp(26px, 5vw, 34px); width: auto; }
.public__bar nav { display: flex; gap: clamp(.88rem, 2.5vw, 1.38rem); flex-wrap: wrap; }
.public__bar nav a {
  color: var(--on-navy-dim);
  font-size: clamp(.81rem, .75rem + .2vw, .84rem);
  font-weight: 500; text-decoration: none;
  padding: .38rem 0;
  border-bottom: 1px solid transparent;
  min-height: var(--tap);
  display: flex; align-items: center;
}
.public__bar nav a:hover,
.public__bar nav a:focus-visible { color: var(--white); border-bottom-color: var(--gold); }

.public__body {
  flex: 1; display: flex; justify-content: center;
  padding: clamp(1.63rem, 1rem + 2.5vw, 2.75rem) var(--gut) clamp(2.5rem, 5vw, 4.5rem);
}
.public__col { width: 100%; max-width: 41.25rem; }
.public__col--narrow { max-width: 33.75rem; }

.public__lede { margin-bottom: clamp(1.25rem, 3vw, 1.75rem); }
.public__lede h1 { font-size: var(--t-hero); color: var(--white); margin-bottom: .75rem; }
.public__lede h1 em { font-style: normal; color: var(--gold); }
.public__lede p {
  color: var(--on-navy-dim);
  font-size: clamp(.94rem, .9rem + .2vw, 1rem);
  max-width: 52ch;
}

.public__foot {
  padding: 1.38rem var(--gut) calc(1.5rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--navy-line);
  color: var(--on-navy-dim); font-size: .78rem;
  display: flex; justify-content: space-between; gap: .88rem; flex-wrap: wrap;
}
.public__foot .tag {
  color: var(--gold); letter-spacing: .16em; text-transform: uppercase; font-size: .69rem;
}

/* --- Sheet: white card on the navy ground --- */
.sheet {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--gut-tight);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.sheet__title { font-size: var(--t-h2); margin-bottom: .38rem; }
.sheet__note { color: var(--ink-soft); font-size: .88rem; margin-bottom: 1.38rem; }

/* ---------------------------------------------------------------------------
   Claim check - the signature element.
   The reference is the only thing a submitter takes away, so it is treated as
   a physical stub: torn edge, punched holes, code set large enough to read
   aloud from across a room.
   --------------------------------------------------------------------------- */
.check {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--gut-tight);
  padding-top: calc(var(--gut-tight) + .5rem);
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
  overflow: hidden;
}
.check::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 5px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 14px, transparent 14px 26px);
}
.check__perf {
  position: relative;
  /* Pulls out to the card edge whatever the current gutter is. */
  margin: 1.5rem calc(-1 * var(--gut-tight)) 1.25rem;
  border-top: 2px dashed #d8d5cc;
}
.check__perf::before,
.check__perf::after {
  content: "";
  position: absolute; top: -11px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--navy);
}
.check__perf::before { left: -10px; }
.check__perf::after  { right: -10px; }

.check__label {
  font-size: .69rem; font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: .75rem;
}
.check__code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(1.38rem, .9rem + 3.4vw, 2.5rem);
  letter-spacing: .04em;
  color: var(--navy);
  line-height: 1.25;
  overflow-wrap: anywhere;   /* long code, narrow phone: wrap not overflow */
}
.check__why { font-size: .84rem; color: var(--ink-soft); margin-top: .25rem; }
.check__why strong { color: var(--ink); font-weight: 600; }

.copy-btn {
  margin-top: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap);
  background: var(--navy); color: var(--white);
  border: none; border-radius: var(--radius);
  padding: .63rem 1.13rem;
  font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { background: #1b2054; }
.copy-btn[data-copied="true"] { background: var(--ok); }

/* --- Status rail on the public tracking page --- */
.track-rail { margin: 1.63rem 0 .25rem; }
.track-rail__row { display: flex; }
.track-rail__step { flex: 1; text-align: center; position: relative; min-width: 0; }
.track-rail__dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: #d9d7d0; margin: 0 auto .56rem;
  position: relative; z-index: 1;
}
.track-rail__step::before,
.track-rail__step::after {
  content: ""; position: absolute; top: 6px; height: 1px; background: #d9d7d0;
}
.track-rail__step::before { left: 0; right: 50%; }
.track-rail__step::after  { left: 50%; right: 0; }
.track-rail__step:first-child::before,
.track-rail__step:last-child::after { display: none; }
.track-rail__step.is-done .track-rail__dot { background: var(--gold); }
.track-rail__step.is-done::before { background: var(--gold); }
.track-rail__step.is-current .track-rail__dot {
  background: var(--navy);
  box-shadow: 0 0 0 4px rgba(218,165,32,.35);
}
.track-rail__name {
  font-size: clamp(.56rem, .45rem + .5vw, .69rem);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
  padding: 0 2px;
  overflow-wrap: break-word; hyphens: auto;
}
.track-rail__step.is-current .track-rail__name { color: var(--navy); }

/* --- Response thread --- */
.thread { margin-top: 1.63rem; display: flex; flex-direction: column; gap: .88rem; }
.thread__item {
  background: #f6f5f0;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .88rem 1.13rem;
}
.thread__meta {
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin-bottom: .38rem;
}
.thread__item p { font-size: .91rem; white-space: pre-wrap; overflow-wrap: break-word; }

/* ===========================================================================
   FORMS
   =========================================================================== */

.field { margin-bottom: 1.25rem; min-width: 0; }
.field > label {
  display: block;
  font-size: .75rem; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: .44rem;
}
.field .assist {
  font-size: .81rem; color: var(--ink-soft); margin-bottom: .5rem;
  font-weight: 400; text-transform: none; letter-spacing: 0;
}

.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=password],
.field input[type=date],
.field select,
.field textarea {
  width: 100%;
  padding: .69rem .81rem;
  font: inherit;
  /* 16px: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #cdcbc3;
  border-radius: var(--radius);
  min-height: var(--tap);
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 8.13rem; resize: vertical; line-height: 1.55; }
.field select {
  cursor: pointer;
  /* Chevron drawn in CSS - no image request, recolours with the theme. */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.19rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(218,165,32,.35);
  outline-offset: 0;
}
.field .err { display: block; color: var(--stop); font-size: .81rem; margin-top: .38rem; font-weight: 500; }
.field--bad input, .field--bad select, .field--bad textarea { border-color: var(--stop); }

/* Two-up when there is room, stacked when there is not - handled by the grid
   itself rather than a breakpoint, so it also behaves inside the narrow
   detail column. */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.75rem), 1fr));
  gap: 0 1rem;
}

fieldset { border: none; min-width: 0; }
fieldset legend {
  font-size: .75rem; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: .44rem;
}

.optional-block {
  border: 1px dashed #cdcbc3;
  border-radius: var(--radius);
  padding: 1.13rem 1.13rem .13rem;
  margin-bottom: 1.38rem;
  background: #fbfaf6;
}
.optional-block__head { margin-bottom: .88rem; }
.optional-block__head h3 {
  font-family: 'Inter'; font-weight: 700; font-size: .94rem; margin-bottom: .19rem;
}
.optional-block__head p { font-size: .84rem; color: var(--ink-soft); }

/* Rating - buttons rather than a select, because five options should be one tap */
.rating { display: flex; gap: .5rem; flex-wrap: wrap; }
.rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating label {
  cursor: pointer;
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem .75rem;
  border: 1px solid #cdcbc3; border-radius: var(--radius);
  font-size: .94rem; font-weight: 600; color: var(--ink-soft);
  background: var(--white);
}
.rating label:hover { border-color: var(--gold); }
.rating input:checked + label { background: var(--navy); border-color: var(--navy); color: var(--white); }
.rating input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ===========================================================================
   BUTTONS
   =========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap);
  padding: .69rem 1.38rem;
  font: inherit; font-size: .94rem; font-weight: 600;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn--gold  { background: var(--gold); color: var(--navy); }
.btn--gold:hover { background: var(--gold-deep); }
.btn--navy  { background: var(--navy); color: var(--white); }
.btn--navy:hover { background: #1b2054; }
.btn--quiet { background: transparent; color: var(--navy); border-color: #cdcbc3; }
.btn--quiet:hover { background: #f2f1ec; }
.btn--ghost-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,.3); }
.btn--ghost-light:hover { border-color: var(--gold); }
.btn--wide { width: 100%; }
.btn--small { padding: .44rem .94rem; font-size: .84rem; min-height: 38px; }
.btn:disabled { opacity: .6; cursor: default; }

.btn-link {
  background: none; border: none; padding: .25rem 0;
  font: inherit; font-size: .84rem; font-weight: 600;
  color: var(--navy); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link--stop { color: var(--stop); }

.actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ===========================================================================
   MESSAGES
   =========================================================================== */

.msg {
  padding: .81rem 1.06rem;
  border-radius: var(--radius);
  font-size: .91rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--gold);
  background: var(--gold-pale);
  color: #6b4e08;
}
.msg--ok   { background: var(--ok-bg);   border-left-color: var(--ok);   color: #145034; }
.msg--stop { background: var(--stop-bg); border-left-color: var(--stop); color: #7c2621; }
.msg--on-navy { background: rgba(218,165,32,.14); color: var(--gold-pale); border-left-color: var(--gold); }

/* ===========================================================================
   LOGIN
   =========================================================================== */

.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--navy);
}
.login__side {
  padding: clamp(1.75rem, 4vw, 3.25rem);
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 1.5rem;
  background-image: radial-gradient(circle at 20% 0%, rgba(218,165,32,.13), transparent 50%);
}
.login__side img { height: clamp(30px, 4vw, 40px); width: auto; }
.login__side h2 {
  color: var(--white);
  font-size: clamp(1.31rem, 1rem + 1.5vw, 1.88rem);
  margin-bottom: .75rem; max-width: 15ch;
}
.login__side p { color: var(--on-navy-dim); font-size: .94rem; max-width: 40ch; }
.login__tag { color: var(--gold); font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; }

.login__panel {
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1.75rem, 4vw, 2.5rem) var(--gut);
}
.login__box { width: 100%; max-width: 21.88rem; }
.login__box h1 { font-size: var(--t-h1); margin-bottom: .31rem; }
.login__box > p { color: var(--ink-soft); font-size: .88rem; margin-bottom: 1.5rem; }

/* ===========================================================================
   STAFF SHELL
   =========================================================================== */

.app { display: flex; min-height: 100vh; min-height: 100dvh; background: #f4f3ee; }

.rail {
  width: var(--rail); flex-shrink: 0;
  background: var(--navy);
  display: flex; flex-direction: column;
  padding: 1.63rem 0 1.13rem;
  /* Stays put while a long queue scrolls. */
  position: sticky; top: 0; align-self: flex-start;
  max-height: 100vh; max-height: 100dvh;
  overflow-y: auto;
}
.rail__logo { padding: 0 1.38rem 1.5rem; }
.rail__logo img { height: 30px; width: auto; }

.rail__nav { flex: 1; padding: 0 .75rem; display: flex; flex-direction: column; gap: 1px; }
.rail__nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: var(--tap);
  padding: .5rem .81rem; border-radius: var(--radius);
  color: var(--on-navy-dim); text-decoration: none;
  font-size: .88rem; font-weight: 500;
  border-left: 2px solid transparent;
}
.rail__nav a:hover { background: var(--navy-raised); color: var(--white); }
.rail__nav a.is-on { background: var(--navy-raised); color: var(--white); border-left-color: var(--gold); }
.rail__nav .count { font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--gold); }
.rail__group {
  padding: 1.13rem .81rem .44rem;
  font-size: .63rem; letter-spacing: .22em; text-transform: uppercase;
  color: #6e739b; font-weight: 600;
}

.rail__foot { padding: 1rem 1.38rem 0; margin-top: .75rem; border-top: 1px solid var(--navy-line); }
.rail__who  { color: var(--white); font-size: .84rem; font-weight: 600; }
.rail__role { font-family: 'JetBrains Mono', monospace; font-size: .69rem; color: var(--gold); margin-top: 1px; }
.rail__scope { font-size: .72rem; color: var(--on-navy-dim); margin-top: .19rem; }
.rail__foot form { margin-top: .75rem; }

.main {
  flex: 1; min-width: 0;
  padding: clamp(1.25rem, 2.5vw, 1.88rem) var(--gut) 3.75rem;
  max-width: 87.5rem;   /* caps line length on a 27" monitor */
}
.main__head { margin-bottom: 1.5rem; }
.main__head h1 { font-size: var(--t-h1); }
.main__head p { color: var(--ink-soft); font-size: .88rem; margin-top: .31rem; }
.head-split { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; }

/* --- Stats --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.38rem), 1fr));
  gap: .88rem;
  margin-bottom: 1.75rem;
}
.stat { background: var(--white); border: 1px solid #e2e0d8; border-radius: var(--radius); padding: 1rem 1.13rem; }
.stat--lead { background: var(--navy); border-color: var(--navy); }
.stat__k {
  font-size: .66rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
}
.stat--lead .stat__k { color: var(--on-navy-dim); }
.stat__v {
  font-family: 'Righteous', sans-serif;
  font-size: var(--t-stat); color: var(--navy); line-height: 1.15; margin-top: .31rem;
}
.stat--lead .stat__v { color: var(--gold); }
.stat__sub { font-size: .75rem; color: var(--ink-soft); margin-top: .13rem; }
.stat--lead .stat__sub { color: var(--on-navy-dim); }

/* --- Panel + table --- */
.panel { background: var(--white); border: 1px solid #e2e0d8; border-radius: var(--radius); overflow: hidden; }
.panel__head {
  padding: .81rem 1.25rem; border-bottom: 1px solid #e2e0d8;
  display: flex; justify-content: space-between; align-items: center;
  gap: .88rem; flex-wrap: wrap;
}
.panel__head h2 {
  font-family: 'Inter'; font-weight: 700;
  font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--navy);
}
.panel__body { padding: 1.25rem; }

/* Horizontal scroll is the fallback between the card and full table layouts. */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: .63rem 1.25rem;
  font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
  border-bottom: 1px solid #e2e0d8; background: #faf9f5;
  white-space: nowrap;
}
tbody td { padding: .81rem 1.25rem; border-bottom: 1px solid #eeece5; font-size: .88rem; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaf6; }
td .sub { display: block; color: var(--ink-soft); font-size: .78rem; margin-top: .19rem; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

.mono { font-family: 'JetBrains Mono', monospace; font-size: .78rem; letter-spacing: .02em; }

.empty { padding: 3.25rem 1.25rem; text-align: center; }
.empty h3 { font-family: 'Inter'; font-weight: 700; font-size: 1rem; margin-bottom: .31rem; }
.empty p { color: var(--ink-soft); font-size: .88rem; }

/* --- Pills --- */
.pill {
  display: inline-block; white-space: nowrap;
  font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: .25rem .56rem; border-radius: 2px;
}
.pill--received  { background: #eceae2; color: #56596b; }
.pill--review    { background: var(--navy); color: var(--white); }
.pill--progress  { background: var(--gold); color: var(--navy); }
.pill--resolved  { background: var(--ok-bg); color: var(--ok); }
.pill--closed    { background: #eceae2; color: #7d8090; }
.pill--role      { background: var(--navy); color: var(--gold); }
.pill--sub       { background: #f0eee6; color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.pill--urgent    { background: var(--stop-bg); color: var(--stop); }
.pill--high      { background: var(--gold-pale); color: #7a5a08; }

/* --- Filter bar --- */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.25rem), 1fr));
  gap: .75rem;
  align-items: end;
}
.filters .field { margin-bottom: 0; }
.filters .btn { align-self: end; }

/* --- Pagination --- */
.pager {
  display: flex; justify-content: space-between; align-items: center;
  padding: .81rem 1.25rem; border-top: 1px solid #e2e0d8;
  gap: .88rem; flex-wrap: wrap;
}
.pager__at { font-size: .81rem; color: var(--ink-soft); }

/* --- Detail layout --- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18.75rem;
  gap: 1.25rem;
  align-items: start;
}
.detail > * { min-width: 0; }

.record__ref {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: .94rem; color: var(--gold-deep); letter-spacing: .04em;
}
.record__subject { font-size: var(--t-h1); margin: .38rem 0 .75rem; }
.record__meta { display: flex; gap: .63rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.record__body {
  background: #faf9f5; border: 1px solid #eeece5; border-radius: var(--radius);
  padding: 1.06rem 1.19rem; font-size: .94rem;
  white-space: pre-wrap; line-height: 1.62; overflow-wrap: break-word;
}

.facts { display: flex; flex-direction: column; }
.facts__row {
  display: flex; justify-content: space-between; gap: .88rem;
  padding: .56rem 0; border-bottom: 1px solid #eeece5; font-size: .84rem;
}
.facts__row:last-child { border-bottom: none; }
.facts__k { color: var(--ink-soft); flex-shrink: 0; }
.facts__v { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }

.note {
  background: #f6f5f0; border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .81rem 1rem; margin-bottom: .75rem;
}
.note--internal { background: #f2f1f7; border-left-color: var(--navy); }
.note__meta {
  font-size: .69rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin-bottom: .31rem;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
}
.note__flag { background: var(--navy); color: var(--gold); padding: .13rem .38rem; border-radius: 2px; font-size: .59rem; }
.note p { font-size: .91rem; white-space: pre-wrap; overflow-wrap: break-word; }

.check-inline { display: flex; align-items: flex-start; gap: .56rem; margin: .75rem 0 1rem; }
.check-inline input { margin-top: .19rem; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--navy); }
.check-inline label { font-size: .88rem; }
.check-inline .hint { display: block; color: var(--ink-soft); font-size: .78rem; margin-top: .13rem; }

/* --- Audit --- */
.trail { font-size: .84rem; }
.trail__row {
  display: grid; grid-template-columns: 9.06rem minmax(0, 1fr); gap: .88rem;
  padding: .63rem 0; border-bottom: 1px solid #eeece5;
}
.trail__row:last-child { border-bottom: none; }
.trail__when { font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--ink-soft); }
.trail__what { overflow-wrap: anywhere; }
.trail__what strong { font-weight: 600; }
.trail__what .who { color: var(--ink-soft); }
.trail__row--denied .trail__what strong { color: var(--stop); }

/* ===========================================================================
   STANDALONE MESSAGE PAGES
   =========================================================================== */

.notice-page {
  min-height: 100vh; min-height: 100dvh; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem var(--gut);
}
.notice-page__box { max-width: 27.5rem; text-align: center; }
.notice-page__box img { height: 36px; margin: 0 auto 1.63rem; }
.notice-page__code {
  font-family: 'Righteous', sans-serif;
  font-size: clamp(2.75rem, 2rem + 4vw, 3.88rem);
  color: var(--gold); line-height: 1;
}
.notice-page__box h1 { color: var(--white); font-size: var(--t-h1); margin: .88rem 0 .63rem; }
.notice-page__box p { color: var(--on-navy-dim); margin-bottom: 1.5rem; }

/* ===========================================================================
   BREAKPOINTS
   =========================================================================== */

/* Tablet landscape - the rail costs too much width here */
@media (max-width: 1024px) {
  :root { --rail: 210px; }
  .detail { grid-template-columns: minmax(0, 1fr) 16.25rem; }
}

/* Login splits, detail stacks */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__side { padding-bottom: 1.75rem; }
  .detail { grid-template-columns: 1fr; }
}

/* Tablet portrait - rail becomes a top bar */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .rail {
    width: 100%; max-height: none; position: static; overflow: visible;
    padding: .88rem 0 .75rem;
    padding-top: max(.88rem, env(safe-area-inset-top));
  }
  .rail__logo { padding: 0 var(--gut) .75rem; }
  .rail__nav {
    flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0 var(--gut) .25rem; gap: .25rem;
    scrollbar-width: none;
  }
  .rail__nav::-webkit-scrollbar { display: none; }
  .rail__nav a {
    white-space: nowrap; border-left: none; border-bottom: 2px solid transparent;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .rail__nav a.is-on { border-left: none; border-bottom-color: var(--gold); }
  .rail__group { display: none; }
  .rail__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
    margin-top: .63rem; padding: .75rem var(--gut) 0;
  }
  .rail__foot form { margin-top: 0; }
  .rail__scope { display: none; }
  .main { max-width: none; }
}

/* Phone - tables become stacked cards */
@media (max-width: 640px) {
  .table-scroll { overflow-x: visible; }

  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { border-bottom: 1px solid #e2e0d8; padding: .75rem 0; }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: transparent; }
  tbody td { border: none; padding: .25rem var(--gut); }
  tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: .63rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-soft); font-weight: 600; margin-bottom: .13rem;
  }
  tbody td:not([data-label])::before { display: none; }

  .panel__body { padding: 1rem; }
  .pager { padding: .81rem 1rem; }
  .pager .actions { width: 100%; }
  .pager .btn { flex: 1; }

  .trail__row { grid-template-columns: 1fr; gap: .19rem; }

  .public__bar { padding-bottom: .75rem; }
  .public__foot { flex-direction: column; gap: .38rem; }

  /* Four labels across a 360px screen will not sit side by side otherwise. */
  .track-rail__name { font-size: .56rem; letter-spacing: 0; }

  .actions .btn { flex: 1 1 auto; }
}

/* Small phone */
@media (max-width: 380px) {
  .rating label { min-width: 40px; padding: .5rem; }
  .check__code { letter-spacing: 0; }
  .stats { gap: .63rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .public, .notice-page { background: var(--white); }
  .public__bar nav, .copy-btn, .rail, .pager { display: none; }
  .check { box-shadow: none; border: 1px solid #ccc; }
  .check__perf::before, .check__perf::after { background: var(--white); }
  .public__lede h1, .public__lede p { color: var(--navy); }
}
