/* =========================================================================
   Stock Book — black, gold and brushed steel
   ========================================================================= */

:root {
  --ink:        #06070a;
  --ink-2:      #0b0d12;
  --panel:      #111319;
  --panel-2:    #171a22;
  --panel-3:    #1e222c;
  --raised:     #232833;

  --gold:        #d4af37;
  --gold-bright: #f2d47e;
  --gold-deep:   #a9821f;
  --amber:       #e0912f;

  --text:       #eae7e0;
  --text-dim:   #a5a29a;
  /* Lifted to clear 4.5:1 on the panel backgrounds — this carries real labels
     and footnotes, not decoration. */
  --text-faint: #8a877f;

  --ok:    #4bb07a;
  --warn:  #e0912f;
  --bad:   #d9534f;
  --info:  #6da8d8;

  --line:        rgba(212, 175, 55, 0.14);
  --line-soft:   rgba(255, 255, 255, 0.07);
  --line-strong: rgba(212, 175, 55, 0.34);

  --gradient-gold: linear-gradient(135deg, #f2d47e 0%, #d4af37 42%, #c98f2a 72%, #e0912f 100%);
  --gradient-rule: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.55), transparent);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
  --shadow-3: 0 24px 60px -20px rgba(0, 0, 0, 0.9);

  --topbar-h: 62px;
  --tabbar-h: 62px;
  --sidenav-w: 246px;

  --font: "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Mono", "Cascadia Mono", "Segoe UI Mono", ui-monospace, "Roboto Mono", monospace;

  color-scheme: dark;
}

/* =========================================================================
   Light theme — same black-and-gold identity, inverted for daylight. Gold is
   darkened for text so it still reads against white; the bright gold is kept
   for fills and accents where it sits on a dark or tinted ground.
   ========================================================================= */

:root[data-theme="light"] {
  --ink:        #f4f1ea;
  --ink-2:      #ffffff;
  --panel:      #ffffff;
  --panel-2:    #faf8f3;
  --panel-3:    #f0ece2;
  --raised:     #e7e2d5;

  /* Gold is darkened here so that gold-on-white still clears 4.5:1 for text.
     The bright gradient gold is kept for fills, where it sits on a dark ground. */
  --gold:        #7a5e0e;
  --gold-bright: #634c0d;
  --gold-deep:   #c9a227;
  --amber:       #a25f0d;

  --text:       #1b1813;
  --text-dim:   #565045;
  --text-faint: #6b6459;

  --ok:    #1f7a4c;
  --warn:  #a55f0c;
  --bad:   #b3312d;
  --info:  #1f5f8f;

  --line:        rgba(138, 106, 18, 0.24);
  --line-soft:   rgba(27, 24, 19, 0.11);
  --line-strong: rgba(138, 106, 18, 0.45);

  --gradient-gold: linear-gradient(135deg, #e8c55f 0%, #c9a227 42%, #b3862a 72%, #c9791f 100%);
  --gradient-rule: linear-gradient(90deg, transparent, rgba(138, 106, 18, 0.45), transparent);

  --shadow-1: 0 1px 2px rgba(27, 24, 19, 0.1);
  --shadow-2: 0 8px 24px -14px rgba(27, 24, 19, 0.35);
  --shadow-3: 0 22px 50px -22px rgba(27, 24, 19, 0.45);

  color-scheme: light;
}

:root[data-theme="light"] .backdrop {
  background: radial-gradient(120% 90% at 50% -10%, #ffffff 0%, #f6f3ec 45%, #efeade 100%);
}
:root[data-theme="light"] .backdrop-steel { opacity: 0.55; }
:root[data-theme="light"] .backdrop-grid { opacity: 0.5; }
:root[data-theme="light"] .backdrop-glow {
  background:
    radial-gradient(52% 40% at 50% -8%, rgba(201, 162, 39, 0.16), transparent 70%),
    radial-gradient(38% 34% at 92% 8%, rgba(201, 121, 31, 0.09), transparent 70%);
}

:root[data-theme="light"] .gate-card,
:root[data-theme="light"] .card,
:root[data-theme="light"] .stat,
:root[data-theme="light"] .module,
:root[data-theme="light"] .item-row,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .toast {
  background: var(--panel);
}
:root[data-theme="light"] .group { background: var(--panel); }
:root[data-theme="light"] .group-head { background: var(--panel-2); }
:root[data-theme="light"] .group-head:hover { background: var(--panel-3); }
:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92);
}
:root[data-theme="light"] .sidenav {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(246, 243, 236, 0.6));
}
:root[data-theme="light"] .tabbar { background: rgba(255, 255, 255, 0.97); }
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background-color: #ffffff;
  border-color: rgba(27, 24, 19, 0.2);
}
:root[data-theme="light"] input:focus,
:root[data-theme="light"] select:focus,
:root[data-theme="light"] textarea:focus {
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.25);
}
/* Only the arrow's colour changes for light mode; repeat, position and size
   are inherited from the base rule and must not be reset. */
:root[data-theme="light"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%237a5e0e' stroke-width='1.6' stroke-linecap='round'/></svg>");
}
:root[data-theme="light"] table.data th { background: var(--panel-2); }
:root[data-theme="light"] table.data td { border-bottom-color: rgba(27, 24, 19, 0.08); }
:root[data-theme="light"] table.data tbody tr:hover td { background: rgba(201, 162, 39, 0.07); }
:root[data-theme="light"] .btn { background: var(--panel-3); }
:root[data-theme="light"] .btn:hover { background: var(--raised); }
:root[data-theme="light"] .btn-gold { color: #221a06; }
:root[data-theme="light"] .seg { background: var(--panel-3); }
:root[data-theme="light"] .seg button.on { color: #221a06; }
:root[data-theme="light"] .stage { background: var(--panel-2); }
:root[data-theme="light"] .stage.current { color: #221a06; }
:root[data-theme="light"] .chip { background: rgba(27, 24, 19, 0.04); }
:root[data-theme="light"] .user-avatar { background: var(--panel-3); }
:root[data-theme="light"] .modal-root { background: rgba(60, 54, 43, 0.4); }
:root[data-theme="light"] .modal-foot { background: var(--panel-2); }
:root[data-theme="light"] .brand-mark::after { border-color: rgba(255, 255, 255, 0.85); }
:root[data-theme="light"] .nav-link.active {
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.22), rgba(201, 162, 39, 0.05));
}
:root[data-theme="light"] .nav-link:hover,
:root[data-theme="light"] .stage:hover:not(:disabled) { background: rgba(27, 24, 19, 0.05); }
:root[data-theme="light"] .pw-meter { background: rgba(27, 24, 19, 0.1); }
:root[data-theme="light"] .switch { background: rgba(27, 24, 19, 0.14); }
:root[data-theme="light"] .switch::after { background: #ffffff; box-shadow: var(--shadow-1); }
:root[data-theme="light"] .switch[aria-checked="true"]::after { background: #3a2c07; }
:root[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, rgba(27, 24, 19, 0.05), rgba(27, 24, 19, 0.11), rgba(27, 24, 19, 0.05));
  background-size: 200% 100%;
}
:root[data-theme="light"] .item-row { background: var(--panel-2); }
:root[data-theme="light"] .choice { background: rgba(27, 24, 19, 0.03); }
:root[data-theme="light"] .row-in td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
:root[data-theme="light"] .row-out td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
:root[data-theme="light"] .backdrop-steel {
  background-image: repeating-linear-gradient(
      104deg,
      rgba(27, 24, 19, 0.02) 0px, rgba(27, 24, 19, 0.02) 1px,
      transparent 1px, transparent 3px,
      rgba(255, 255, 255, 0.5) 3px, rgba(255, 255, 255, 0.5) 4px,
      transparent 4px, transparent 7px
    ),
    repeating-linear-gradient(
      104deg,
      rgba(138, 106, 18, 0.035) 0px, rgba(138, 106, 18, 0.035) 2px,
      transparent 2px, transparent 23px
    );
}
:root[data-theme="light"] .backdrop-grid {
  background-image: url("/img/pattern.svg"),
    linear-gradient(rgba(27, 24, 19, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 24, 19, 0.035) 1px, transparent 1px);
}

/* Status colours: the dark theme uses pale tints that vanish on white, so the
   text half of every status flips to a deep shade while the fill stays soft. */
:root[data-theme="light"] .banner.warn { background: rgba(224, 145, 47, 0.13); border-color: rgba(180, 110, 20, 0.4); color: #79470a; }
:root[data-theme="light"] .banner.bad  { background: rgba(217, 83, 79, 0.11); border-color: rgba(170, 50, 46, 0.4); color: #8d2521; }
:root[data-theme="light"] .banner.info { background: rgba(31, 95, 143, 0.09); border-color: rgba(31, 95, 143, 0.32); color: #194b73; }

:root[data-theme="light"] .pill.ok   { background: rgba(31, 122, 76, 0.14); color: #14603a; border-color: rgba(31, 122, 76, 0.35); }
:root[data-theme="light"] .pill.low  { background: rgba(224, 145, 47, 0.16); color: #7f4708; border-color: rgba(180, 110, 20, 0.4); }
:root[data-theme="light"] .pill.nil  { background: rgba(217, 83, 79, 0.15); color: #93231f; border-color: rgba(170, 50, 46, 0.4); }
:root[data-theme="light"] .pill.info { background: rgba(31, 95, 143, 0.13); color: #194b73; border-color: rgba(31, 95, 143, 0.34); }

/* The pale tint that reads as "danger" on black is invisible on white. */
:root[data-theme="light"] .btn-danger {
  background: rgba(217, 83, 79, 0.12);
  color: #8d2521;
  border-color: rgba(170, 50, 46, 0.4);
}
:root[data-theme="light"] .btn-danger:hover {
  background: rgba(217, 83, 79, 0.2);
  border-color: rgba(170, 50, 46, 0.62);
}

:root[data-theme="light"] .gate-error {
  background: rgba(217, 83, 79, 0.11);
  border-color: rgba(170, 50, 46, 0.4);
  color: #8d2521;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------- backdrop */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 90% at 50% -10%, #14161d 0%, #0a0b0f 45%, #06070a 100%);
}

/* Brushed steel: fine directional streaks, kept very low contrast. */
.backdrop-steel {
  position: absolute;
  inset: -20%;
  opacity: 0.5;
  background-image: repeating-linear-gradient(
      104deg,
      rgba(255, 255, 255, 0.022) 0px,
      rgba(255, 255, 255, 0.022) 1px,
      transparent 1px,
      transparent 3px,
      rgba(0, 0, 0, 0.05) 3px,
      rgba(0, 0, 0, 0.05) 4px,
      transparent 4px,
      transparent 7px
    ),
    repeating-linear-gradient(
      104deg,
      rgba(212, 175, 55, 0.018) 0px,
      rgba(212, 175, 55, 0.018) 2px,
      transparent 2px,
      transparent 23px
    );
}

/* Engineering drawing grid + machined hex pattern. */
.backdrop-grid {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("/img/pattern.svg"),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 340px 340px, 46px 46px, 46px 46px;
  mask-image: radial-gradient(140% 100% at 50% 0%, #000 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
}

.backdrop-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52% 40% at 50% -8%, rgba(212, 175, 55, 0.13), transparent 70%),
    radial-gradient(38% 34% at 92% 8%, rgba(224, 145, 47, 0.07), transparent 70%),
    radial-gradient(60% 50% at 8% 100%, rgba(212, 175, 55, 0.05), transparent 70%);
}

/* ------------------------------------------------------------ typography */

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 0.6em; }
a  { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.num { font-variant-numeric: tabular-nums; font-family: var(--font-num); letter-spacing: -0.02em; }
.gold-text {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.invocation {
  font-size: 0.86rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin: 0;
  opacity: 0.9;
}
.invocation-sub {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 2px 0 0.35rem;
}
.invocation-block { text-align: center; margin-bottom: 16px; }

/* ---------------------------------------------------------------- gate */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
}

.gate-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, rgba(30, 34, 44, 0.92), rgba(13, 15, 20, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 34px 28px 26px;
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
  backdrop-filter: blur(10px);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.25, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.gate-mark { display: flex; justify-content: center; margin-bottom: 12px; }
.gate-title {
  font-size: 1.85rem;
  letter-spacing: 0.02em;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gate-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 4px 0 26px;
}
.gate-card .field { text-align: left; margin-bottom: 14px; }

.remember-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 11px 12px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: rgba(212, 175, 55, 0.05);
  cursor: pointer;
  transition: 0.15s;
}
.remember-row:hover { border-color: var(--line); }
.remember-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--gold);
  cursor: pointer;
}
.remember-row strong { display: block; font-size: 0.85rem; font-weight: 600; }
.remember-row small { color: var(--text-dim); font-size: 0.76rem; line-height: 1.4; display: block; }
.gate-error {
  background: rgba(217, 83, 79, 0.12);
  border: 1px solid rgba(217, 83, 79, 0.4);
  color: #f3a7a4;
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 0.86rem;
  margin: 4px 0 14px;
  text-align: left;
}
.gate-foot {
  margin: 18px 0 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------- shell */

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(13, 15, 20, 0.95), rgba(10, 12, 16, 0.88));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--gradient-rule);
  opacity: 0.6;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: inherit; }
.brand:hover { text-decoration: none; }
/* The company mark. The artwork's red and green are left alone; it is set on a
   dark tile with a gold hairline so it belongs to the rest of the header
   rather than looking pasted on, and given a soft glow of its own colours. */
.brand-mark {
  /* The mark is close to 2:1, so it needs width rather than a square tile. */
  width: 64px; height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 5px 7px;
  border-radius: 10px;
  position: relative;
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.07), transparent 70%),
    linear-gradient(150deg, #14161d, #0a0b0f);
  border: 1px solid var(--line);
  box-shadow:
    0 0 16px -4px rgba(198, 54, 44, 0.4),
    0 0 16px -6px rgba(46, 141, 68, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: 0.2s;
}
.brand-mark img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.brand:hover .brand-mark {
  border-color: var(--line-strong);
  box-shadow:
    0 0 22px -3px rgba(198, 54, 44, 0.55),
    0 0 22px -5px rgba(46, 141, 68, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
:root[data-theme="light"] .brand-mark {
  background: linear-gradient(150deg, #ffffff, #f4f1ea);
  box-shadow:
    0 0 14px -5px rgba(198, 54, 44, 0.3),
    0 0 14px -6px rgba(46, 141, 68, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
:root[data-theme="light"] .brand-mark img { filter: none; }

/* The sign-in screen gets a larger version with the same treatment. */
.gate-logo {
  width: 168px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 18px rgba(198, 54, 44, 0.28))
          drop-shadow(0 0 14px rgba(46, 141, 68, 0.22));
}
:root[data-theme="light"] .gate-logo {
  filter: drop-shadow(0 2px 6px rgba(27, 24, 19, 0.16));
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text strong {
  font-size: 0.94rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  font-size: 0.63rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 9px 4px 4px;
  border-radius: 22px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: 0.15s;
}
.user-chip:hover { border-color: var(--line); background: rgba(212, 175, 55, 0.08); }
.user-avatar {
  width: 32px; height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line-strong);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 0.82rem; font-weight: 600; }
.user-meta small { font-size: 0.64rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.15s;
}
.icon-btn:hover { color: var(--gold-bright); background: rgba(212, 175, 55, 0.09); border-color: var(--line); }
.nav-toggle { display: none; }

.bell-count {
  position: absolute;
  top: 3px; right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink-2);
}

/* --------------------------------------------------------------- layout */

.layout { flex: 1; display: flex; align-items: flex-start; min-height: 0; }

.sidenav {
  position: sticky;
  top: var(--topbar-h);
  width: var(--sidenav-w);
  flex: none;
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 18px 12px 24px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(17, 19, 25, 0.55), rgba(8, 9, 13, 0.35));
}

.nav-group + .nav-group { margin-top: 18px; }
.nav-group-title {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: 0.14s;
  margin-bottom: 2px;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.nav-link.active {
  color: var(--gold-bright);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.03));
  border-color: var(--line);
}
.nav-link svg { flex: none; opacity: 0.9; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.nav-badge.alert { background: rgba(217, 83, 79, 0.22); color: #f4a7a4; }

.main {
  flex: 1;
  min-width: 0;
  padding: 22px clamp(14px, 3vw, 30px) 40px;
  outline: none;
}

.tabbar { display: none; }
.scrim { display: none; }

/* =========================================================================
   Stock List — the grade → size → stock walk
   ========================================================================= */

/* Each grade carries the colour painted on its bar ends. The colours arrive as
   inline --tone / --tone-2 variables from the grades master, so changing one in
   Settings changes it everywhere without touching this file. The soft and line
   variants are derived from --tone, which keeps a pale code like white or
   silver from washing out its own card. */
:root {
  --tone: var(--gold);
  --tone-2: var(--gold);
  --tone-mix: var(--gold);
  --tone-soft: rgba(212, 175, 55, 0.13);
  --tone-line: rgba(212, 175, 55, 0.4);
}
[style*="--tone"] {
  --tone-soft: color-mix(in srgb, var(--tone) 13%, transparent);
  --tone-line: color-mix(in srgb, var(--tone) 40%, transparent);
}

/* The paint code itself: one colour, or a diagonal split when it is two-tone. */
.swatch {
  display: inline-block;
  width: var(--sw-size, 16px);
  height: var(--sw-size, 16px);
  flex: none;
  border-radius: 4px;
  vertical-align: -0.1em;
  margin-right: 0.45em;
  /* Pale codes need an edge, or white on a white card disappears. */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.16);
}
:root[data-theme="light"] .swatch {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.09);
}

/* Two-tone grades read better with the split repeated on the card edge. */
.grade-card, .holding { border-left-color: transparent !important; }
.grade-card::before, .holding::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tone-mix, var(--tone));
}
.holding { position: relative; overflow: hidden; }

.browse-head { margin-bottom: 20px; }

/* The trail. Kept prominent so a screenshot of step three still says which
   grade and size it belongs to. */
.trail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 13px;
  margin-bottom: 15px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  width: fit-content;
  max-width: 100%;
}
:root[data-theme="light"] .trail { background: rgba(27, 24, 19, 0.03); }

.crumb {
  border: none;
  background: none;
  padding: 2px 4px;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 5px;
  transition: 0.14s;
  white-space: nowrap;
}
.crumb:hover { color: var(--text); }
.crumb.grade { color: var(--tone, var(--gold)); }
.crumb.current {
  color: var(--tone, var(--gold-bright));
  cursor: default;
  font-weight: 700;
}
.crumb-sep { color: var(--text-faint); font-size: 0.9rem; }

.browse-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: 0.01em;
  margin-bottom: 4px;
  color: var(--tone, inherit);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.browse-sub { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 15px; }

.item-headline { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.item-size {
  font-size: 0.62em;
  font-weight: 650;
  color: var(--text);
  padding: 3px 12px;
  border-radius: 8px;
  background: var(--tone-soft, rgba(212, 175, 55, 0.14));
  border: 1px solid var(--tone-line, var(--line));
  font-variant-numeric: tabular-nums;
}

/* Step 1 / 2 / 3 indicator */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-right: 16px;
  position: relative;
}
.step:not(:last-child)::after {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--line-soft);
  margin-left: 2px;
}
.step-num {
  width: 21px; height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  font-size: 0.68rem;
  font-weight: 700;
}
.step.done { color: var(--text-dim); }
.step.done .step-num { border-color: var(--tone-line, var(--line)); color: var(--tone, var(--gold)); }
.step.current { color: var(--tone, var(--gold-bright)); }
.step.current .step-num {
  background: var(--tone, var(--gold));
  border-color: transparent;
  color: #0a0b0e;
}
:root[data-theme="light"] .step.current .step-num { color: #ffffff; }

/* ------------------------------------------------------ step 1: grades */

.grade-grid {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}

.grade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 22px 20px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--tone);
  background: linear-gradient(150deg, var(--tone-soft), rgba(12, 14, 19, 0.55));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.18s;
  overflow: hidden;
}
:root[data-theme="light"] .grade-card {
  background: linear-gradient(150deg, var(--tone-soft), #ffffff);
}
.grade-card:hover {
  transform: translateY(-2px);
  border-color: var(--tone-line);
  border-left-color: var(--tone);
  box-shadow: var(--shadow-2);
}
.grade-card:hover .grade-go { opacity: 1; transform: translateX(0); }

.grade-name {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--tone);
}
.grade-figure {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 7px;
}
.grade-figure small { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); }
.grade-meta { font-size: 0.79rem; color: var(--text-dim); }
.grade-flag { position: absolute; top: 15px; right: 15px; }
.grade-go {
  position: absolute;
  right: 17px;
  bottom: 17px;
  color: var(--tone);
  opacity: 0;
  transform: translateX(-4px);
  transition: 0.18s;
}

/* ------------------------------------------------------- step 2: sizes */

.browse-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}
.browse-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.size-grid {
  display: grid;
  gap: 9px;
  /* Wide enough for a mill name and its figure side by side. */
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
}

.size-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 13px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--tone-line);
  background: var(--tone-soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: 0.14s;
}
.size-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--tone);
}
.size-cell.empty {
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-faint);
}
:root[data-theme="light"] .size-cell.empty { background: rgba(27, 24, 19, 0.025); }
.size-cell.empty:hover { border-color: var(--line); }
.size-cell[data-status="low"] { border-color: rgba(224, 145, 47, 0.5); }

.size-mm {
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.size-qty {
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.size-cell.empty .size-qty { color: var(--text-faint); letter-spacing: 0.1em; }

/* Which mills hold this size. Two makes in one cell is the case the owner
   most wants to spot, so that state gets a visible rule, a stronger colour,
   and each mill's share laid out against its name. */
.size-makes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line-soft);
  width: 100%;
}
.size-make {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  min-width: 0;
}
.size-make-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size-make-qty {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

/* With two mills the names become a small table, so they read left-aligned
   against their figures rather than centred. */
.size-makes.multi { border-top-color: var(--tone-line); }
.size-makes.multi .size-make { justify-content: space-between; color: var(--tone); font-weight: 650; }

.size-total-tag {
  margin-left: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

/* ------------------------------------------------------- step 3: stock */

.item-totals {
  display: grid;
  gap: 11px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 17px;
}
.item-total {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
:root[data-theme="light"] .item-total { background: var(--panel); }
.item-total-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 5px;
}
.item-total-value small { font-size: 0.72rem; font-weight: 600; color: var(--text-dim); }

.holding-list { display: flex; flex-direction: column; gap: 10px; }

.holding {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--tone);
  background: linear-gradient(100deg, var(--tone-soft), rgba(14, 16, 21, 0.5) 55%);
  transition: 0.14s;
}
:root[data-theme="light"] .holding {
  background: linear-gradient(100deg, var(--tone-soft), #ffffff 55%);
}
.holding:hover { border-color: var(--tone-line); border-left-color: var(--tone); }

.holding-main { min-width: 0; flex: 1; }
.holding-company {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.holding-meta { font-size: 0.79rem; color: var(--text-dim); }

.holding-figures {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.holding-kg, .holding-pcs { font-size: 1.22rem; font-weight: 700; letter-spacing: -0.02em; }
.holding-kg { color: var(--tone); }
.holding-kg small, .holding-pcs small {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.09em;
  margin-left: 2px;
}
.holding-sep { color: var(--text-faint); font-size: 1.1rem; }

.browse-footer {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
}

:root[data-lay="mobile"] .grade-grid { grid-template-columns: minmax(0, 1fr); }
:root[data-lay="mobile"] .grade-card { padding: 16px 15px; }
:root[data-lay="mobile"] .size-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
:root[data-lay="mobile"] .size-cell { padding: 10px 5px; }
:root[data-lay="mobile"] .item-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
:root[data-lay="mobile"] .item-total { padding: 11px 10px; }
:root[data-lay="mobile"] .item-total-value { font-size: 1.1rem; }
:root[data-lay="mobile"] .holding { padding: 13px 14px; gap: 10px; }
:root[data-lay="mobile"] .holding-figures { width: 100%; justify-content: flex-start; }
:root[data-lay="mobile"] .browse-actions { margin-left: 0; width: 100%; }
:root[data-lay="mobile"] .browse-footer .btn { flex: 1; }
:root[data-lay="mobile"] .step-label { display: none; }
:root[data-lay="mobile"] .step { padding-right: 10px; }

/* --------------------------------------------------------------- pages */

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.page-head .titles { min-width: 0; }
.page-head h1 { margin-bottom: 2px; }
.page-head .sub { color: var(--text-dim); font-size: 0.86rem; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

.card {
  background: linear-gradient(180deg, rgba(23, 26, 34, 0.82), rgba(14, 16, 21, 0.86));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ------------------------------------------------------------- controls */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span,
.label {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.field.req > span::after { content: " *"; color: var(--gold); }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--text);
  background: rgba(8, 9, 13, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-height: 42px;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
  /* background-color, not background: the shorthand would wipe the dropdown
     arrow (a background-image) every time the control took focus. */
  background-color: rgba(10, 12, 16, 0.9);
}
input:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23d4af37' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 11px;
  padding-right: 32px;
}
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.75) sepia(1) saturate(4) hue-rotate(3deg); cursor: pointer; }
textarea { min-height: 74px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--raised); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-gold {
  background: var(--gradient-gold);
  color: #17120a;
  border-color: transparent;
  box-shadow: 0 6px 18px -8px rgba(212, 175, 55, 0.7);
}
.btn-gold:hover { filter: brightness(1.08); background: var(--gradient-gold); }

.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--line-soft); }
.btn-ghost:hover { color: var(--gold-bright); border-color: var(--line-strong); background: rgba(212, 175, 55, 0.07); }

.btn-danger { background: rgba(217, 83, 79, 0.14); color: #f0a5a2; border-color: rgba(217, 83, 79, 0.35); }
.btn-danger:hover { background: rgba(217, 83, 79, 0.24); border-color: rgba(217, 83, 79, 0.6); }

.btn-sm { padding: 6px 11px; min-height: 34px; font-size: 0.8rem; }
.btn-xs { padding: 4px 9px; min-height: 28px; font-size: 0.74rem; border-radius: 6px; }
.btn-block { width: 100%; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.14s;
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip.on {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(224, 145, 47, 0.14));
  border-color: var(--line-strong);
  color: var(--gold-bright);
}

.grid { display: grid; gap: 13px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.ok   { background: rgba(75, 176, 122, 0.15); color: #7fd2a4; border-color: rgba(75, 176, 122, 0.32); }
.pill.low  { background: rgba(224, 145, 47, 0.16); color: #f0b871; border-color: rgba(224, 145, 47, 0.36); }
.pill.nil  { background: rgba(217, 83, 79, 0.17); color: #f0a5a2; border-color: rgba(217, 83, 79, 0.4); }
.pill.info { background: rgba(109, 168, 216, 0.15); color: #93c3e6; border-color: rgba(109, 168, 216, 0.32); }
.pill.gold { background: rgba(212, 175, 55, 0.16); color: var(--gold-bright); border-color: var(--line-strong); }
.pill.dim  { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); border-color: var(--line-soft); }
/* For pills holding a proper name (a mill, a godown) rather than a status word. */
.pill.name { text-transform: none; letter-spacing: 0.01em; font-weight: 600; }

/* --------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 560px;
}
table.data th {
  text-align: left;
  padding: 10px 13px;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 9, 13, 0.45);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}
table.data tbody tr:hover td { background: rgba(212, 175, 55, 0.045); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.r, table.data th.r { text-align: right; }
table.data td.num { font-variant-numeric: tabular-nums; font-family: var(--font-num); }
table.data td.actions { white-space: nowrap; text-align: right; }

.row-in  td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.row-out td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* ------------------------------------------------------------- dashboard */

.stat-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }

.stat {
  position: relative;
  padding: 16px 16px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, rgba(28, 32, 41, 0.85), rgba(13, 15, 20, 0.9));
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-gold);
  opacity: 0.75;
}
.stat.warn::before { background: linear-gradient(90deg, #e0912f, #f0b871); }
.stat.bad::before  { background: linear-gradient(90deg, #d9534f, #f0a5a2); }
.stat-label {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-value small { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); margin-left: 3px; letter-spacing: 0; }
.stat-foot { font-size: 0.76rem; color: var(--text-faint); margin-top: 4px; }

.module-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.module {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 19px 17px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: linear-gradient(155deg, rgba(26, 30, 39, 0.85), rgba(12, 14, 19, 0.9));
  color: var(--text);
  transition: 0.18s;
  overflow: hidden;
}
.module:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2), 0 0 0 1px rgba(212, 175, 55, 0.08);
}
.module-icon {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(212, 175, 55, 0.2), rgba(224, 145, 47, 0.08));
  border: 1px solid var(--line);
  color: var(--gold-bright);
  margin-bottom: 9px;
}
.module strong { font-size: 1rem; font-weight: 650; }
.module span { font-size: 0.81rem; color: var(--text-dim); line-height: 1.4; }
.module-badge {
  position: absolute;
  top: 14px; right: 14px;
}

/* ---------------------------------------------------------- stock groups */

.group {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(14, 16, 21, 0.72);
  margin-bottom: 11px;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(30, 34, 44, 0.75), rgba(16, 18, 24, 0.5));
  border: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}
.group-head:hover { background: linear-gradient(90deg, rgba(38, 43, 55, 0.8), rgba(18, 20, 27, 0.55)); }
.group-title { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; min-width: 0; }
.group-title b { font-size: 0.98rem; letter-spacing: 0.01em; }
.group-title .size {
  font-size: 0.83rem;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--line);
  padding: 1px 8px;
  border-radius: 6px;
}
.group-total {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.group-total .kg { font-size: 1rem; font-weight: 700; }
.group-total .pcs { font-size: 0.8rem; color: var(--text-dim); }
.caret { transition: transform 0.2s; color: var(--text-faint); flex: none; }
.group.open .caret { transform: rotate(90deg); }
.group-body { display: none; border-top: 1px solid var(--line-soft); }
.group.open .group-body { display: block; }

/* --------------------------------------------------------- entry editor */

.item-rows { display: flex; flex-direction: column; gap: 12px; }

.item-row {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 14px;
  background: rgba(10, 12, 16, 0.5);
}
.item-row-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.item-row-num {
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid var(--line);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 700;
}
.item-row-head .avail { margin-left: auto; font-size: 0.76rem; color: var(--text-dim); }
.item-fields { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 9px;
  background: rgba(8, 9, 13, 0.7);
  border: 1px solid var(--line-soft);
}
.seg button {
  padding: 6px 13px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.14s;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--gradient-gold); color: #17120a; box-shadow: var(--shadow-1); }
.seg.transit button.on[data-value="in_transit"] { background: linear-gradient(135deg, #93c3e6, #6da8d8); color: #06121b; }

/* ------------------------------------------------------- stage tracker */

.stages { display: inline-flex; align-items: center; gap: 0; }
.stage {
  position: relative;
  padding: 6px 14px 6px 20px;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  border: 1px solid var(--line-soft);
  border-left: none;
  background: rgba(8, 9, 13, 0.6);
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
  white-space: nowrap;
}
.stage:first-child { border-left: 1px solid var(--line-soft); border-radius: 8px 0 0 8px; padding-left: 14px; }
.stage:last-child { border-radius: 0 8px 8px 0; }
.stage:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.stage:disabled { cursor: default; }
.stage.done { color: var(--gold); background: rgba(212, 175, 55, 0.09); border-color: var(--line); }
.stage.current {
  color: #17120a;
  background: var(--gradient-gold);
  border-color: transparent;
  box-shadow: 0 3px 12px -4px rgba(212, 175, 55, 0.7);
}
.stage.current[data-stage="arrived"] { background: linear-gradient(135deg, #7fd2a4, #4bb07a); color: #04150c; }
.stage.current[data-stage="in_transit"] { background: linear-gradient(135deg, #93c3e6, #6da8d8); color: #06121b; }

/* --------------------------------------------------------------- misc */

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-faint);
}
.empty svg { opacity: 0.35; margin-bottom: 12px; }
.empty h3 { color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }
.empty p { font-size: 0.86rem; max-width: 380px; margin: 0 auto; }

.rule { height: 1px; background: var(--gradient-rule); opacity: 0.4; margin: 20px 0; border: none; }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.banner.warn { background: rgba(224, 145, 47, 0.1); border-color: rgba(224, 145, 47, 0.35); color: #f0c48d; }
.banner.bad  { background: rgba(217, 83, 79, 0.1); border-color: rgba(217, 83, 79, 0.35); color: #f0a5a2; }
.banner.info { background: rgba(109, 168, 216, 0.09); border-color: rgba(109, 168, 216, 0.3); color: #a8cde8; }
.banner strong { display: block; margin-bottom: 2px; }
.banner .banner-action { margin-left: auto; flex: none; }

.spinner {
  width: 26px; height: 26px;
  border: 2px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
  height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* -------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  /* Above .modal-root (100): password and code warnings are raised *by* dialogs,
     so they have to land in front of them. */
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(30, 34, 44, 0.98), rgba(15, 17, 22, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  font-size: 0.87rem;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  backdrop-filter: blur(8px);
}
.toast.ok  { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--bad); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.info { border-left: 3px solid var(--gold); }
.toast strong { display: block; margin-bottom: 1px; }
.toast.leaving { animation: toast-out 0.22s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* -------------------------------------------------------------- modals */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 5, 7, 0.72);
  backdrop-filter: blur(4px);
  animation: fade 0.18s;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(560px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28, 32, 41, 0.99), rgba(13, 15, 20, 0.99));
  box-shadow: var(--shadow-3);
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.25, 1);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { font-size: 1.05rem; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 9, 13, 0.4);
}
.modal.wide { width: min(880px, 100%); }

/* ----------------------------------------------------------- file picker */

.filepick {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 15px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(212, 175, 55, 0.04);
  transition: 0.16s;
}
.filepick.dragover,
.filepick:focus-within {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.09);
}
.filepick.has-file { border-style: solid; }
.filepick input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.filepick-icon {
  width: 40px; height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(150deg, rgba(212, 175, 55, 0.2), rgba(224, 145, 47, 0.08));
  border: 1px solid var(--line);
  color: var(--gold-bright);
}
.filepick-text { min-width: 0; flex: 1; }
.filepick-text strong { display: block; font-size: 0.92rem; font-weight: 600; }
.filepick-text small { color: var(--text-dim); font-size: 0.79rem; }
.filepick-name { color: var(--gold-bright); word-break: break-all; }

/* ---------------------------------------------------------- toggle rows */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-text { min-width: 0; flex: 1; }
.toggle-row .toggle-text strong { display: block; font-size: 0.93rem; font-weight: 600; }
.toggle-row .toggle-text small { color: var(--text-dim); font-size: 0.81rem; line-height: 1.45; display: block; }

.switch {
  position: relative;
  flex: none;
  width: 46px; height: 26px;
  border-radius: 26px;
  border: 1px solid var(--line-soft);
  background: rgba(8, 9, 13, 0.7);
  cursor: pointer;
  transition: 0.18s;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: 0.18s;
}
.switch[aria-checked="true"] { background: var(--gradient-gold); border-color: transparent; }
.switch[aria-checked="true"]::after { left: 22px; background: #17120a; }

/* ------------------------------------------------- password requirements */

.pw-rules { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; }
.pw-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-faint);
  transition: color 0.15s;
}
.pw-rules li::before {
  content: "○";
  font-size: 0.85rem;
  width: 14px;
  text-align: center;
}
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓"; font-weight: 700; }

.pw-meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); margin-top: 11px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width 0.25s, background 0.25s; }

/* ------------------------------------------------------------ 2FA setup */

.qr-frame {
  display: inline-block;
  padding: 11px;
  border-radius: var(--r-md);
  background: #ffffff;
  border: 1px solid var(--line);
  line-height: 0;
}
.qr-frame svg { width: 200px; height: 200px; display: block; }

.secret-box {
  font-family: var(--font-num);
  font-size: 1rem;
  letter-spacing: 0.16em;
  word-break: break-all;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: rgba(8, 9, 13, 0.6);
  border: 1px solid var(--line);
  color: var(--gold-bright);
}
:root[data-theme="light"] .secret-box { background: var(--panel-3); }

.code-input {
  font-family: var(--font-num) !important;
  font-size: 1.5rem !important;
  letter-spacing: 0.42em;
  text-align: center;
  padding-left: 0.42em !important;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 13px 0;
}
.recovery-grid code {
  font-family: var(--font-num);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(8, 9, 13, 0.6);
  border: 1px solid var(--line-soft);
  text-align: center;
}
:root[data-theme="light"] .recovery-grid code { background: var(--panel-3); }

/* -------------------------------------------------------- colour picker */

.colour-grid {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  margin-top: 14px;
}
.colour-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.83rem;
  text-align: left;
  cursor: pointer;
  transition: 0.14s;
}
:root[data-theme="light"] .colour-option { background: rgba(27, 24, 19, 0.03); }
.colour-option:hover { border-color: var(--line); color: var(--text); }
.colour-option.on {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  color: var(--text);
}
.colour-option .swatch { margin-right: 0; }
.colour-label { flex: 1; min-width: 0; line-height: 1.25; }
.colour-taken {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --------------------------------------------------------- theme picker */

.choice-row { display: flex; gap: 9px; flex-wrap: wrap; }
.choice {
  flex: 1 1 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.choice:hover { border-color: var(--line); color: var(--text); }
.choice.on {
  border-color: var(--line-strong);
  background: linear-gradient(150deg, rgba(212, 175, 55, 0.18), rgba(224, 145, 47, 0.06));
  color: var(--gold-bright);
}
.choice svg { opacity: 0.9; }

/* ------------------------------------------------------------ responsive

   Layout is driven by a data-lay attribute on <html> rather than by media
   queries alone, so Settings can pin the desktop or the phone layout on any
   screen. app.js sets data-lay to "desktop", "tablet" or "mobile" from the
   window width, or from the saved override when there is one.
   ------------------------------------------------------------------------ */

:root[data-lay="tablet"] .sidenav,
:root[data-lay="mobile"] .sidenav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    height: auto;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.3, 0.8, 0.3, 1);
  background: linear-gradient(180deg, #14161d, #090a0e);
  box-shadow: var(--shadow-3);
  padding-bottom: calc(24px + var(--tabbar-h));
}
:root[data-theme="light"][data-lay="tablet"] .sidenav,
:root[data-theme="light"][data-lay="mobile"] .sidenav {
  background: linear-gradient(180deg, #ffffff, #f2eee4);
}
:root[data-lay="tablet"] .sidenav.open,
:root[data-lay="mobile"] .sidenav.open { transform: none; }

:root[data-lay="tablet"] .nav-toggle,
:root[data-lay="mobile"] .nav-toggle { display: grid; }

:root[data-lay="tablet"] .scrim,
:root[data-lay="mobile"] .scrim {
  display: block;
  position: fixed;
  inset: var(--topbar-h) 0 0;
  z-index: 44;
  background: rgba(4, 5, 7, 0.6);
  backdrop-filter: blur(2px);
}

/* ---------------------------------------------------------- phone layout */

:root[data-lay="mobile"] body { font-size: 14.5px; }

:root[data-lay="mobile"] .topbar { padding: 0 10px; gap: 8px; }
:root[data-lay="mobile"] .brand-text strong { font-size: 0.82rem; max-width: 30vw; }
:root[data-lay="mobile"] .brand-mark { width: 50px; height: 32px; padding: 4px 5px; }
:root[data-lay="mobile"] .gate-logo { width: 132px; }
:root[data-lay="mobile"] .topbar-right #logout-btn { display: none; }
:root[data-lay="mobile"] .user-meta strong { font-size: 0.76rem; max-width: 22vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-lay="mobile"] .user-meta small { display: none; }

:root[data-lay="mobile"] .main {
  padding: 16px 13px calc(20px + var(--tabbar-h) + env(safe-area-inset-bottom));
}

:root[data-lay="mobile"] .tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 46;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, rgba(14, 16, 21, 0.96), rgba(8, 9, 13, 0.99));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
:root[data-theme="light"][data-lay="mobile"] .tabbar {
  background: rgba(255, 255, 255, 0.97);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
}
.tab:hover { text-decoration: none; }
.tab.active { color: var(--gold-bright); }
.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-gold);
}

:root[data-lay="mobile"] .page-head { margin-bottom: 15px; padding-bottom: 11px; }
:root[data-lay="mobile"] .page-head h1 { font-size: 1.24rem; }
:root[data-lay="mobile"] .page-head .actions { width: 100%; margin-left: 0; }
:root[data-lay="mobile"] .page-head .actions .btn { flex: 1; }

:root[data-lay="mobile"] .grid.c2,
:root[data-lay="mobile"] .grid.c3,
:root[data-lay="mobile"] .grid.c4 { grid-template-columns: minmax(0, 1fr); }
:root[data-lay="mobile"] .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
:root[data-lay="mobile"] .stat { padding: 13px; }
:root[data-lay="mobile"] .stat-value { font-size: 1.4rem; }
:root[data-lay="mobile"] .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
:root[data-lay="mobile"] .module { padding: 15px 13px; }
:root[data-lay="mobile"] .module span { display: none; }
:root[data-lay="mobile"] .module-icon { width: 34px; height: 34px; margin-bottom: 7px; }

:root[data-lay="mobile"] .item-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-lay="mobile"] .item-fields .span2 { grid-column: 1 / -1; }

:root[data-lay="mobile"] .card-body { padding: 13px; }
:root[data-lay="mobile"] .modal-foot { flex-direction: column-reverse; }
:root[data-lay="mobile"] .modal-foot .btn { width: 100%; }
:root[data-lay="mobile"] .toasts {
  left: 13px; right: 13px;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  max-width: none;
}

:root[data-lay="mobile"] table.data { font-size: 0.83rem; min-width: 480px; }
:root[data-lay="mobile"] table.data th,
:root[data-lay="mobile"] table.data td { padding: 9px 10px; }

:root[data-lay="mobile"] .group-head { padding: 11px 12px; }
:root[data-lay="mobile"] .group-total { gap: 8px; }
:root[data-lay="mobile"] .group-total .kg { font-size: 0.92rem; }

/* Forcing the desktop layout onto a narrow screen: let the page scroll
   sideways rather than crushing the columns. */
:root[data-lay="desktop"][data-lay-forced] body { overflow-x: auto; }
:root[data-lay="desktop"][data-lay-forced] .shell { min-width: 1100px; }

@media (max-width: 400px) {
  :root[data-lay="mobile"] .stat-grid,
  :root[data-lay="mobile"] .module-grid { grid-template-columns: minmax(0, 1fr); }
  .stages { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------ print

   Every list can be printed straight from the page. The chrome goes, colour is
   flattened to ink, and tables are allowed to break across pages without
   losing their headings. */
@media print {
  @page { margin: 14mm 10mm; }

  .backdrop, .topbar, .sidenav, .tabbar, .toasts, .modal-root,
  .page-head .actions, .browse-actions, .browse-footer, .scrim,
  .chip-row, .filepick, .steps, .grade-go {
    display: none !important;
  }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10.5pt;
  }
  .shell, .layout, .main { display: block !important; padding: 0 !important; min-width: 0 !important; }

  /* The business name and what is being printed, at the top of every job. */
  .main::before {
    content: "Shreenathji Steel Yard — Stock Book";
    display: block;
    font-size: 13pt;
    font-weight: 700;
    margin-bottom: 2mm;
    padding-bottom: 2mm;
    border-bottom: 1.5pt solid #000;
  }

  .card, .group, .stat, .item-total, .holding, .grade-card, .trail {
    background: #fff !important;
    border: 1pt solid #999 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .card + .card { margin-top: 4mm; }

  h1, h2, h3, .browse-title, .card-head h2 { color: #000 !important; }
  .muted, .faint, .stat-label, .holding-meta, .size-qty { color: #333 !important; }

  table.data { min-width: 0 !important; width: 100% !important; font-size: 9.5pt; }
  table.data thead { display: table-header-group; }   /* repeat headings per page */
  table.data tr { break-inside: avoid; }
  table.data th {
    background: #eee !important;
    color: #000 !important;
    border-bottom: 1pt solid #000 !important;
  }
  table.data td { border-bottom: 0.5pt solid #bbb !important; }
  .table-wrap { overflow: visible !important; }

  /* Status still has to read once the colour is gone. */
  .pill { border: 0.75pt solid #666 !important; color: #000 !important; background: #fff !important; }
  .pill.nil { font-weight: 700; }
  .swatch { box-shadow: inset 0 0 0 0.75pt #000 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  .banner { border: 1pt solid #666 !important; background: #fff !important; color: #000 !important; }
  a[href]::after { content: ""; }
}

/* Keyboard focus stays clearly visible everywhere. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}
