/* ==========================================================================
   Trader Ledger — a market-data-site look (a thin utility strip, a white
   brand bar, a sticky menu bar of drop-down sections) · light + dark.
   Theme is switched by [data-theme="light|dark"] on <html> (see header.php),
   the colour skin by [data-accent] (users.theme).
   ========================================================================== */

/* Noto Sans Tamil, so Tamil (the default language, includes/i18n.php) looks
   the same on every device — many have no Tamil font of their own, or an old
   one. unicode-range keeps a page with no Tamil on it from downloading it, and
   every font stack below names it before the generic family, so the Tamil
   letters in a line fall through to it. SIL Open Font License. */
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-400.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-600.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Tamil";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("../fonts/noto-sans-tamil-700.woff2") format("woff2");
  unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC;
}

/* --------------------------------------------------------------------------
   Design tokens. The base set is the Navy skin (the default) — an exchange
   look: navy bars, a market-orange accent, white surfaces on a cool grey
   page. Every other skin below re-sets the same colour tokens in light and
   in dark, so nothing leaks across the light/dark line. Credit/debit stay
   green/red in every skin — they're accounting semantics, not brand colour.
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  accent-color: var(--brand);

  /* page canvas */
  --bg-1: #f1f4f9;
  --bg-2: #e7ecf4;
  --bg-glow: rgba(29, 79, 156, .10);
  --bg-sun: rgba(240, 129, 30, .08);

  /* surfaces */
  --panel: #ffffff;
  --panel-2: #f3f6fb;              /* table head tint, progress track */
  --border: #d7dfea;
  --row-hover: #edf2fa;

  /* ink */
  --ink: #17223a;
  --muted: #5a6780;

  /* brand + accents */
  --brand: #1d4f9c;
  --brand-2: #163f80;
  --brand-ink: #ffffff;
  --accent: #f0811e;              /* market orange */
  --credit: #12804a;
  --debit: #c62828;

  /* "glass" (kept for the controls that still use it) — near-flat now */
  --glass-bg: rgba(255, 255, 255, .70);
  --glass-brd: rgba(255, 255, 255, .45);
  --glass-hi: rgba(255, 255, 255, .35);

  /* the bars: the menu bar (--side-1) and the strips above and below the page (--side-2) */
  --side-1: #133a75;
  --side-2: #0a2149;
  --side-ink: #e5edf9;
  --side-dim: #a7bbdc;
  --nav-hi: #f0811e;              /* the current menu's underline, the bars' highlights */

  /* table heads: header rows dark like the menu bar, other head cells tinted */
  --thead-bg: var(--side-1);
  --thead-ink: #ffffff;
  --th-bg: color-mix(in srgb, var(--brand) 8%, var(--panel));
  --th-ink: color-mix(in srgb, var(--brand-2) 78%, var(--ink));

  /* shape + depth: squarer and flatter than a glass UI */
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 60, .06);
  --shadow: 0 1px 2px rgba(15, 30, 60, .05), 0 3px 10px rgba(15, 30, 60, .06);
  --shadow-lg: 0 6px 16px rgba(15, 30, 60, .12), 0 20px 44px rgba(15, 30, 60, .14);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --hairline: var(--border);

  --shell-w: 1440px;              /* the page column (and the bars' content) */
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-1: #0b111c;
  --bg-2: #070c15;
  --bg-glow: rgba(107, 158, 240, .10);
  --bg-sun: rgba(245, 154, 60, .05);

  --panel: #111a29;
  --panel-2: #172236;
  --border: #26344a;
  --row-hover: #18253b;

  --ink: #e2e8f2;
  --muted: #93a2b9;

  --brand: #6b9ef0;
  --brand-2: #5589e0;
  --brand-ink: #071530;
  --accent: #f59a3c;
  --credit: #4cc27e;
  --debit: #ef6b62;

  --glass-bg: rgba(255, 255, 255, .05);
  --glass-brd: rgba(255, 255, 255, .14);
  --glass-hi: rgba(255, 255, 255, .10);

  --side-1: #10284f;
  --side-2: #091a35;
  --side-ink: #dbe4f3;
  --side-dim: #8ea3c6;

  --thead-bg: color-mix(in srgb, var(--side-1) 80%, var(--panel));

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 6px 18px rgba(0, 0, 0, .5), 0 24px 56px rgba(0, 0, 0, .6);
}

/* ---- Green (the app's original palette) ---- */
:root[data-accent="green"] {
  --bg-1: #eef4e8; --bg-2: #e0eecf;
  --bg-glow: rgba(63, 157, 74, .16); --bg-sun: rgba(214, 168, 44, .12);
  --panel: #ffffff; --panel-2: #f1f7ea; --border: #d6e3c8; --row-hover: #f1f7ea;
  --ink: #1e2a1f; --muted: #5f7360;
  --brand: #2f7d3a; --brand-2: #23662d; --brand-ink: #ffffff; --accent: #b7791f;
  --glass-bg: rgba(255, 255, 255, .70); --glass-brd: rgba(255, 255, 255, .45); --glass-hi: rgba(255, 255, 255, .35);
  --side-1: #245c2c; --side-2: #153e1c; --side-ink: #dcebda; --side-dim: #9cbf9f;
  --nav-hi: #e9b949;
}
:root[data-theme="dark"][data-accent="green"] {
  --bg-1: #0f1712; --bg-2: #0a110c;
  --bg-glow: rgba(76, 175, 80, .14); --bg-sun: rgba(224, 169, 58, .06);
  --panel: #161f18; --panel-2: #1d2820; --border: #2b3a2e; --row-hover: #1c271e;
  --ink: #e5eee2; --muted: #90a693;
  --brand: #49b657; --brand-2: #3aa247; --brand-ink: #07160a; --accent: #e0a93a;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #173b1e; --side-2: #0b2410; --side-ink: #d2e6d3; --side-dim: #83a888;
}

/* ---- Orange ---- */
:root[data-accent="orange"] {
  --bg-1: #fdf1e2;
  --bg-2: #fbe3c4;
  --bg-glow: rgba(224, 101, 26, .16);
  --bg-sun: rgba(224, 169, 58, .14);

  --panel: #ffffff;
  --panel-2: #fdf0dd;
  --border: #f0d2a8;
  --row-hover: #fdf0dd;

  --ink: #2c1c0e;
  --muted: #8a6a48;

  --brand: #d9691e;
  --brand-2: #b8500f;
  --brand-ink: #ffffff;
  --accent: #b7791f;

  --glass-bg: rgba(255, 255, 255, .30);
  --glass-brd: rgba(255, 255, 255, .60);
  --glass-hi: rgba(255, 255, 255, .60);

  --side-1: #c05f16;
  --side-2: #6e2f08;
  --side-ink: #fbe8d3;
  --side-dim: #d9a679;
}

:root[data-theme="dark"][data-accent="orange"] {
  --bg-1: #1a120a;
  --bg-2: #120c06;
  --bg-glow: rgba(240, 136, 58, .14);
  --bg-sun: rgba(224, 169, 58, .06);

  --panel: #1f150c;
  --panel-2: #271b0f;
  --border: #3a2916;
  --row-hover: #241a0f;

  --ink: #f0e3d3;
  --muted: #b89572;

  --brand: #f0883a;
  --brand-2: #d96a1e;
  --brand-ink: #1a0f04;
  --accent: #e0a93a;

  --glass-bg: rgba(255, 255, 255, .11);
  --glass-brd: rgba(255, 255, 255, .30);
  --glass-hi: rgba(255, 255, 255, .32);

  --side-1: #5c2c0a;
  --side-2: #2a1404;
  --side-ink: #ecd9c2;
  --side-dim: #b98a5e;
}

/* ---- Ocean ---- */
:root[data-accent="ocean"] {
  --bg-1: #eef4fc; --bg-2: #dde9f7;
  --bg-glow: rgba(37, 99, 235, .16); --bg-sun: rgba(14, 165, 233, .10);
  --panel: #ffffff; --panel-2: #eef3fb; --border: #d3e0f0; --row-hover: #eef3fb;
  --ink: #15263c; --muted: #59697e;
  --brand: #2563eb; --brand-2: #1d4ed8; --brand-ink: #ffffff; --accent: #0891b2;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #1e3a8a; --side-2: #10204f; --side-ink: #dbe6fb; --side-dim: #93a9d6;
}
:root[data-theme="dark"][data-accent="ocean"] {
  --bg-1: #0b1220; --bg-2: #060b15;
  --bg-glow: rgba(59, 130, 246, .18); --bg-sun: rgba(14, 165, 233, .07);
  --panel: #101a2b; --panel-2: #16233a; --border: #263850; --row-hover: #17243c;
  --ink: #e2e9f5; --muted: #94a5be;
  --brand: #4f8ef7; --brand-2: #3b7de0; --brand-ink: #04122b; --accent: #22b8d8;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #17295c; --side-2: #0a1434; --side-ink: #d6e2fa; --side-dim: #8296c2;
}

/* ---- Violet ---- */
:root[data-accent="violet"] {
  --bg-1: #f4f0fd; --bg-2: #e7ddf9;
  --bg-glow: rgba(124, 58, 237, .16); --bg-sun: rgba(192, 38, 211, .10);
  --panel: #ffffff; --panel-2: #f4eefc; --border: #e2d6f3; --row-hover: #f4eefc;
  --ink: #251a39; --muted: #6a5e80;
  --brand: #7c3aed; --brand-2: #6d28d9; --brand-ink: #ffffff; --accent: #c026d3;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #4c1d95; --side-2: #2c0f63; --side-ink: #e8ddfb; --side-dim: #b9a6e0;
}
:root[data-theme="dark"][data-accent="violet"] {
  --bg-1: #150f23; --bg-2: #0e0a19;
  --bg-glow: rgba(139, 92, 246, .18); --bg-sun: rgba(217, 70, 239, .07);
  --panel: #181226; --panel-2: #201934; --border: #352a4f; --row-hover: #221b38;
  --ink: #e9e2f6; --muted: #a596bf;
  --brand: #9d6bf5; --brand-2: #8b53ef; --brand-ink: #120428; --accent: #e05ae6;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #3b1d78; --side-2: #1f0d49; --side-ink: #e2d6f9; --side-dim: #a48fce;
}

/* ---- Teal ---- */
:root[data-accent="teal"] {
  --bg-1: #e8f6f3; --bg-2: #d3ece7;
  --bg-glow: rgba(13, 148, 136, .16); --bg-sun: rgba(45, 212, 191, .11);
  --panel: #ffffff; --panel-2: #e8f5f1; --border: #cae4de; --row-hover: #e8f5f1;
  --ink: #11302b; --muted: #4e6f68;
  --brand: #0d9488; --brand-2: #0f766e; --brand-ink: #ffffff; --accent: #d97706;
  --glass-bg: rgba(255, 255, 255, .20); --glass-brd: rgba(255, 255, 255, .50); --glass-hi: rgba(255, 255, 255, .45);
  --side-1: #115e59; --side-2: #0a3b38; --side-ink: #d3ebe7; --side-dim: #8fbdb6;
}
:root[data-theme="dark"][data-accent="teal"] {
  --bg-1: #081614; --bg-2: #04100e;
  --bg-glow: rgba(20, 184, 166, .17); --bg-sun: rgba(45, 212, 191, .07);
  --panel: #0f1e1c; --panel-2: #152826; --border: #254340; --row-hover: #162927;
  --ink: #dcefec; --muted: #8aa9a3;
  --brand: #22c3b2; --brand-2: #16a99a; --brand-ink: #03201d; --accent: #e0a93a;
  --glass-bg: rgba(255, 255, 255, .06); --glass-brd: rgba(255, 255, 255, .16); --glass-hi: rgba(255, 255, 255, .18);
  --side-1: #0e4d49; --side-2: #052b29; --side-ink: #d0ebe7; --side-dim: #7fada7;
}

/* ---- Slate (graphite surfaces, a blue accent for the live bits) ---- */
:root[data-accent="slate"] {
  --bg-1: #f1f3f7; --bg-2: #e3e8ef;
  --bg-glow: rgba(71, 85, 105, .13); --bg-sun: rgba(100, 116, 139, .09);
  --panel: #ffffff; --panel-2: #eef1f6; --border: #dae0e9; --row-hover: #eef1f6;
  --ink: #1b232e; --muted: #5b6673;
  --brand: #475569; --brand-2: #334155; --brand-ink: #ffffff; --accent: #2563eb;
  --glass-bg: rgba(255, 255, 255, .22); --glass-brd: rgba(255, 255, 255, .52); --glass-hi: rgba(255, 255, 255, .48);
  --side-1: #2b3440; --side-2: #161b23; --side-ink: #dde3ec; --side-dim: #9aa6b6;
}
:root[data-theme="dark"][data-accent="slate"] {
  --bg-1: #0c0f14; --bg-2: #07090d;
  --bg-glow: rgba(100, 116, 139, .15); --bg-sun: rgba(148, 163, 184, .06);
  --panel: #14181f; --panel-2: #1b212a; --border: #2c3542; --row-hover: #1c232d;
  --ink: #e4e8ee; --muted: #99a4b3;
  --brand: #94a3b8; --brand-2: #7c8ba1; --brand-ink: #12151b; --accent: #4f8ef7;
  --glass-bg: rgba(255, 255, 255, .05); --glass-brd: rgba(255, 255, 255, .14); --glass-hi: rgba(255, 255, 255, .16);
  --side-1: #232a34; --side-2: #12151b; --side-ink: #dde3ec; --side-dim: #8b96a6;
}

/* the menu bar's highlight, picked to read on each skin's own bar */
:root[data-accent="orange"] { --nav-hi: #ffd58a; }
:root[data-accent="ocean"]  { --nav-hi: #38bdf8; }
:root[data-accent="violet"] { --nav-hi: #f0abfc; }
:root[data-accent="teal"]   { --nav-hi: #fbbf24; }
:root[data-accent="slate"]  { --nav-hi: #60a5fa; }

* { box-sizing: border-box; }

html { scroll-padding-top: 60px; }   /* an anchor lands clear of the sticky menu bar */

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans Tamil", sans-serif;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-1);
}

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

/* smooth theme change */
body, .util-bar, .brand-bar, .main-nav, .panel, .stat, .target-card, .login-box,
table, th, td, input, select, textarea, .btn, .badge {
  transition: background-color .28s ease, border-color .28s ease, color .28s ease, box-shadow .28s ease;
}

/* --------------------------------------------------------------------------
   Shell (header.php / footer.php), top to bottom:
     1. .util-bar   a thin dark strip — the IST clock, the network meter, the
                    language switch and dark mode
     2. .brand-bar  white — where you are, the mandi switcher, the page
                    search, notifications and the user menu
     3. .main-nav   the menu bar: drop-down sections; it sticks to the top
                    while the page scrolls (a drawer on phones, app.js §5)
     4. main.content  the page, in a centred column, under a breadcrumb
     5. .site-footer  a dark band with the credits
   The in-place navigation (app.js §9) only ever replaces main.content.
   -------------------------------------------------------------------------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.shell-wrap { width: 100%; max-width: var(--shell-w); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 300;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}
.skip-link:focus { top: 8px; text-decoration: none; }

/* ---- 1. utility strip ---- */
.util-bar {
  background: var(--side-2);
  color: var(--side-dim);
  font-size: .75rem;
  line-height: 1.2;
}
.util-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 34px; }
.util-left, .util-right { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* the IST clock (ticks in app.js §12): date | time IST */
.ist-clock { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--side-ink); }
.ist-date { font-weight: 600; color: var(--side-dim); }
.ist-time {
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .22);
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;    /* digits don't jiggle as they tick */
}
.ist-tz {
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .625rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--side-2);
  background: var(--nav-hi);
}

/* the network meter (app.js §15): a pill; the dot's colour is data-state */
.net-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--side-ink);
  font: inherit;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.net-meter:hover { background: rgba(255, 255, 255, .12); }
.net-meter:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: 2px; }
.net-row { display: inline-flex; align-items: center; gap: 6px; }
.net-val { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.net-sub { color: var(--side-dim); font-variant-numeric: tabular-nums; }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--side-dim); flex-shrink: 0; }
.net-meter[data-state="good"] .net-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
.net-meter[data-state="ok"]   .net-dot { background: #eab308; box-shadow: 0 0 0 3px rgba(234, 179, 8, .25); }
.net-meter[data-state="bad"]  .net-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .25); }
.net-meter[data-state="wait"] .net-dot { animation: tl-net-pulse 1.2s ease-in-out infinite; }
@keyframes tl-net-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .net-meter[data-state="wait"] .net-dot { animation: none; } }

/* the தமிழ் / English switch and the dark-mode toggle, on the dark strip */
.util-bar .lang-picker {
  margin: 0;
  padding: 2px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
}
.util-bar .lang-picker a { padding: 2px 10px; border-radius: 999px; font-size: .75rem; color: var(--side-dim); }
.util-bar .lang-picker a:hover { color: #fff; }
.util-bar .lang-picker a[aria-current="true"] { background: var(--nav-hi); color: #10131a; box-shadow: none; }
.util-bar .lang-picker a:focus-visible { outline-color: var(--nav-hi); }
.util-bar .theme-switch { margin: 0; gap: 7px; font-size: .75rem; color: var(--side-dim); }
.util-bar .theme-switch:hover { color: #fff; }
.util-bar .theme-switch:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: 3px; border-radius: 4px; }
.util-bar .theme-switch .track { width: 34px; height: 18px; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .26); }
.util-bar .theme-switch .thumb { width: 12px; height: 12px; font-size: .5rem; }
:root[data-theme="dark"] .util-bar .theme-switch .thumb { transform: translateX(16px); }

/* ---- 2. brand bar ---- */
.brand-bar {
  position: relative;
  z-index: 60;                          /* its pop-ups open over the menu bar */
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand-inner { display: flex; align-items: center; gap: 18px; min-height: 76px; padding-top: 10px; padding-bottom: 10px; }

.site-brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none; }
.site-brand:hover { text-decoration: none; }
.site-logo {
  flex: none;
  width: auto;
  height: 52px;
  max-width: 150px;
  object-fit: contain;
  border-radius: 6px;
}
.site-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.site-title {
  font-size: 1.1875rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: color-mix(in srgb, var(--brand-2) 72%, var(--ink));
}
.site-sub {
  font-size: .71875rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* super_admin / secretary: which district + mandi to work in */
.mandi-switcher { display: flex; align-items: flex-end; gap: 10px; flex: none; }
.mandi-switch { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.mandi-switch-label {
  font-size: .65625rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mandi-switch select {
  min-width: 150px;
  max-width: 230px;
  padding: 6px 10px;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
}

/* the page search (app.js §14): finds a menu page by name, in either language */
.finder { position: relative; flex: 1 1 220px; max-width: 380px; margin-left: auto; }
.finder-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.brand-bar .finder-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  font-size: .84375rem;
  background: var(--panel-2);
}
.finder-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  max-height: min(60vh, 380px);
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.finder-list[hidden] { display: none; }
.finder-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
}
.finder-list a:hover,
.finder-list [aria-selected="true"] > a { background: var(--row-hover); color: var(--brand); text-decoration: none; }
.finder-list mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.finder-group { flex: none; font-size: .71875rem; font-weight: 500; color: var(--muted); }
.finder-empty { padding: 10px; font-size: .8125rem; color: var(--muted); }

/* notifications + the user chip */
.user-menu { position: relative; display: flex; align-items: center; gap: 10px; flex: none; }
.brand-bar .notif-bell {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.brand-bar .notif-bell:hover,
.brand-bar .notif-bell[aria-expanded="true"] { transform: none; border-color: var(--brand); color: var(--brand); box-shadow: var(--ring); }
.notif-badge { box-shadow: 0 0 0 2px var(--panel); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--brand); box-shadow: var(--ring); }
.user-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.user-chip .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: .78125rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: var(--side-1);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--nav-hi) 70%, transparent);
}
.chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-chip .name { max-width: 170px; font-size: .8125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-role { font-size: .6875rem; color: var(--muted); white-space: nowrap; }
.user-chip .caret {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .55;
  transition: transform .18s ease;
}
.user-chip[aria-expanded="true"] .caret { transform: translateY(2px) rotate(-135deg); }

/* the pop-ups under the bell and the chip: flat white cards with the orange edge */
.user-pop,
.brand-bar .notif-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 80;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--ink);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
}
.user-pop { min-width: 250px; padding: 8px; }
.user-pop[hidden] { display: none; }
.user-pop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-pop-head .who { font-weight: 700; }
.user-pop-head .role { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.user-pop .profile-link,
.user-pop .logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.user-pop .profile-link { color: var(--ink); }
.user-pop .profile-link:hover { background: var(--row-hover); text-decoration: none; }
.user-pop .logout { color: var(--debit); }
.user-pop .logout:hover { background: color-mix(in srgb, var(--debit) 10%, transparent); text-decoration: none; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-pop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }
  .user-pop:not([hidden]),
  .notif-pop:not([hidden]),
  .finder-list:not([hidden]) { animation: tl-pop .14s ease-out; }
}

/* the phone menu button (hidden on a wide screen) */
.nav-toggle {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .22s ease, opacity .22s ease;
}
.nav-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- 3. the menu bar ---- */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--side-1);
  color: var(--side-ink);
  box-shadow: 0 2px 8px rgba(5, 15, 35, .18);
}
.main-nav > .shell-wrap { padding: 0 12px; }
.drawer-head { display: none; }
.menu { display: flex; flex-wrap: wrap; align-items: stretch; margin: 0; padding: 0; list-style: none; }
.menu-item { position: relative; }
.menu-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  padding: 0 15px;
  border: 0;
  background: none;
  color: var(--side-ink);
  font: inherit;
  font-size: .84375rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.menu-link::after {                    /* the orange underline: the current section, and on hover */
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--nav-hi);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.menu-link:hover,
.menu-item.open > .menu-link { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.menu-item.is-current > .menu-link { color: #fff; background: rgba(255, 255, 255, .07); }
.menu-item.is-current > .menu-link::after,
.menu-link:hover::after,
.menu-item.open > .menu-link::after { transform: none; }
.menu-link:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: -2px; }
.menu-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .75;
  transition: transform .2s ease;
}
.menu-item.open > .menu-btn .menu-caret { transform: translateY(1px) rotate(-135deg); }
.menu-link .menu-count { padding: 0 6px; font-size: .65625rem; line-height: 17px; border: 0; color: #10131a; background: var(--nav-hi); }

/* a section not built yet: its name, greyed out and inert */
.menu-soon > .menu-link { cursor: not-allowed; opacity: .55; }
.menu-soon > .menu-link:hover { background: none; color: var(--side-ink); }
.menu-soon > .menu-link::after { content: none; }
.menu-soon-tag {
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .625rem;
  font-weight: 700;
  line-height: 15px;
}

/* a section's drop-down: a white card hanging from the bar */
.drop {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 70;
  min-width: 250px;
  padding: 12px 8px 8px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
  border-top: 3px solid var(--nav-hi);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;                       /* not merely hidden: a shut card must not widen the page */
}
.menu-item.drop-flip > .drop { left: auto; right: 0; }   /* one that would run off the right edge opens leftwards (app.js §14) */
.menu-item.open > .drop { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .drop { animation: tl-pop .14s ease-out; }
}
@media (min-width: 901px) and (hover: hover) {
  /* a mouse opens a section just by resting on it; a click on a link sets
     .is-leaving so the card shuts at once instead of waiting for the pointer */
  .menu-item.has-drop:hover:not(.is-leaving) > .drop { display: block; }
  .menu-item.has-drop:hover:not(.is-leaving) > .menu-link { background: rgba(255, 255, 255, .09); color: #fff; }
  .menu-item.has-drop:hover:not(.is-leaving) > .menu-link::after { transform: none; }
  .menu-item.has-drop:hover:not(.is-leaving) > .menu-btn .menu-caret { transform: translateY(1px) rotate(-135deg); }
}
.drop-wide { min-width: 470px; }
.drop-wide .drop-links { columns: 2; column-gap: 6px; }
.drop-title {
  margin: 0 4px 6px;
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: .71875rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.drop-links { margin: 0; padding: 0; list-style: none; }
.drop-links li { break-inside: avoid; }
.drop-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: .84375rem;
  font-weight: 500;
  text-decoration: none;
}
.drop-links a::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-top: 1.5px solid var(--muted);
  border-right: 1.5px solid var(--muted);
  transform: rotate(45deg);
}
.drop-links a:hover { background: var(--row-hover); color: var(--brand); text-decoration: none; }
.drop-links a:hover::before { border-color: var(--accent); }
.drop-links a.active {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--brand) 9%, var(--panel));
  color: var(--brand);
  font-weight: 700;
}
.drop-links a.active::before { border-color: var(--accent); }
.drop-links .badge { margin-left: auto; }
/* a page not built yet: its name, greyed out and inert */
.drop-links .drop-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 23px;
  border-left: 3px solid transparent;
  color: var(--muted);
  font-size: .84375rem;
  font-weight: 500;
  cursor: not-allowed;
  opacity: .7;
}
.drop-links .drop-soon .menu-soon-tag { margin-left: auto; }

.nav-backdrop { display: none; }

/* Tamil names run longer: a little less room around each, so the bar keeps to one line */
html[lang="ta"] .menu-link { padding: 0 11px; font-size: .8125rem; }

/* ---- 4. the page ---- */
main.content {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  max-width: var(--shell-w);
  margin: 0 auto;
  padding: 14px 24px 40px;
}
main.content:focus { outline: none; }

/* the breadcrumb at the head of every page: Home › section › page */
.crumbs { margin: 0 0 14px; font-size: .78125rem; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin: 0 10px 0 8px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}
.crumbs a { font-weight: 600; }
.crumbs [aria-current="page"] { font-weight: 600; color: var(--ink); }

/* ---- 5. footer ---- */
.site-footer {
  margin-top: auto;
  background: var(--side-2);
  color: var(--side-dim);
  border-top: 3px solid var(--nav-hi);
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.site-footer .pf-line { font-size: .78125rem; letter-spacing: .02em; }
.site-footer .pf-line strong { color: #fff; font-weight: 700; letter-spacing: .01em; }

/* ---- the bars on narrower screens ---- */
@media (max-width: 1180px) {
  .chip-text { display: none; }
  .user-chip { padding-right: 10px; gap: 8px; }
  .finder { max-width: 300px; }
  .mandi-switch select { min-width: 120px; max-width: 180px; }
}

/* tablets and phones: the menu bar becomes a drawer, the brand bar sticks */
@media (max-width: 900px) {
  .shell-wrap { padding: 0 12px; }

  .util-inner { min-height: 30px; gap: 10px; }
  .util-left, .util-right { gap: 10px; }

  .brand-bar { position: sticky; top: 0; box-shadow: 0 2px 10px rgba(5, 15, 35, .10); }
  .brand-inner { flex-wrap: wrap; gap: 10px; min-height: 58px; padding-top: 7px; padding-bottom: 7px; }
  .nav-toggle { display: inline-flex; }
  .site-brand { flex: 1 1 0; gap: 9px; }
  .site-logo { height: 38px; max-width: 96px; }
  .site-brand-text { padding-left: 9px; border-left-width: 2px; }
  .site-title { font-size: .96875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .site-sub { font-size: .625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .finder { display: none; }
  .user-menu { gap: 8px; }
  .brand-bar .notif-bell { width: 36px; height: 36px; }
  .user-chip { padding: 2px; gap: 0; }
  .user-chip .avatar { width: 32px; height: 32px; }
  .user-chip .caret { display: none; }
  /* the switcher drops to a row of its own under the brand */
  .mandi-switcher {
    order: 3;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    padding-top: 7px;
    border-top: 1px dashed var(--border);
  }
  .mandi-switch select { width: 100%; min-width: 0; max-width: none; font-size: max(16px, 1rem); }

  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(320px, 86vw);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-105%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    box-shadow: none;
  }
  body.nav-open .main-nav { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .35); }
  body.nav-open { overflow: hidden; }
  .main-nav > .shell-wrap { padding: 0; }
  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 18px;
    background: var(--side-2);
    border-bottom: 2px solid var(--nav-hi);
  }
  .drawer-title { font-size: .9375rem; font-weight: 800; color: #fff; }
  .drawer-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 1.375rem;
    line-height: 1;
    cursor: pointer;
  }
  .menu { flex-direction: column; flex-wrap: nowrap; padding: 4px 0 24px; }
  .menu-item { border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .menu-link { width: 100%; height: auto; min-height: 48px; padding: 12px 18px; font-size: .9375rem; white-space: normal; text-align: left; }
  html[lang="ta"] .menu-link { padding: 12px 18px; font-size: .90625rem; }
  .menu-btn .menu-caret { margin-left: auto; }
  .menu-link::after { left: 0; right: auto; top: 0; bottom: 0; width: 3px; height: auto; border-radius: 0; transform: scaleY(0); }
  .menu-link:hover::after { transform: scaleY(0); }
  .menu-item.is-current > .menu-link::after,
  .menu-item.open > .menu-link::after { transform: none; }
  .menu-item.open > .menu-link { background: rgba(0, 0, 0, .14); }
  .drop,
  .drop-wide {
    position: static;
    display: none;
    min-width: 0;
    padding: 0 0 8px;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, .14);
    color: var(--side-ink);
    box-shadow: none;
  }
  .menu-item.drop-flip > .drop { right: auto; }
  .menu-item.open > .drop { display: block; }
  .drop-wide .drop-links { columns: 1; }
  .drop-title { display: none; }
  .drop-links a {
    padding: 11px 18px 11px 30px;
    border-radius: 0;
    font-size: .875rem;
    color: color-mix(in srgb, var(--side-ink) 86%, transparent);
  }
  .drop-links a::before { border-color: var(--side-dim); }
  .drop-links a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .drop-links a.active { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: var(--nav-hi); }
  .drop-links a.active::before, .drop-links a:hover::before { border-color: var(--nav-hi); }
  .drop-links .drop-soon { padding: 11px 18px 11px 43px; font-size: .875rem; color: var(--side-dim); }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(4, 10, 24, .5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .nav-backdrop[hidden] { display: none; }

  main.content { padding: 10px 12px 28px; }
  .crumbs { margin-bottom: 10px; font-size: .75rem; }
  .site-footer-inner { flex-direction: column; text-align: center; padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 760px) {   /* small tablets: the meter is just the dot + speed */
  .net-sub { display: none; }
}
@media (max-width: 640px) {   /* phones: the strip keeps the time, the dot and the switches */
  .ist-date, .ist-tz, .net-val { display: none; }
  .ist-time { padding-left: 0; border-left: 0; }
  .net-meter { padding: 5px; }
  .util-bar .theme-switch .switch-label { display: none; }
}
@media (max-width: 380px) {
  .ist-sec { display: none; }
  .util-bar .lang-picker a { padding: 2px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .main-nav, .menu-link::after, .menu-caret { transition: none; }
}

/* a panel refreshing just its own contents (app.js section 11) — the delay
   means a quick response never visibly dims */
.panel-loading > :not(.toolbar) { opacity: .55; transition: opacity .15s ease .1s; }

h1 { font-size: 1.375rem; margin: 0 0 18px; }
h2 { font-size: 1.0625rem; margin: 24px 0 10px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); }
/* Collapsed borders can't be rounded: Firefox drew the outer edge square with a
   notch of background inside each corner, Chrome clipped it off altogether. So
   the outer edge is hidden (in the collapsed model that hides the edge cells'
   outer borders too) and ::after draws the rounded frame over the cells. */
table.panel-table {
  position: relative;
  border-style: hidden;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.panel-table::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--border);
  border-radius: inherit;
  pointer-events: none;
}
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: .84375rem; }
th {
  background: var(--panel-2);
  font-weight: 600;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}
tr:last-child td { border-bottom: none; }
/* every data table ruled in full: a line between the columns as well as the rows */
table.panel-table th, table.panel-table td { border: 1px solid var(--border); }
tbody tr:hover td, tr:hover td { background: var(--row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A column header that sorts its table (mandies/index.php): reads as a header, not a link. */
th a.th-sort { color: inherit; text-decoration: none; }
th a.th-sort:hover { color: var(--brand); text-decoration: underline; }

/* Dashboard "Traders Pending": the other days a trader is still owed for, folded
   under one line ("+3 more days · ₹…") and opened to list each date. */
details.pending-more > summary { cursor: pointer; list-style: none; }
details.pending-more > summary::-webkit-details-marker { display: none; }
details.pending-more > summary::before { content: "▸"; margin-right: 6px; font-size: .6875rem; color: var(--brand); }
details.pending-more[open] > summary::before { content: "▾"; }
.pending-more-oldest { display: block; margin-left: 17px; font-size: .75rem; color: var(--muted); }
details.pending-more ul { list-style: none; margin: 6px 0 0 17px; padding: 6px 0 0; border-top: 1px dashed var(--border); }
details.pending-more li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 2px 0; font-size: .78125rem; font-variant-numeric: tabular-nums;
}

/* a group of tick boxes with a "Select all" row (report filters) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 7px 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  max-height: 210px;
  overflow-y: auto;
}
.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: .84375rem;
  font-weight: normal;
  color: var(--ink);
  cursor: pointer;
}
.check-grid input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.check-grid .check-all {
  grid-column: 1 / -1;
  font-weight: 600;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* a font size typed on the Reports page, beating every breakpoint's th/td size */
table.report-fs th, table.report-fs td { font-size: var(--report-fs); }

/* grouped reports: the trader header row and its subtotal */
tr.report-section td {
  background: var(--panel-2);
  font-weight: 700;
  padding-top: 12px;
  border-top: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
/* a heading inside a block: the trader's legal name under the commodity */
tr.report-subsection td {
  font-weight: 700;
  padding-top: 8px;
  color: var(--brand);
}
/* the date a report is for, bold at the right of its title (reports/index.php) */
.report-title-date {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tr.report-subtotal td {
  font-weight: 600;
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  border-bottom: 2px solid var(--border);
}
/* the total that closes a whole block, under the sub-blocks it holds */
tr.report-grouptotal td {
  font-weight: 700;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
tr.report-section:hover td, tr.report-subtotal:hover td,
tr.report-grouptotal:hover td { background: var(--row-hover); }

/* Form 24(1). The return reads as a table until somebody presses Edit values;
   only then do the boxes appear. A figure typed over the register is tinted
   either way, so a hand-corrected line is obvious at a glance. */
.f24-table td { padding-top: 4px; padding-bottom: 4px; }
.f24-table .f24-cell { display: none; }
.f24-table.f24-editing .f24-view { display: none; }
.f24-table.f24-editing .f24-cell { display: inline-block; }
.f24-table.f24-editing input[type=checkbox].f24-cell { display: inline-block; width: auto; }

.f24-view.f24-edited {
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 600;
}
/* The always-open CR box: same look as an edit box, on show at all times. */
input.f24-cr {
  padding: 3px 6px;
  font-size: .78125rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: var(--panel);
}
input.f24-cr:focus { border-style: solid; border-color: var(--accent); }
/* a receipt number a refused save found on two traders */
input.f24-cr.f24-clash {
  border-style: solid;
  border-color: var(--danger, #b3261e);
  background: color-mix(in srgb, var(--danger, #b3261e) 10%, transparent);
}

input.f24-cell {
  padding: 3px 6px;
  font-size: .78125rem;
  text-align: right;
  border: 1px solid var(--border);
  background: var(--panel);
}
input.f24-cell[type=text] { text-align: left; }
input.f24-cell:focus { border-color: var(--accent); }
input.f24-cell.f24-edited {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
}

/* The filter row sits under the column titles and scrolls with them. */
.f24-table tr.f24-filters td { padding: 4px 6px; background: var(--panel-2); }
input.f24-filter {
  width: 100%;
  min-width: 5ch;
  padding: 2px 6px;
  font-size: .71875rem;
  font-weight: normal;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
}
/* .form-actions sets display:flex, which beats the UA rule for [hidden] --
   these two are toggled by the edit button, so make the attribute stick. */
#f24SaveBar[hidden], #f24FilterNote[hidden] { display: none !important; }

.f24-toolbar .check-grid { gap: 4px 14px; }
.f24-toolbar .check-grid label { font-size: .78125rem; font-weight: normal; }

/* --------------------------------------------------------------------------
   Badges (glassy tints)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.badge-credit,
.badge-delivered {
  background: color-mix(in srgb, var(--credit) 16%, transparent);
  border-color: color-mix(in srgb, var(--credit) 30%, transparent);
  color: var(--credit);
}
.badge-debit {
  background: color-mix(in srgb, var(--debit) 16%, transparent);
  border-color: color-mix(in srgb, var(--debit) 30%, transparent);
  color: var(--debit);
}
.badge-agent,
.badge-pending {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: color-mix(in srgb, var(--accent) 88%, var(--ink));
}
.badge-cancelled {
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  border-color: color-mix(in srgb, var(--muted) 32%, transparent);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Buttons — frosted glass with a shine sweep
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  z-index: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  vertical-align: middle;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-brd);
  background:
    linear-gradient(180deg, var(--glass-hi), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--brand), var(--brand-2));
  color: var(--brand-ink);
  font-size: .84375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  transition: transform .16s ease, box-shadow .26s ease, filter .2s ease;
}
.btn::before {  /* diagonal glint, sits above the fill but below the label */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, .38) 46%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .6s ease;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06) saturate(1.05);
  text-decoration: none;
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--brand) 42%, transparent),
    inset 0 1px 0 var(--glass-hi);
}
.btn:hover::before { transform: translateX(120%); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-outline {
  background: var(--glass-bg);
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 38%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.btn-outline:hover {
  background: color-mix(in srgb, var(--brand) 14%, var(--glass-bg));
  filter: none;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 26%, transparent);
}

.btn-danger {
  background:
    linear-gradient(180deg, var(--glass-hi), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--debit), color-mix(in srgb, var(--debit) 74%, #000));
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}
.btn-danger:hover {
  box-shadow: 0 8px 24px color-mix(in srgb, var(--debit) 44%, transparent), inset 0 1px 0 var(--glass-hi);
}

.btn-sm { padding: 4px 10px; font-size: .78125rem; }

form.inline { display: inline; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
/* grid items default to min-width:auto, so a wide table (e.g. the dashboard's
   "Outstanding Balances") pushes its track past the viewport. Let tracks shrink
   and long cell text wrap instead. */
.form-grid > * { min-width: 0; }
.form-grid > .panel table.panel-table td,
.form-grid > .panel table.panel-table th { overflow-wrap: anywhere; }
/* ... but the sitewide 560px floor (below) still wins over that unless it's
   lifted here too — otherwise these two-up panels scroll instead of wrapping. */
.form-grid > .panel .table-wrap > table.panel-table { min-width: 0; }
/* A table with too many columns to wrap its way out of trouble (the
   Commodities lists: name, unit, group, default bag, counts, actions) marks
   itself .table-wide and opts back out. Without this, every other column is
   nowrap so the name column is the only one that can give, and "anywhere"
   shreds it a letter at a time — "M u l t i c r o p" down the page. Normal
   word wrapping restores a sane min-content width, and the .table-wrap around
   it (added by tlWrapTables) then scrolls instead of squeezing. */
.form-grid > .panel table.panel-table.table-wide td,
.form-grid > .panel table.panel-table.table-wide th { overflow-wrap: normal; }
.form-grid > .panel .table-wrap > table.panel-table.table-wide { min-width: 620px; }
table.panel-table.table-wide th:first-child,
table.panel-table.table-wide td:first-child { min-width: 140px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field[hidden], .field .hint [hidden] { display: none; }
.field label { font-weight: 600; font-size: .78125rem; color: color-mix(in srgb, var(--ink) 82%, transparent); }
/* the Licence block on Add / Edit Trader (includes/trader_license.php) */
fieldset.license-box {
  min-width: 0;                       /* a fieldset won't shrink below its content otherwise */
  margin: 0;
  padding: 10px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
fieldset.license-box > legend { padding: 0 6px; font-weight: 700; font-size: .8125rem; }
table.kv-table th { width: 190px; text-align: left; }
.license-box .license-sub { margin: 16px 0 8px; font-size: .8125rem; font-weight: 700; }
.license-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.license-row { display: grid; grid-template-columns: 1fr 1fr 1fr 130px auto; gap: 8px; align-items: center; }
.license-row.proof-row { grid-template-columns: 1fr 1.2fr auto; }
.license-row > * { min-width: 0; }
.license-proofs { margin: 0 0 8px; padding-left: 18px; }
.license-proofs li { margin: 2px 0; }
.license-remove { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; font-weight: 400; font-size: .78125rem; }
@media (max-width: 640px) {
  .license-row, .license-row.proof-row { grid-template-columns: 1fr 1fr; }
  .license-row [data-row-remove] { justify-self: start; }
}
.field .hint { font-size: .71875rem; color: var(--muted); }
input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .84375rem;
  font-family: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--brand);
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .84375rem;
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.alert-success {
  background: color-mix(in srgb, var(--credit) 13%, var(--panel));
  border-color: color-mix(in srgb, var(--credit) 38%, transparent);
  color: color-mix(in srgb, var(--credit) 82%, var(--ink));
}
.alert-error {
  background: color-mix(in srgb, var(--debit) 13%, var(--panel));
  border-color: color-mix(in srgb, var(--debit) 38%, transparent);
  color: color-mix(in srgb, var(--debit) 82%, var(--ink));
}
.alert-info {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 36%, transparent);
  color: color-mix(in srgb, var(--brand) 82%, var(--ink));
}

/* eNAM mismatch card on the Dashboard (index.php): one folded line with a red
   edge; opened, a row per day with its problems as pills — red for money,
   amber for lots — and an Open button to that day on the eNAM page. */
.enam-alert {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--debit);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: .84375rem;
}
.enam-alert > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}
.enam-alert > summary::-webkit-details-marker { display: none; }
.enam-alert > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--radius); }
.enam-alert-icon { color: var(--debit); font-size: 1rem; line-height: 1; }
.enam-alert-count { color: var(--muted); }
.enam-alert-toggle { margin-left: auto; color: var(--brand); font-weight: 600; white-space: nowrap; }
.enam-alert-toggle::after { content: " ▾"; }
.enam-alert[open] .enam-alert-toggle::after { content: " ▴"; }
.enam-alert .when-open,
.enam-alert[open] .when-closed { display: none; }
.enam-alert[open] .when-open { display: inline; }
.enam-alert-days { list-style: none; margin: 0; padding: 0; }
.enam-alert-days > li {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
}
.enam-alert-days > li:hover { background: var(--row-hover); }
.enam-alert-days > li.enam-alert-more { display: block; color: var(--muted); }
.enam-alert-date { font-weight: 600; white-space: nowrap; }
.enam-chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 1px 9px;
  border-radius: 99px;
  border: 1px solid transparent;
  font-size: .75rem;
  white-space: nowrap;
}
.enam-chip b { font-variant-numeric: tabular-nums; }
.enam-chip-money {
  background: color-mix(in srgb, var(--debit) 12%, transparent);
  border-color: color-mix(in srgb, var(--debit) 30%, transparent);
  color: color-mix(in srgb, var(--debit) 85%, var(--ink));
}
.enam-chip-lot {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}
.enam-chip-paid {
  background: color-mix(in srgb, var(--credit) 14%, transparent);
  border-color: color-mix(in srgb, var(--credit) 32%, transparent);
  color: color-mix(in srgb, var(--credit) 85%, var(--ink));
}

.enam-chip-ho {   /* held over / re-lotted: nothing to pay */
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border-color: color-mix(in srgb, var(--muted) 30%, transparent);
  color: var(--muted);
}

/* eNAM farmer payments (daily_trade/enam_farmers.php) */
.enam-paybar {   /* share of the day's farmers paid */
  display: inline-block;
  vertical-align: middle;
  width: 72px;
  height: 7px;
  margin-right: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in srgb, var(--debit) 16%, var(--panel-2, var(--panel)));
}
.enam-paybar > span { display: block; height: 100%; border-radius: 99px; background: var(--credit); }
.enam-days tr.is-selected > td { background: color-mix(in srgb, var(--brand) 9%, var(--panel)); }
.enam-days tr.is-selected .enam-day-link { font-weight: 700; }
.enam-farmers td { vertical-align: top; }
.enam-farmers tbody + tbody > tr:first-child > td { border-top: 2px solid var(--border); }
/* a farmer's 2nd, 3rd … lot: its first cell is the lot, not the farmer */
table.panel-table.table-compact.enam-farmers tr + tr > td:first-child { padding-left: 8px; }
table.panel-table.enam-farmers tr + tr:hover > td:first-child { box-shadow: none; }
.enam-farmer { min-width: 150px; }
.enam-days .enam-pick { width: 1%; padding-right: 0; }   /* the tick boxes picking the days listed below */
.enam-pick input { width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer; }
.enam-farmers .enam-date { white-space: nowrap; font-weight: 600; }
.enam-pay { min-width: 240px; line-height: 1.45; }
.enam-pay .enam-chip { margin-bottom: 3px; }

/* eNAM trader payments (daily_trade/enam_trader_payments.php) */
.enam-tp td { vertical-align: top; }
.enam-tp tbody + tbody > tr:first-child > td { border-top: 2px solid var(--border); }
.enam-tp tr.enam-tp-day > td { background: color-mix(in srgb, var(--brand) 7%, var(--panel)); padding-top: 9px; padding-bottom: 9px; }
.enam-tp-daysum { margin-left: 10px; font-variant-numeric: tabular-nums; }
.enam-tp-tdays { min-width: 150px; }
a.enam-chip { text-decoration: none; }
.enam-tp tr.enam-tp-lots > td { padding: 4px 8px 12px 24px; background: var(--panel-2, var(--panel)); }
.enam-tp tr.enam-tp-lots table { margin: 0; }

@media (max-width: 560px) {   /* phones: date + Open on top, the pills under them */
  .enam-alert-days > li { grid-template-columns: 1fr auto; }
  .enam-alert-chips { grid-column: 1 / -1; grid-row: 2; }
}
/* --------------------------------------------------------------------------
   Notification bell (top right, beside the user chip) — see app.js §13.
   -------------------------------------------------------------------------- */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.notif-bell:hover, .notif-bell[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--glass-brd));
  box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.notif-bell:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--debit);
  color: #fff;
  font-size: .65625rem;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 90%, transparent);
}
.notif-badge[hidden] { display: none; }
@keyframes tl-notif-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.notif-badge.is-new { animation: tl-notif-pop .4s ease; }

.notif-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 90vw);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow);
  color: var(--ink);
  transform-origin: top right;
}
.notif-pop[hidden] { display: none; }
.notif-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  flex-shrink: 0;
}
.notif-pop-head a { font-size: .78125rem; font-weight: 600; }
.notif-list { overflow-y: auto; padding: 6px; }
.notif-empty { padding: 20px 14px; text-align: center; color: var(--muted); font-size: .8125rem; }
.notif-item {
  position: relative;
  padding: 8px 28px 8px 10px;
  border-radius: 10px;
  font-size: .8125rem;
}
.notif-item:hover { background: var(--row-hover); }
.notif-item + .notif-item { margin-top: 2px; }
.notif-msg { line-height: 1.4; }
.notif-meta { margin-top: 3px; font-size: .71875rem; color: var(--muted); }
.notif-dismiss {
  position: absolute;
  top: 6px;
  right: 4px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  opacity: .7;
  padding: 2px 6px;
  border-radius: 6px;
}
.notif-dismiss:hover { opacity: 1; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.notif-dismiss:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.notif-item.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity .15s ease, transform .15s ease; }
.notif-pop-foot {
  flex-shrink: 0;
  display: block;
  padding: 10px 14px;
  text-align: center;
  font-size: .78125rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .notif-pop { width: min(320px, 92vw); }
}

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat::after {  /* faint leaf-light corner */
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%);
  pointer-events: none;
}
a.stat { display: block; color: inherit; transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease; }
a.stat:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 22%, transparent);
}
.stat .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 6px; }
.stat .stat-sub { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.stat .stat-sub-ok { color: var(--brand); font-weight: 700; }
.stat .stat-sub + .stat-sub { margin-top: 1px; }
.stat .stat-sub-bad { color: var(--danger, #b3261e); font-weight: 700; }
.stat .stat-sub-warn { color: #b7791f; font-weight: 700; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.search-box input { width: 260px; max-width: 100%; }

/* --------------------------------------------------------------------------
   Commodity chips + checkbox pick-lists (traders <-> commodities)
   -------------------------------------------------------------------------- */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: .75rem;
  line-height: 1.6;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 24%, transparent);
  white-space: nowrap;
}
a.chip:hover { text-decoration: none; color: var(--ink); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.chip-major {
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}
a.chip-major:hover { color: var(--brand-2); }

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 4px 12px;
  max-height: 190px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: .8125rem;
  cursor: pointer;
}
.check-item input { width: auto; margin: 0; }

/* Delete Mandi Data (mandi_data/index.php): one tick box + its note per kind */
.purge-kinds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 20px;
}
.purge-kinds .hint { margin: 2px 0 0 28px; font-size: .71875rem; color: var(--muted); }

/* Message preview block (Send Statements) */
.msg-preview {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Tamil", monospace;
  font-size: .78125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

/* Payment Book — collapsible "By Commodity" groups */
.commodity-groups { margin-bottom: 20px; }
.commodity-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.commodity-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  background: var(--panel-2);
  font-size: .875rem;
}
.commodity-group > summary::-webkit-details-marker { display: none; }
.commodity-group > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .6875rem;
  transition: transform .15s ease;
}
.commodity-group[open] > summary::before { transform: rotate(90deg); }
.commodity-group > summary:hover { background: var(--row-hover); }
.commodity-group .cg-name { font-weight: 600; flex: 1; min-width: 0; }
.commodity-group .cg-meta { color: var(--muted); font-size: .78125rem; white-space: nowrap; }
.commodity-group .cg-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 110px;
  text-align: right;
}
.commodity-group > div { padding: 0 14px 14px; }
.commodity-group table.panel-table { box-shadow: none; }

@media (max-width: 640px) {
  .commodity-group > summary { flex-wrap: wrap; gap: 6px 10px; }
  .commodity-group .cg-total { min-width: 0; }
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-1);   /* the navy band is added in the components layer below */
}
.login-box {
  width: 340px;
  max-width: 100%;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--glass-brd);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
.login-box h1 { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 20px; }
.login-box h1::before { content: "🌿"; font-size: 1.75rem; line-height: 1; margin-bottom: 6px; }
/* the emblem above the title (auth/login.php): replaces the leaf; the JPEG is
   white-backed, so it sits in a white disc that reads in both themes */
.login-logo {
  display: block;
  width: 96px; height: 96px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent), var(--shadow);
}
.login-logo + h1::before { content: none; }
@media (max-width: 480px) { .login-logo { width: 80px; height: 80px; } }
.login-box h1 .brand-name { font-size: 1.625rem; font-weight: 800; line-height: 1.1; letter-spacing: .02em; }
.login-box h1 .brand-sub { font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
/* a long brand (auth/login.php): the state as a ruled kicker, the rest on two balanced lines */
.login-box h1 .brand-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: .78125rem;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--brand);
}
.login-box h1 .brand-kicker::before,
.login-box h1 .brand-kicker::after {
  content: "";
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .7;
}
.login-box h1 .brand-kicker::after { margin-left: -.32em; }   /* eat the last letter's trailing spacing */
.login-box h1 .brand-long { font-size: 1.25rem; line-height: 1.25; letter-spacing: .01em; text-wrap: balance; }
/* login captcha: the image is always a light card, so it reads in both themes */
.captcha-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.captcha-img { display: block; width: 180px; max-width: calc(100% - 48px); height: auto; border-radius: 8px; border: 1px solid var(--border); background: #f6f3e9; }
.captcha-refresh { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); font-size: 1.25rem; line-height: 1; text-decoration: none; color: inherit; }
.captcha-refresh:hover { border-color: var(--muted); }
#captcha { text-transform: uppercase; letter-spacing: .15em; }
#captcha::placeholder { text-transform: none; letter-spacing: normal; }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px;
  font-size: .84375rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a .count { color: var(--muted); font-weight: 400; }
.tabs a.active .count { color: var(--brand); }

/* --------------------------------------------------------------------------
   Progress + target cards
   -------------------------------------------------------------------------- */
.progress {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 9px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%),
    linear-gradient(90deg, var(--brand-2), var(--brand));
  transition: width .6s cubic-bezier(.2, .7, .2, 1);
}
.progress.over > span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%),
    linear-gradient(90deg, color-mix(in srgb, var(--credit) 80%, #000), var(--credit));
}

.target-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.target-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.target-card .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.target-card .value { font-size: 1.25rem; font-weight: 700; margin-top: 4px; }
.target-card .sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.target-card .pct { font-weight: 700; }
.pct-good { color: var(--credit); }
.pct-mid { color: var(--accent); }
.pct-low { color: var(--debit); }

/* --------------------------------------------------------------------------
   Disclosure
   -------------------------------------------------------------------------- */
details.disclosure > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 38%, transparent);
  border-radius: var(--radius);
  background: var(--glass-bg);
  color: var(--brand);
  font-size: .84375rem; font-weight: 600;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; font-size: .6875rem; }
details.disclosure[open] > summary::before { content: "▾"; }
details.disclosure > summary:hover { background: color-mix(in srgb, var(--brand) 12%, var(--glass-bg)); }
details.disclosure[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.disclosure .disclosure-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Theme switch (the top strip + login)
   -------------------------------------------------------------------------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: .75rem;
  color: var(--side-dim);
  cursor: pointer;
  -webkit-user-select: none;   /* Safari still wants the prefix */
  -moz-user-select: none;
  user-select: none;
}
.theme-switch .track {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(128, 128, 128, .28);
  border: 1px solid rgba(128, 128, 128, .4);
  transition: background-color .25s ease;
}
.theme-switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  font-size: .625rem;
  color: #b7791f;
  transition: transform .28s cubic-bezier(.4, .1, .2, 1.5);
}
.theme-switch .thumb::after { content: "☀"; }
.theme-switch:hover .track { background: rgba(128, 128, 128, .4); }

:root[data-theme="dark"] .theme-switch .track { background: color-mix(in srgb, var(--brand) 60%, transparent); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
:root[data-theme="dark"] .theme-switch .thumb { transform: translateX(20px); color: #1f5c2a; }
:root[data-theme="dark"] .theme-switch .thumb::after { content: "☾"; }

/* login page: float it top-right */
.theme-switch.floating {
  position: fixed;
  top: 16px;
  right: 18px;
  color: var(--muted);
  z-index: 10;
}
/* the login page's language switch, opposite the theme toggle */
.lang-picker.floating {
  position: fixed;
  top: 12px;
  left: 18px;
  margin: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
}

/* --------------------------------------------------------------------------
   Scrolling tables, screen-reader text
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap > table.panel-table { min-width: 560px; }
.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;
}

/* ---- page-load bar (in-place navigation) ---- */
.pjax-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
  z-index: 200;
  pointer-events: none;
}
.pjax-bar.run { width: 85%; opacity: 1; transition: width 8s cubic-bezier(0, .7, .2, 1), opacity .1s ease; }
.pjax-bar.done { width: 100%; opacity: 0; transition: width .2s ease, opacity .35s ease .15s; }
@media (prefers-reduced-motion: reduce) {
  .pjax-bar.run, .pjax-bar.done { transition: opacity .1s linear; }
}

/* ---- tablets and phones: single-column forms, stacked toolbars ---- */
@media (max-width: 900px) {
  h1 { font-size: 1.25rem; margin-bottom: 14px; }
  h2 { font-size: 1rem; }
  .panel { padding: 14px; }
  .panel[style*="max-width"] { max-width: none !important; }

  /* forms: one column, no zoom-on-focus on iOS */
  .form-grid, .form-grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; gap: 12px; }
  .form-grid > [style*="grid-column"] { grid-column: auto !important; }
  input, select, textarea { font-size: max(16px, 1rem); padding: 10px 12px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .search-box input { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; text-align: center; }

  /* touch-friendly buttons */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }

  /* toolbar: stack title and actions */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .actions { width: 100%; }
  .toolbar .actions .btn { flex: 1 1 auto; text-align: center; }
  .toolbar form.inline, .toolbar .search-box { width: 100%; }

  .stat-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 1.25rem; }
  .target-row { gap: 10px; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; }

  th, td { padding: 8px 10px; font-size: .8125rem; }
  .table-wrap > table.panel-table { border-radius: 0; }
  .table-wrap { margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .panel > .table-wrap { margin-left: -14px; margin-right: -14px; }
  .login-box { padding: 24px 20px; }
}

/* ---- small phones ---- */
@media (max-width: 480px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .theme-switch.floating { top: 10px; right: 10px; }
  .lang-picker.floating { top: 8px; left: 10px; }
}

/* --------------------------------------------------------------------------
   Motion / print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover { transform: none; }
  a.stat:hover { transform: none; }
}

@media print {
  .util-bar, .brand-bar, .main-nav, .nav-backdrop, .crumbs, .skip-link, .no-print, .theme-switch { display: none !important; }
  main.content { padding: 0; max-width: none; }
  body { background: #fff; }
  .panel, .stat, table.panel-table, .target-card { box-shadow: none; }
  .site-footer { background: none; color: #555; border-top: 1px solid #ccc; }
  .site-footer .pf-line strong { color: #222; }
}

/* ==========================================================================
   Page furniture — headings, stat tiles, panels, motion
   Everything that moves sits inside prefers-reduced-motion: no-preference,
   so the app is still calm for people who ask for that.
   ========================================================================== */

/* ---- page headings: navy, with a short orange rule under them ---- */
main.content > h1,
main.content > .page-head > h1 {
  position: relative;
  padding-bottom: 10px;
  color: color-mix(in srgb, var(--brand-2) 72%, var(--ink));
}
main.content > h1::after,
main.content > .page-head > h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 56px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* a page heading with a button beside it (the dashboard's Daily Log): the
   heading keeps its stripe, the button sits at the right and drops under it
   on a narrow screen */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0 12px; }
.page-head > .btn { flex: none; }

/* the dashboards' Daily Log button (dlog_dashboard_button): filled so it is
   seen at a glance, with today's count under the name; it pulses softly
   while nothing is written for the day */
.btn.dlog-cta { gap: 10px; padding: 9px 18px 9px 14px; text-align: left; font-size: .9375rem;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), inset 0 1px 0 var(--glass-hi); }
.dlog-cta-icon { font-size: 1.5rem; line-height: 1; }
.dlog-cta-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; min-width: 0; }
.dlog-cta-title { font-weight: 800; letter-spacing: .01em; }
.dlog-cta-sub { font-size: .71875rem; font-weight: 600; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlog-cta .badge { margin-left: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .btn.dlog-cta.is-empty { animation: dlog-cta-pulse 2.6s ease-out infinite; }
  .btn.dlog-cta.is-empty:hover { animation: none; }
}
@keyframes dlog-cta-pulse {
  0%   { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%  { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 38%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (max-width: 640px) {
  /* a whole row of its own under the heading, where a thumb finds it */
  .page-head > .dlog-cta, .toolbar .actions > .dlog-cta { flex: 1 1 100%; justify-content: flex-start; margin-bottom: 12px; }
  .toolbar .actions:has(> .dlog-cta) { flex: 1 1 100%; }
}
@media print { .dlog-cta { display: none !important; } }

/* ---- stat tiles: a quote-board tile — the figure big, a brand edge that turns orange on hover ---- */
.stat {
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat .value { font-variant-numeric: tabular-nums; }

/* ---- motion (only when the visitor is fine with it) ---- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes tl-progress-lit {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
    100% { box-shadow: 0 0 0 8px transparent; }
  }

  /* the page content settles in, a few pieces at a time — blocks that app.js
     marked .reveal are left out here and fade in on scroll instead */
  main.content.page-enter > *:not(.reveal) { animation: tl-rise .35s cubic-bezier(.2, .7, .2, 1) both; }
  main.content.page-enter > :nth-child(2) { animation-delay: .04s; }
  main.content.page-enter > :nth-child(3) { animation-delay: .08s; }
  main.content.page-enter > :nth-child(4) { animation-delay: .12s; }
  main.content.page-enter > :nth-child(5) { animation-delay: .16s; }
  main.content.page-enter > :nth-child(n+6) { animation-delay: .2s; }

  /* scroll reveal — app.js adds .reveal to below-the-fold blocks, then
     .reveal-in once they scroll into view */
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .5s cubic-bezier(.2, .7, .2, 1); }
  .reveal.reveal-in { opacity: 1; transform: none; }

  /* progress bars flash their accent as they finish filling */
  .progress.lit { animation: tl-progress-lit .9s ease-out 1; }
}

@media print {
  main.content > h1::after, main.content > .page-head > h1::after { display: none !important; }
  main.content.page-enter > *, .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
}


/* ==========================================================================
   Compact phone layout — tighter spacing everywhere below 900px
   (kept after the general phone rules so it overrides them)
   ========================================================================== */
@media (max-width: 900px) {
  body { font-size: .84375rem; }

  /* page */
  main.content > h1, main.content > .page-head > h1 { font-size: 1.125rem; margin: 0 0 10px; padding-bottom: 7px; }
  main.content > h1::after, main.content > .page-head > h1::after { height: 2px; width: 44px; }
  h2 { font-size: .9375rem; margin: 16px 0 8px; }
  p, .hint, .muted { line-height: 1.35; }

  .panel { padding: 12px; }
  .panel + .panel, .panel + .form-grid, .form-grid + .panel { margin-top: 10px; }

  .toolbar { margin-bottom: 10px; gap: 8px; }
  .toolbar .actions { gap: 6px; }
  .toolbar .actions .btn { flex: 1 1 calc(50% - 6px); }
  .toolbar h1, .toolbar h2 { margin-bottom: 0; }

  .btn { min-height: 36px; padding: 6px 12px; font-size: .8125rem; }
  .btn-sm { min-height: 30px; padding: 3px 9px; font-size: .75rem; }
  .badge { padding: 1px 7px; font-size: .6875rem; }

  /* dashboard */
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
  .stat { padding: 10px 12px; }
  .stat .label { font-size: .65625rem; letter-spacing: .03em; }
  .stat .value { font-size: 1.0625rem; margin-top: 3px; }
  .target-row { gap: 8px; }
  .target-card { padding: 10px 12px; }
  .target-card .label { font-size: .65625rem; }
  .target-card .value { font-size: 1rem; }
  .target-card .sub { font-size: .71875rem; }
  .progress { height: 7px; margin-top: 6px; }

  /* forms */
  .form-grid, .form-grid[style*="grid-template-columns"] { gap: 8px; }
  .field { gap: 3px; }
  .field label { font-size: .75rem; }
  .field .hint { font-size: .6875rem; }
  input, select, textarea { padding: 8px 10px; }   /* 16px font stays: no iOS zoom */
  .form-actions { margin-top: 12px; gap: 8px; }
  .check-grid { gap: 5px 10px; padding: 8px 10px; max-height: 170px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .check-grid label { font-size: .8125rem; gap: 6px; }
  .check-grid .check-all { padding-bottom: 6px; }

  /* tables */
  th, td { padding: 6px 8px; font-size: .78125rem; }
  .table-wrap { margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .panel > .table-wrap { margin-left: -12px; margin-right: -12px; }
  .table-wrap > table.panel-table { min-width: 520px; }
  tr.report-section td { padding-top: 8px; }

  /* alerts, tabs, disclosures */
  .alert { padding: 8px 10px; margin-bottom: 10px; font-size: .8125rem; }
  .tabs a { padding: 8px 10px; font-size: .8125rem; }
  .disclosure > summary { padding: 8px 10px; }

  /* login */
  .login-box { padding: 20px 16px; }
  .login-box h1 { margin-bottom: 14px; }
}

@media (max-width: 480px) {
  body { font-size: .8125rem; }
  main.content { padding-left: 10px; padding-right: 10px; }
  main.content > h1, main.content > .page-head > h1 { font-size: 1.0625rem; }
  .panel { padding: 10px; }
  .stat-row { gap: 6px; }
  .stat { padding: 8px 10px; }
  .stat .value { font-size: 1rem; }
  .toolbar .actions .btn { flex: 1 1 100%; }
  th, td { padding: 5px 7px; font-size: .75rem; }
  .table-wrap { margin-left: -10px; margin-right: -10px; padding: 0 10px; }
  .panel > .table-wrap { margin-left: -10px; margin-right: -10px; }
}

/* ==========================================================================
   Stat cards never overflow — long money values wrap, shrink, or go wide
   ========================================================================== */
.stat { min-width: 0; }                                  /* grid items may shrink below their content */
.stat .value {
  white-space: nowrap;                                   /* one line: app.js shrinks it until it fits */
  overflow-wrap: anywhere;                               /* last resort, once app.js lets it wrap again */
  line-height: 1.15;
}
@media (max-width: 900px) {
  .stat .value { font-size: clamp(.8125rem, 4.6vw, 1.0625rem); }
  .stat.stat-wide { grid-column: 1 / -1; }               /* a long figure takes the whole row (set by footer.php) */
  .stat.stat-wide .value { font-size: clamp(.9375rem, 5.2vw, 1.1875rem); }
}

/* Dashboard Today's Transactions: eight cards, four to a row; on narrow screens
   two to a row with the money cards (.stat-span-sm) across the whole row, and
   dense flow so a card fills any gap a full-row one leaves */
.stat-row.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; }
@media (max-width: 900px) {
  .stat-row.stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row.stat-row-4 .stat-span-sm { grid-column: 1 / -1; }
}
/* Today's and This Month's Transactions side by side: each panel is half the
   width, so its cards go two to a row; below 900px the pair stacks and the
   rules above take over again */
.tx-pair { margin-bottom: 20px; }
.tx-pair > .panel { margin: 0; }
@media (min-width: 901px) {
  .tx-pair .stat-row.stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ==========================================================================
   Combobox — a long <select> turned into a type-to-search field
   (includes/trader_picker.php builds the markup at runtime)
   ========================================================================== */
.combo { position: relative; }
.combo .combo-input { width: 100%; padding-right: 30px; }
/* a picker that shares a row with a button (the upload pages' "Assign trader") */
.combo--inline { display: inline-block; width: 200px; vertical-align: middle; }
.combo-clear {
  position: absolute;
  top: 0;
  right: 0;
  height: 34px;
  width: 28px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.combo-clear:hover { color: var(--ink); }
.combo-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* The list is appended to <body> and placed over its input by the script, so
   a picker inside a scrolling .table-wrap is never clipped by it. */
.combo-list {
  position: fixed;
  z-index: 90;
  left: 0;
  top: 0;
  min-width: 190px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.combo-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .84375rem;
}
.combo-option .who { font-weight: 600; margin-right: auto; min-width: 0; }
.combo-option .note {
  color: var(--muted);
  font-size: .71875rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.combo-option .badge { padding: 1px 7px; font-size: .6875rem; }
.combo-option:hover,
.combo-option.is-active { background: var(--row-hover); }
.combo-option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--brand); }
.combo-option[hidden] { display: none; }   /* display:flex above beats the UA rule, so a filtered-out name stayed listed */
.combo-empty { padding: 10px 9px; color: var(--muted); font-size: .78125rem; }

@media (max-width: 600px) {
  .combo-list { max-height: 240px; }
  .combo-option { padding: 9px; }
  .combo-option .note { font-size: .6875rem; }
}


/* ==========================================================================
   Live search — a `.search-box` field wrapped by includes/footer.php's
   tlLiveSearch() so it filters as you type instead of waiting for Enter.
   ========================================================================== */
.search-wrap {
  position: relative;
  display: inline-flex;
  width: 260px;
  max-width: 100%;
  vertical-align: middle;
}
.search-wrap input { width: 100%; padding-right: 26px; }
.search-clear {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 26px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.search-clear:hover { color: var(--ink); }
.search-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* a small spinner to the left of the clear button while a search is in flight */
.search-wrap.is-searching::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 26px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: tl-search-spin .6s linear infinite;
  pointer-events: none;
}
@keyframes tl-search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .search-wrap.is-searching::after { animation: none; opacity: .6; }
}

@media (max-width: 900px) {
  .search-wrap { width: 100%; }
}


/* ==========================================================================
   Components, market-data style — flat white cards with crisp edges, navy
   header rows, solid buttons, an orange accent for "you are here". Placed
   after the component rules above on purpose: it re-tunes them without
   editing each one, and every skin inherits the same look.
   ========================================================================== */

/* ---- type ---- */
h1, h2, h3 { letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-weight: 800; }
h2 { font-weight: 700; color: color-mix(in srgb, var(--brand-2) 60%, var(--ink)); }
/* a panel's own title gets the orange tick */
.panel > h2:first-child,
.panel > .toolbar:first-child h2 { padding-left: 10px; border-left: 3px solid var(--accent); line-height: 1.25; }
.panel > h2:first-child { margin-top: 0; }

/* ---- panels & cards: flat white, a crisp edge, barely lifted ---- */
.panel, .stat, .target-card, .commodity-group { border-color: var(--border); }
.panel { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.target-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border-top: 3px solid var(--brand); }
.commodity-group { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

.stat {
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--brand);
}
.stat::after { content: none; }
.stat .label { font-size: .6875rem; font-weight: 700; letter-spacing: .06em; color: var(--brand); }
.stat .value { font-weight: 800; color: var(--ink); }
a.stat:hover, .stat:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow), inset 3px 0 0 var(--accent);
  text-decoration: none;
}
/* sizes only on a wide screen: the compact phone rules above keep theirs */
@media (min-width: 901px) {
  h1 { font-size: 1.4375rem; }
  .panel { padding: 20px 22px; }
  .stat { padding: 14px 16px 14px 18px; }
  .stat .value { font-size: 1.5625rem; letter-spacing: -0.02em; margin-top: 6px; }
  .tabs a { padding: 9px 16px; }
}

/* ---- buttons: solid, square-ish, no glass ---- */
.btn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-2);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.btn::before { content: none; }
.btn:hover {
  transform: none;
  filter: none;
  background: var(--brand-2);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn:active { transform: translateY(1px); }
.btn-outline {
  background: var(--panel);
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  box-shadow: none;
}
.btn-outline:hover {
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: none;
}
.btn-danger { background: var(--debit); border-color: color-mix(in srgb, var(--debit) 78%, #000); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--debit) 84%, #000); box-shadow: 0 2px 8px color-mix(in srgb, var(--debit) 32%, transparent); }
.btn-sm { border-radius: var(--radius-sm); }
.btn.dlog-cta { box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---- form controls: crisp edge, a soft focus ring ---- */
input, select, textarea {
  border-radius: var(--radius-sm);
  background: var(--panel);
  border-color: color-mix(in srgb, var(--ink) 18%, transparent);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid transparent;      /* keep a hook for Windows high-contrast mode */
  outline-offset: 2px;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.field label { color: color-mix(in srgb, var(--ink) 78%, transparent); }

/* ---- tables: a dark header row, tinted head cells, light zebra rows ---- */
table.panel-table { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
th {
  background: var(--th-bg);
  color: var(--th-ink);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .71875rem;
  font-weight: 700;
}
/* a header row — in a <thead>, or a first row (and a second under it) that
   holds nothing but <th> — reads like a quote-board head: dark, white text */
thead th { background: var(--thead-bg); color: var(--thead-ink); border-color: color-mix(in srgb, var(--thead-bg) 82%, #fff); }
:is(table > tbody:first-child > tr:first-child:not(:has(> td)),
    table > tbody:first-child > tr:first-child:not(:has(> td)) + tr:not(:has(> td))) > th {
  background: var(--thead-bg);
  color: var(--thead-ink);
  border-color: color-mix(in srgb, var(--thead-bg) 82%, #fff);
}
thead th a,
:is(table > tbody:first-child > tr:first-child:not(:has(> td))) > th a { color: inherit; }
thead th a:hover,
:is(table > tbody:first-child > tr:first-child:not(:has(> td))) > th a:hover { color: inherit; }
/* every other body row a shade darker; zero specificity, so any row class wins */
:where(table.panel-table > tbody > tr:nth-child(even)) > td { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
tbody tr { transition: background-color .12s ease; }
table.panel-table tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ---- badges: flat pills ---- */
.badge { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---- alerts: a strong left edge ---- */
.alert { border-radius: var(--radius); border-left-width: 4px; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---- tabs: navy text, an orange underline on the open one ---- */
.tabs { gap: 0; border-bottom: 2px solid var(--border); }
.tabs a { font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--brand); }
.tabs a.active {
  color: var(--brand);
  border-bottom-color: var(--accent);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
}

/* ---- progress bars: flat ---- */
.progress { border-radius: 99px; }
.progress > span { background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.progress.over > span { background: var(--credit); }

/* ---- disclosure buttons ---- */
details.disclosure > summary {
  border-radius: var(--radius-sm);
  background: var(--panel);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
details.disclosure > summary:hover { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }

/* ---- notifications list ---- */
.notif-item { border-radius: var(--radius-sm); }

/* ---- sign-in page: a navy band across the top, the card over its edge ---- */
.login-wrap {
  background:
    linear-gradient(180deg, var(--side-2), var(--side-1)) top / 100% 42% no-repeat,
    var(--bg-1);
}
.login-box {
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--panel);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: var(--shadow-lg);
}
.login-box h1 .brand-name { color: color-mix(in srgb, var(--brand-2) 72%, var(--ink)); }
.login-logo { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow); }
.theme-switch.floating { color: var(--side-ink); }
.lang-picker.floating { background: color-mix(in srgb, var(--panel) 92%, transparent); }


/* ==========================================================================
   Gloss — a lacquered finish over the market-data look: the bars and table
   heads catch light along their top half, buttons are glossy with a glint
   that sweeps across on hover, cards, drop-downs and pop-ups carry a soft top
   sheen and a catch-light along their edge (stat tiles get a sweep too), and
   the sign-in card is frosted glass. Every highlight is a token, turned down
   for dark mode so nothing glares. (The menus stay solid: frosted glass over
   a page of figures lets them show through.)
   ========================================================================== */
:root {
  --gloss-hi: rgba(255, 255, 255, .70);      /* the soft top sheen on light surfaces */
  --gloss-edge: rgba(255, 255, 255, .90);    /* the 1px catch-light along a top edge */
  --sheen: rgba(255, 255, 255, .55);         /* the band that sweeps across on hover */
  --btn-gloss: rgba(255, 255, 255, .32);     /* the glossy top half of a solid button */
  --btn-text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  /* the split highlight on a dark bar: bright top half, a crisp line, a deeper foot */
  --bar-gloss: linear-gradient(180deg, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, .06) 49%, rgba(255, 255, 255, 0) 51%, rgba(0, 0, 0, .12) 100%);
}
:root[data-theme="dark"] {
  --gloss-hi: rgba(255, 255, 255, .06);
  --gloss-edge: rgba(255, 255, 255, .09);
  --sheen: rgba(255, 255, 255, .10);
  --btn-gloss: rgba(255, 255, 255, .20);
  --btn-text-shadow: none;
  --bar-gloss: linear-gradient(180deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .03) 49%, rgba(255, 255, 255, 0) 51%, rgba(0, 0, 0, .18) 100%);
}

/* ---- the strips and the brand bar ---- */
.util-bar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--side-2), #fff 7%), var(--side-2));
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06);
}
.brand-bar {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 45%, color-mix(in srgb, var(--brand) 5%, var(--panel)) 100%);
  box-shadow: inset 0 1px 0 var(--gloss-edge);
}
.site-brand-text { border-image: linear-gradient(180deg, color-mix(in srgb, var(--accent), #fff 40%), var(--accent)) 1; }
.site-logo { filter: drop-shadow(0 2px 4px rgba(15, 30, 60, .18)); }
.site-footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 60%), var(--side-2);
  box-shadow: 0 -2px 14px color-mix(in srgb, var(--nav-hi) 28%, transparent);
}

/* glossy chips on the dark strip */
.ist-tz,
.util-bar .lang-picker a[aria-current="true"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%), var(--nav-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 3px rgba(0, 0, 0, .35);
}
.util-bar .lang-picker,
.net-meter { background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10); }
.util-bar .theme-switch .track { background-image: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%); }

/* the round buttons in the brand bar: glossy white, a catch-light on top */
.brand-bar .notif-bell,
.user-chip,
.nav-toggle {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 40%, color-mix(in srgb, var(--brand) 8%, var(--panel)) 100%);
  box-shadow: inset 0 1px 0 var(--gloss-edge), 0 1px 3px rgba(15, 30, 60, .10);
}
.user-chip .avatar {
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 52%),
    linear-gradient(160deg, color-mix(in srgb, var(--side-1), #fff 22%), var(--side-1) 70%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--nav-hi) 70%, transparent), 0 2px 6px rgba(15, 30, 60, .25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
.notif-badge,
.menu-link .menu-count {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 62%);
}
.notif-badge { box-shadow: 0 0 0 2px var(--panel), 0 2px 5px color-mix(in srgb, var(--debit) 45%, transparent); }

/* the page search's list, the bell's and the chip's pop-ups: glossy cards */
.finder-list,
.user-pop,
.brand-bar .notif-pop {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 90px),
    linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--brand) 4%, var(--panel)));
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--gloss-edge);
}

/* ---- the menu bar: glossy navy, a glowing underline, glossy drop-downs ---- */
.menu-link::after {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nav-hi), #fff 45%), var(--nav-hi));
  box-shadow: 0 0 10px color-mix(in srgb, var(--nav-hi) 75%, transparent);
}
@media (min-width: 901px) {
  .main-nav {
    background: var(--bar-gloss), linear-gradient(180deg, color-mix(in srgb, var(--side-1), #fff 6%), var(--side-1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(0, 0, 0, .28), 0 4px 14px rgba(5, 15, 35, .24);
  }
  .menu-link { text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
  .menu-link:hover,
  .menu-item.open > .menu-link {
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 50%, rgba(255, 255, 255, .02));
  }
  .menu-item.is-current > .menu-link {
    background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .08) 50%, rgba(0, 0, 0, .06));
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, .10), inset -1px 0 0 rgba(255, 255, 255, .10);
  }
  .drop {
    background:
      linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 90px),
      linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--brand) 4%, var(--panel)));
    box-shadow: var(--shadow-lg), inset 0 1px 0 var(--gloss-edge);
  }
  .drop-links a:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 10%, transparent), color-mix(in srgb, var(--brand) 4%, transparent)); }
}
@media (min-width: 901px) and (hover: hover) {
  .menu-item.has-drop:hover:not(.is-leaving) > .menu-link {
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 50%, rgba(255, 255, 255, .02));
  }
}
@media (max-width: 900px) {
  /* the drawer: a deep lacquered panel, lit from the top */
  .main-nav {
    background:
      radial-gradient(420px 220px at 20% 0%, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 70%),
      linear-gradient(180deg, var(--side-1), color-mix(in srgb, var(--side-1), #000 22%));
  }
  .drawer-head { background: var(--bar-gloss), var(--side-2); }
  .brand-bar { box-shadow: inset 0 1px 0 var(--gloss-edge), 0 2px 10px rgba(5, 15, 35, .10); }
}

/* ---- buttons: glossy top half, a glint on hover ---- */
.btn {
  background:
    linear-gradient(180deg, var(--btn-gloss) 0%, rgba(255, 255, 255, .08) 48%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand), #fff 10%), var(--brand-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .35),
    inset 0 -1px 0 rgba(0, 0, 0, .14),
    0 1px 2px rgba(15, 30, 60, .16),
    0 3px 8px color-mix(in srgb, var(--brand) 22%, transparent);
  text-shadow: var(--btn-text-shadow);
}
.btn::before { content: ""; }        /* the diagonal glint from the base button rule */
.btn:hover {
  background:
    linear-gradient(180deg, var(--btn-gloss) 0%, rgba(255, 255, 255, .10) 48%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand), #fff 18%), var(--brand));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .40),
    inset 0 -1px 0 rgba(0, 0, 0, .14),
    0 4px 14px color-mix(in srgb, var(--brand) 36%, transparent);
}
.btn:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .22); }
.btn-outline {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--brand) 7%, var(--panel)));
  box-shadow: inset 0 1px 0 var(--gloss-edge), 0 1px 2px rgba(15, 30, 60, .08);
  text-shadow: none;
}
.btn-outline:hover {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, var(--panel)), color-mix(in srgb, var(--brand) 14%, var(--panel)));
  box-shadow: inset 0 1px 0 var(--gloss-edge), 0 3px 10px color-mix(in srgb, var(--brand) 20%, transparent);
}
.btn-outline::before { background: linear-gradient(115deg, transparent 22%, color-mix(in srgb, var(--brand) 14%, transparent) 46%, transparent 62%); }
.btn-danger {
  background:
    linear-gradient(180deg, var(--btn-gloss) 0%, rgba(255, 255, 255, .08) 48%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--debit), #fff 10%), color-mix(in srgb, var(--debit), #000 12%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .16), 0 2px 6px color-mix(in srgb, var(--debit) 28%, transparent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.btn-danger:hover {
  background:
    linear-gradient(180deg, var(--btn-gloss) 0%, rgba(255, 255, 255, .10) 48%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--debit), #fff 18%), var(--debit));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 4px 14px color-mix(in srgb, var(--debit) 36%, transparent);
}
details.disclosure > summary {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--brand) 7%, var(--panel)));
  box-shadow: inset 0 1px 0 var(--gloss-edge), 0 1px 2px rgba(15, 30, 60, .08);
}

/* ---- cards: a soft sheen across the top, a catch-light along the edge ---- */
.panel,
.commodity-group {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--brand) 5%, transparent), rgba(255, 255, 255, 0) 140px);
  box-shadow: var(--shadow), inset 0 1px 0 var(--gloss-edge);
}
.target-card {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 3%, var(--panel)), color-mix(in srgb, var(--brand) 9%, var(--panel)));
  box-shadow: var(--shadow), inset 0 1px 0 var(--gloss-edge);
}
.commodity-group > summary { background: linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 60%), var(--panel-2); }
.panel > h2:first-child,
.panel > .toolbar:first-child h2 { border-image: linear-gradient(180deg, color-mix(in srgb, var(--accent), #fff 40%), var(--accent)) 1; }
main.content > h1::after,
main.content > .page-head > h1::after {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent), #fff 45%));
  box-shadow: 0 1px 6px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* stat tiles: glossy, and a band of light sweeps across on hover */
.stat {
  background:
    linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 3%, var(--panel)), color-mix(in srgb, var(--brand) 10%, var(--panel)));
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--brand), inset 0 1px 0 var(--gloss-edge);
}
a.stat:hover, .stat:hover {
  box-shadow: var(--shadow), inset 3px 0 0 var(--accent), inset 0 1px 0 var(--gloss-edge),
    0 8px 22px color-mix(in srgb, var(--brand) 16%, transparent);
}
.stat::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: 55%;
  height: auto;
  border-radius: 0;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0), var(--sheen) 50%, rgba(255, 255, 255, 0));
  transform: translateX(-170%) skewX(-14deg);
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
}
.stat:hover::after { transform: translateX(260%) skewX(-14deg); }

/* ---- tables: the dark header row is glossy too ---- */
thead th,
:is(table > tbody:first-child > tr:first-child:not(:has(> td)),
    table > tbody:first-child > tr:first-child:not(:has(> td)) + tr:not(:has(> td))) > th {
  background-image: var(--bar-gloss);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .28);
}
th { background-image: linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 70%); }

/* ---- badges, alerts, tabs ---- */
.badge {
  background-image: linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 65%);
  box-shadow: inset 0 1px 0 var(--gloss-edge);
}
.alert {
  background-image: linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 70%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--gloss-edge);
}
.tabs a.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 14%, transparent), color-mix(in srgb, var(--brand) 3%, transparent));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  box-shadow: inset 0 1px 0 var(--gloss-edge);
}

/* ---- progress bars: a glossy fill with a sheen running along it ---- */
.progress {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 9%, var(--panel-2)), var(--panel-2));
  box-shadow: inset 0 1px 2px rgba(15, 30, 60, .14);
}
.progress > span {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
    linear-gradient(90deg, var(--brand-2), var(--brand));
}
.progress.over > span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
    var(--credit);
}
.progress > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, 0) 80%);
  transform: translateX(-100%);
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-sheen {
    0%        { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
  }
  .progress > span::after { animation: tl-sheen 2.8s ease-in-out infinite; }
}

/* ---- sign-in: a lit navy band, the card frosted glass ---- */
.login-wrap {
  background:
    radial-gradient(900px 320px at 22% -12%, rgba(255, 255, 255, .20), rgba(255, 255, 255, 0) 62%) top / 100% 42% no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 55%) top / 100% 42% no-repeat,
    linear-gradient(180deg, var(--side-2), var(--side-1)) top / 100% 42% no-repeat,
    var(--bg-1);
}
.login-box {
  background: linear-gradient(180deg, var(--gloss-hi), rgba(255, 255, 255, 0) 140px), color-mix(in srgb, var(--panel) 90%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--gloss-edge);
}

@media print {
  .panel, .stat, .target-card, .alert, .badge, th { background-image: none !important; }
  .stat::after, .progress > span::after { display: none !important; }
}


/* ==========================================================================
   Typography — fluid and adjustable
   Every font size in this file is in rem, and the root size is set here: 16px
   up to a 1280px-wide window, growing gently to 18px at 2560px. It starts
   from the browser's own default size (so a reader who set a bigger one gets
   bigger text everywhere) and is multiplied by the A− / A / A+ choice in the
   top strip (--fs-scale, app.js section 20). Headings and the stat figures
   flow between their phone and desktop sizes instead of jumping.
   ========================================================================== */
:root { --fs-scale: 1; }
:root[data-fs="sm"] { --fs-scale: .9; }
:root[data-fs="lg"] { --fs-scale: 1.12; }
html { font-size: calc(clamp(1rem, .875rem + .15625vw, 1.125rem) * var(--fs-scale)); }
body { line-height: 1.55; font-optical-sizing: auto; }
html[lang="ta"] body { line-height: 1.65; }          /* Tamil letters stack taller */
h1, h2, h3 { line-height: 1.25; text-rendering: optimizeLegibility; }
p, li, .hint { text-wrap: pretty; }
h1,
main.content > h1,
main.content > .page-head > h1 { font-size: clamp(1.125rem, .95rem + .7vw, 1.5rem); }
h2 { font-size: clamp(.95rem, .88rem + .28vw, 1.125rem); }
.stat .value { font-size: clamp(1.05rem, .85rem + .85vw, 1.6rem); }

/* A− / A / A+ on the dark strip */
.fs-picker {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}
.fs-picker button {
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--side-dim);
  font-family: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.fs-picker button[data-fs="sm"] { font-size: 11px; }   /* px: the control keeps its size whatever size it sets */
.fs-picker button[data-fs="md"] { font-size: 12.5px; }
.fs-picker button[data-fs="lg"] { font-size: 14px; }
.fs-picker button:hover { color: #fff; }
.fs-picker button[aria-pressed="true"] {
  color: #10131a;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%), var(--nav-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 3px rgba(0, 0, 0, .35);
}
.fs-picker button:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: 2px; }
@media (max-width: 480px) { .fs-picker { display: none; } }   /* a phone has its own text-size setting */


/* ==========================================================================
   Depth — soft layered shadows, 3D cards, pressable buttons
   ========================================================================== */
/* elevation: a tight contact shadow under a wide, faint ambient one */
:root {
  --shadow-sm: 0 1px 1px rgba(15, 30, 60, .04), 0 2px 5px rgba(15, 30, 60, .05);
  --shadow: 0 1px 2px rgba(15, 30, 60, .04), 0 3px 8px rgba(15, 30, 60, .05), 0 12px 26px -8px rgba(15, 30, 60, .10);
  --shadow-lg: 0 2px 4px rgba(15, 30, 60, .05), 0 10px 22px rgba(15, 30, 60, .09), 0 30px 60px -14px rgba(15, 30, 60, .20);
}
:root[data-theme="dark"] {
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, .35), 0 2px 5px rgba(0, 0, 0, .30);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .30), 0 14px 30px -8px rgba(0, 0, 0, .45);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .45), 0 14px 28px rgba(0, 0, 0, .40), 0 34px 70px -14px rgba(0, 0, 0, .65);
}

/* stat tiles and target cards lean towards the pointer (app.js section 22),
   a glare following it across the face */
.target-card { position: relative; overflow: hidden; }
.stat, .target-card { isolation: isolate; }
.stat::before,
.target-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;                         /* over the card's face, under its words */
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--gx, 50%) var(--gy, 0%), var(--sheen), rgba(255, 255, 255, 0) 65%);
  opacity: 0;
  transition: opacity .25s ease;
}
.stat.is-tilting::before,
.target-card.is-tilting::before { opacity: 1; }
a.stat.is-tilting,
.stat.is-tilting,
.target-card.is-tilting {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
  transition: transform .08s linear, box-shadow .2s ease, border-color .2s ease;
  box-shadow: var(--shadow-lg), inset 3px 0 0 var(--accent), inset 0 1px 0 var(--gloss-edge);
}
.target-card.is-tilting { box-shadow: var(--shadow-lg), inset 0 1px 0 var(--gloss-edge); }
a.stat:active,
a.stat.is-tilting:active { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(.98); }

/* buttons sit on a darker lip and press down into it */
.btn {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .35),
    inset 0 -1px 0 rgba(0, 0, 0, .14),
    0 2px 0 color-mix(in srgb, var(--brand-2), #000 30%),
    0 4px 10px color-mix(in srgb, var(--brand) 22%, transparent);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .40),
    inset 0 -1px 0 rgba(0, 0, 0, .14),
    0 3px 0 color-mix(in srgb, var(--brand-2), #000 30%),
    0 8px 18px color-mix(in srgb, var(--brand) 32%, transparent);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .22), 0 0 0 color-mix(in srgb, var(--brand-2), #000 30%);
}
.btn-outline { box-shadow: inset 0 1px 0 var(--gloss-edge), 0 2px 0 color-mix(in srgb, var(--brand) 22%, var(--border)), 0 3px 8px rgba(15, 30, 60, .06); }
.btn-outline:hover { box-shadow: inset 0 1px 0 var(--gloss-edge), 0 3px 0 color-mix(in srgb, var(--brand) 30%, var(--border)), 0 6px 14px color-mix(in srgb, var(--brand) 18%, transparent); }
.btn-danger { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .16), 0 2px 0 color-mix(in srgb, var(--debit), #000 35%), 0 4px 10px color-mix(in srgb, var(--debit) 26%, transparent); }
.btn-danger:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 3px 0 color-mix(in srgb, var(--debit), #000 35%), 0 8px 18px color-mix(in srgb, var(--debit) 34%, transparent); }
.btn-outline:active,
.btn-danger:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .18); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .65; transform: none; }

/* a submit button while its form is on its way (app.js section 9): a spinner in place of the label */
.btn.is-busy { color: transparent; text-shadow: none; pointer-events: none; opacity: 1; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  animation: tl-spin .7s linear infinite;
}
.btn-outline.is-busy::after { border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-top-color: var(--brand); }
@keyframes tl-spin { to { transform: rotate(360deg); } }

/* the brand mark turns a little towards you on hover */
.site-logo { transition: transform .35s cubic-bezier(.2, .8, .2, 1.2), filter .35s ease; }
.site-brand:hover .site-logo {
  transform: perspective(500px) rotateY(-14deg) rotateX(4deg) scale(1.05);
  filter: drop-shadow(5px 6px 8px rgba(15, 30, 60, .25));
}

/* a drop-down unfolds from the bar, like a card swung down */
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  @keyframes tl-unfold {
    from { opacity: 0; transform: perspective(800px) rotateX(-14deg) translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }
  .drop { transform-origin: 50% 0; animation: tl-unfold .22s cubic-bezier(.2, .8, .2, 1); }
}


/* ==========================================================================
   Microinteractions — small replies to what you just did
   ========================================================================== */
/* a ring of light from where a control was pressed (app.js section 23) */
.btn, .tabs a, .menu-link, .drop-links a, .user-chip, .fs-picker button, .to-top, .quick-add-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.ripple {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: currentColor;
  opacity: .22;
  pointer-events: none;
  transform: scale(0);
  animation: tl-ripple .6s ease-out forwards;
}
@keyframes tl-ripple { to { transform: scale(1); opacity: 0; } }

/* the field you are typing in names itself */
.field > label { transition: color .15s ease; }
.field:focus-within > label { color: var(--brand); }

/* links and menu entries answer the pointer */
.drop-links a::before { transition: transform .18s ease, border-color .18s ease; }
.drop-links a:hover::before { transform: translateX(3px) rotate(45deg); }
.crumbs a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .25s ease;
}
.crumbs a:hover { text-decoration: none; background-size: 100% 1px; }
.user-chip .avatar { transition: transform .25s cubic-bezier(.2, .8, .2, 1.4), box-shadow .2s ease; }
.user-chip:hover .avatar { transform: rotate(-8deg) scale(1.06); }
.menu-caret { transition: transform .25s cubic-bezier(.2, .8, .2, 1.4); }

@media (prefers-reduced-motion: no-preference) {
  /* a tick box pops as it is ticked */
  @keyframes tl-tick {
    0%   { transform: scale(.8); }
    60%  { transform: scale(1.18); }
    100% { transform: none; }
  }
  input[type="checkbox"]:checked,
  input[type="radio"]:checked { animation: tl-tick .28s cubic-bezier(.2, .8, .2, 1.4); }

  /* the bell rings when a new notice arrives (app.js section 13 marks the badge .is-new) */
  @keyframes tl-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(9deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(3deg); }
  }
  .notif-bell:has(.notif-badge.is-new) svg { transform-origin: 50% 3px; animation: tl-ring .8s ease; }
}


/* ==========================================================================
   Back to the top — the round button bottom right (footer.php, app.js §21):
   it rises in once the page is scrolled, its ring filling as you read
   ========================================================================== */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  background: var(--bar-gloss), linear-gradient(160deg, color-mix(in srgb, var(--side-1), #fff 12%), var(--side-1));
  box-shadow: 0 6px 16px rgba(5, 15, 35, .28), 0 2px 4px rgba(5, 15, 35, .20), inset 0 1px 0 rgba(255, 255, 255, .25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(.85);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1.2), box-shadow .2s ease, visibility 0s linear .3s;
}
.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1.25), box-shadow .2s ease, visibility 0s;
}
.to-top.is-shown:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(5, 15, 35, .32), 0 0 0 4px color-mix(in srgb, var(--nav-hi) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.to-top.is-shown:active { transform: translateY(0) scale(.94); }
.to-top:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: 3px; }
.to-top-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top-ring circle { fill: none; stroke-width: 3; }
.to-top-track { stroke: rgba(255, 255, 255, .18); }
.to-top-fill {
  stroke: var(--nav-hi);
  stroke-linecap: round;
  transition: stroke-dashoffset .1s linear;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--nav-hi) 70%, transparent));
}
.to-top-arrow { position: relative; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-nudge-up { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }
  .to-top:hover .to-top-arrow { animation: tl-nudge-up .7s ease infinite; }
}
@media (max-width: 900px) { .to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; } }
@media print { .to-top { display: none !important; } }


/* ==========================================================================
   Quick add — the round + on Commodities (commodities/index.php, app.js §25).
   Hovering it, focusing it from the keyboard or tapping it fans out a jump
   to each Add form. It sits in the corner while back-to-top is hidden and
   rises clear of it once that shows.
   ========================================================================== */
.quick-add {
  position: fixed;
  right: 22px;
  bottom: 84px;                 /* above .to-top: 22px + its 48px + a gap */
  z-index: 45;
  display: flex;
  flex-direction: column-reverse;   /* the button first for Tab, the list drawn above it */
  align-items: flex-end;
  pointer-events: none;         /* only the button and the open list catch the pointer */
  transition: bottom .3s cubic-bezier(.2, .8, .2, 1.2);
}
body:has(.to-top:not(.is-shown)) .quick-add { bottom: 22px; }
.quick-add-btn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  background: var(--bar-gloss), linear-gradient(160deg, color-mix(in srgb, var(--accent), #fff 14%), var(--accent));
  box-shadow: 0 6px 16px rgba(5, 15, 35, .28), 0 2px 4px rgba(5, 15, 35, .20), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1.2), box-shadow .2s ease;
}
.quick-add-btn svg { transition: transform .25s cubic-bezier(.2, .8, .2, 1.2); }
.quick-add-btn:focus-visible { outline: 2px solid var(--nav-hi); outline-offset: 3px; }
.quick-add-list {
  list-style: none;
  margin: 0;
  padding: 0 0 10px;            /* bridges the list to the button, so a hover holds on the way up */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  visibility: hidden;
  transition: visibility 0s linear .25s;
}
.quick-add-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(5, 15, 35, .16), 0 1px 3px rgba(5, 15, 35, .10);
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2, .8, .2, 1.2), border-color .15s ease, background-color .15s ease, color .15s ease;
}
.quick-add-dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  line-height: 1;
}
.quick-add-item:hover,
.quick-add-item:focus-visible {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  color: var(--brand);
  outline: none;
}

/* open: a hover (on a real pointer — a phone's sticky tap-hover would never let
   go), keyboard focus inside it, or .is-open from a click / tap (app.js) */
@media (hover: hover) {
  .quick-add:hover .quick-add-list { visibility: visible; pointer-events: auto; transition: visibility 0s; }
  .quick-add:hover .quick-add-item { opacity: 1; transform: none; }
  .quick-add:hover .quick-add-btn svg { transform: rotate(45deg); }
  .quick-add:hover .quick-add-btn { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(5, 15, 35, .32), 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
}
.quick-add.is-open .quick-add-list,
.quick-add:has(:focus-visible) .quick-add-list { visibility: visible; pointer-events: auto; transition: visibility 0s; }
.quick-add.is-open .quick-add-item,
.quick-add:has(:focus-visible) .quick-add-item { opacity: 1; transform: none; }
.quick-add.is-open .quick-add-btn svg,
.quick-add:has(:focus-visible) .quick-add-btn svg { transform: rotate(45deg); }
/* they fan out from the button upwards: the nearest one first */
.quick-add-list li:nth-last-child(2) .quick-add-item { transition-delay: .04s; }
.quick-add-list li:nth-last-child(3) .quick-add-item { transition-delay: .08s; }

/* the Add form an entry jumped to wears a ring for a moment, so the eye lands
   with it. A ring of its own (::after) rather than the panel's box-shadow or
   animation: page-enter's rise and the scroll reveal already own those. */
.quick-add-target { position: relative; }
.quick-add-target::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: 0;
  transition: opacity .9s ease-out;
}
.quick-add-target.is-landed::after { opacity: 1; transition: none; }

@media (prefers-reduced-motion: reduce) {
  .quick-add, .quick-add-btn, .quick-add-btn svg, .quick-add-item, .quick-add-target::after { transition: none !important; }
}
@media (max-width: 900px) {
  .quick-add { right: 14px; bottom: 70px; }   /* above the phones' 44px .to-top */
  body:has(.to-top:not(.is-shown)) .quick-add { bottom: 14px; }
  .quick-add-btn { width: 44px; height: 44px; }
}
@media print { .quick-add { display: none !important; } }


/* ==========================================================================
   The page search, livelier (header.php, app.js §7): it widens while in use,
   shows its shortcut, has its own clear button, and its matches slide in;
   on a phone a search button opens it as a row of its own
   ========================================================================== */
.finder { transition: max-width .3s cubic-bezier(.2, .8, .2, 1), flex-basis .3s cubic-bezier(.2, .8, .2, 1); }
.finder:focus-within { flex-basis: 360px; max-width: 480px; }
.brand-bar .finder-input { padding-right: 66px; transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease; }
.brand-bar .finder-input:focus { background: var(--panel); }
.finder:focus-within .finder-icon { color: var(--brand); }
.finder-icon { transition: color .2s ease; }
.finder-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
  transition: opacity .15s ease;
}
.finder:focus-within .finder-kbd,
.finder.has-value .finder-kbd { opacity: 0; }
.finder-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.finder-clear:hover { background: color-mix(in srgb, var(--debit) 14%, transparent); color: var(--debit); transform: translateY(-50%) rotate(90deg); }
.finder-clear[hidden] { display: none; }
.finder-head {
  padding: 6px 10px 4px;
  font-size: .65625rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.finder-list a { border-left: 3px solid transparent; }
.finder-list [aria-selected="true"] > a { border-left-color: var(--accent); }
.finder-list [aria-selected="true"] > a::after { content: "↵"; flex: none; margin-left: 2px; color: var(--muted); font-size: .75rem; }
.finder-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finder-group { margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes tl-slide-in { from { opacity: 0; transform: translateY(-4px); } }
  .finder-list [role="option"] { animation: tl-slide-in .22s ease both; animation-delay: calc(var(--i, 0) * 25ms); }
}
.finder-toggle { display: none; }
@media (max-width: 900px) {
  .finder-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 40%, color-mix(in srgb, var(--brand) 8%, var(--panel)) 100%);
    box-shadow: inset 0 1px 0 var(--gloss-edge), 0 1px 3px rgba(15, 30, 60, .10);
  }
  .finder-toggle[aria-expanded="true"] { color: var(--brand); border-color: var(--brand); box-shadow: var(--ring); }
  .brand-bar.search-open .finder { display: block; order: 4; flex: 1 1 100%; max-width: none; margin: 0; }
  .brand-bar .finder-input { font-size: max(16px, 1rem); }
  .finder-kbd { display: none; }
}
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .brand-bar.search-open .finder { animation: tl-slide-in .2s ease; }
}


/* --------------------------------------------------------------------------
   Skin picker — the row of colour swatches in the user menu (replaces the old
   single green/orange toggle). Swatch colours are fixed, not theme-driven, so
   each one always previews its own skin.
   -------------------------------------------------------------------------- */
.user-pop-label {
  padding: 10px 10px 2px;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.skin-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px 6px;
}
.skin-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.skin-swatch > span[aria-hidden] {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
/* Tamil letters are not spaced apart: the small tracked-out labels (menu
   captions, table heads, stat labels) read as scattered glyphs in Tamil, so
   letter-spacing is dropped everywhere on a Tamil page. */
html[lang="ta"] body,
html[lang="ta"] body * { letter-spacing: normal !important; }

/* the தமிழ் / English switch above the dark-mode toggle: two links, the
   current language marked (aria-current) — a full page load either way */
.lang-picker {
  display: flex;
  gap: 4px;
  margin: 6px 10px 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.lang-picker a {
  flex: 1;
  padding: 5px 8px;
  border-radius: 7px;
  text-align: center;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.lang-picker a:hover { color: var(--ink); text-decoration: none; }
.lang-picker a[aria-current="true"] {
  background: var(--panel);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.lang-picker a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.skin-swatch:hover { transform: translateY(-1px); }
.skin-swatch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skin-swatch[aria-pressed="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.skin-navy   > span[aria-hidden] { background: linear-gradient(135deg, #133a75, #f0811e); }
.skin-green  > span[aria-hidden] { background: linear-gradient(135deg, #2f7d3a, #b7791f); }
.skin-orange > span[aria-hidden] { background: linear-gradient(135deg, #d9691e, #f0a13a); }
.skin-ocean  > span[aria-hidden] { background: linear-gradient(135deg, #2563eb, #0891b2); }
.skin-violet > span[aria-hidden] { background: linear-gradient(135deg, #7c3aed, #c026d3); }
.skin-teal   > span[aria-hidden] { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.skin-slate  > span[aria-hidden] { background: linear-gradient(135deg, #475569, #94a3b8); }

@media (prefers-reduced-motion: reduce) {
  .skin-swatch { transition: none; }
  .skin-swatch:hover { transform: none; }
}


/* --------------------------------------------------------------------------
   Logbook (super-admin activity log) — logbook/index.php
   -------------------------------------------------------------------------- */
.logbook-table td { vertical-align: top; }
.logbook-table .badge { white-space: nowrap; }
.logbook-table td:nth-child(5) { min-width: 220px; }   /* Details — give it room */


/* --------------------------------------------------------------------------
   Mandi picture — mandies/picture.php, the Mandies list, Edit Mandi.
   Shown whole (not cropped), as it prints on the PDF letterhead; a mandi with
   no picture gets its initials in a brand circle, like the PDF.
   -------------------------------------------------------------------------- */
.mandi-photo {
  width: 72px;
  height: 72px;
  flex: none;
  object-fit: contain;
  border-radius: 8px;
}
.mandi-photo-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: var(--brand);
}
.mandi-photo-sm { width: 34px; height: 34px; font-size: .75rem; }
.mandi-photo-current { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.mandi-cell { display: flex; align-items: center; gap: 10px; }
.mandi-photo-remove { margin-top: 12px; }
/* district logo: square-cornered like the PDF; a dashed empty box until uploaded */
.district-logo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--border);
  color: var(--muted);
  font-size: .6875rem;
  line-height: 1.15;
}
.mandi-photo-sm.district-logo-empty { font-size: 0; border-width: 1px; }
.district-logo-link { display: inline-flex; align-items: center; gap: 8px; }

/* the popup asking for a missing district logo (a secretary) or mandi picture
   (an admin) right after sign-in (letterhead_ask_html(), app.js section 19) */
.logo-ask {
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.logo-ask::backdrop {
  background: rgba(10, 26, 12, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.logo-ask h2 { margin: 0 0 8px; font-size: 1.125rem; }
.logo-ask p { margin: 0; font-size: .84375rem; }
.logo-ask-pick { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.logo-ask-preview { flex: none; display: flex; }
.logo-ask-pick .field { flex: 1; min-width: 0; }
.logo-ask-pick input[type="file"] { max-width: 100%; }
.logo-ask .form-actions { justify-content: flex-end; }
@media (max-width: 480px) {
  .logo-ask { padding: 18px 16px 14px; }
  .logo-ask-pick { flex-direction: column; align-items: flex-start; }
  .logo-ask-pick .field { width: 100%; }
  .logo-ask .form-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .logo-ask[open] { animation: logo-ask-in .22s ease-out; }
}
@keyframes logo-ask-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
}

/* user profile picture (DP): a circle, initials until one is uploaded */
.user-photo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}
.user-photo-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.user-photo-lg { width: 96px; height: 96px; font-size: 1.875rem; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--border); }
.user-photo-sm { width: 30px; height: 30px; font-size: .6875rem; }
.user-photo-current { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.user-photo-form { flex: 1 1 240px; min-width: 0; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
.user-chip .avatar-img { object-fit: cover; padding: 0; }


/* ---- wide day-book tables (Daily Trade): tighter cells so all columns fit a laptop screen ---- */
table.panel-table.table-compact th,
table.panel-table.table-compact td { padding: 8px 8px; font-size: .8125rem; }
table.panel-table.table-compact th { font-size: .6875rem; letter-spacing: .03em; }
table.panel-table.table-compact th:first-child,
table.panel-table.table-compact td:first-child { padding-left: 12px; }
table.panel-table.table-compact .num,
table.panel-table.table-compact .nowrap { white-space: nowrap; }
/* Edit / Delete stack instead of widening the table */
table.panel-table.table-compact td.row-actions > .btn,
table.panel-table.table-compact td.row-actions > form { display: block; width: max-content; }
table.panel-table.table-compact td.row-actions > form { margin-top: 4px; }

/* --------------------------------------------------------------------------
   Upload review — the Errors panel and the bulk-assign bar on every upload's
   details page (includes/upload_review.php, app.js §16)
   -------------------------------------------------------------------------- */
.upload-errors { border-left: 4px solid var(--debit); }
.upload-errors-intro { margin: 0 0 10px; }
.upload-error-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.upload-error-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--debit) 7%, transparent);
}
.upload-error-count { font-weight: 700; color: var(--debit); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upload-error-msg { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.upload-error-rows { grid-column: 2; font-size: .75rem; overflow-wrap: anywhere; }

details.upload-rows { margin-bottom: 20px; }
details.upload-rows > summary { cursor: pointer; font-weight: 600; color: var(--brand); margin-bottom: 10px; }

.bulk-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
button.chip.bulk-chip { cursor: pointer; font: inherit; font-size: .75rem; color: var(--ink); }
.bulk-chip b { font-weight: 700; color: var(--muted); margin-left: 2px; }
.bulk-chip:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.bulk-chip[aria-pressed="true"] { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.bulk-chip[aria-pressed="true"] b { color: inherit; }
.bulk-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.bulk-col { width: 1%; text-align: center; }
.bulk-tick { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--brand); vertical-align: middle; }
tr.is-picked > td { background: color-mix(in srgb, var(--brand) 9%, transparent); }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 12px 0 20px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.bulk-bar.has-picks {   /* something ticked: the bar stays in view while its rows scroll past */
  position: sticky;
  bottom: 12px;
  z-index: 5;
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: 0 -2px 18px rgba(0, 0, 0, .12), var(--shadow);
}
.bulk-count { font-weight: 600; }
.bulk-bar.has-picks .bulk-count { color: var(--brand); }
.bulk-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-pick .combo--inline { width: 260px; }
.bulk-bar .btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) {   /* phones: the search box and the button each get the full width */
  .bulk-bar { padding: 10px 12px; gap: 8px; }
  .bulk-pick { width: 100%; }
  .bulk-pick .combo--inline, .bulk-pick .btn { flex: 1 1 100%; width: 100%; }
}

/* ---- Payment Tally (payment_tally/, farmer_payments/, wrong_payments/) ----
   The tally sheet reads top to bottom like a statement: a narrow column for
   the + / − / = sign, the line, the amount. The form sits beside it on wide
   screens and above it on phones. */
.tally-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
}
.tally-form .field { margin-bottom: 12px; }
.tally-form input[name="bank_balance"] { font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tally-sheet { margin: 0; }
.table-wrap > table.panel-table.tally-sheet { min-width: 0; }   /* three columns: fits a phone, no side-scroll */
.tally-sheet td { vertical-align: top; }
.tally-sheet td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tally-sheet .tally-op {
  width: 1%;
  padding-right: 0;
  text-align: center;
  font-weight: 800;
  color: var(--muted);
}
.tally-sheet tr.tally-total td { border-top: 2px solid var(--border); }
.tally-sheet tr.tally-due td { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.tally-sheet tr.tally-result td { border-top: 2px solid var(--border); font-size: .9375rem; }
.tally-sheet tr.tally-result .badge { font-size: .8125rem; }
details.tally-why { margin-top: 16px; }
details.tally-why > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.tally-why ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }
details.tally-why li + li { margin-top: 4px; }
.bulk-pick .bulk-ref { width: 230px; }
@media (max-width: 900px) {
  .tally-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bulk-pick .bulk-ref { flex: 1 1 100%; width: 100%; }
}
@media print {
  .tally-print { max-width: none !important; box-shadow: none; border: 0; }
}

/* ---- Registers & Logs (registers/, daily_log/) ----
   The daily log reads as cards, not a wide table, so staff can read and write
   it on a phone; the 14-day strip shows at a glance which days are empty. */
.dlog-strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; }
.dlog-day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--credit) 10%, var(--panel));
  color: var(--ink);
  text-decoration: none;
  line-height: 1.2;
}
.dlog-day-chip:hover { border-color: var(--brand); text-decoration: none; }
.dlog-day-chip.is-empty { background: color-mix(in srgb, var(--debit) 9%, var(--panel)); border-style: dashed; }
.dlog-day-chip.is-current { outline: 2px solid var(--brand); outline-offset: 1px; }
.dlog-day-name { font-size: .6875rem; color: var(--muted); }
.dlog-day-num { font-size: .9375rem; font-weight: 700; }
.dlog-day-count { font-size: .75rem; font-weight: 700; color: var(--credit); }
.dlog-day-chip.is-empty .dlog-day-count { color: var(--debit); }
.dlog-day { padding-top: 14px; }
.dlog-day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 6px; font-size: 1rem; }
.dlog-day-head .muted { font-size: .8125rem; font-weight: 500; }
.dlog-entry { padding: 12px 0; border-top: 1px solid var(--border); }
.dlog-entry:first-of-type { border-top: 0; padding-top: 6px; }
.dlog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; font-size: .8125rem; }
.dlog-meta .btn { margin-left: auto; }
.dlog-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.dlog-person { font-weight: 700; margin-bottom: 2px; }
.dlog-details, .dlog-action { white-space: pre-line; line-height: 1.55; }
.dlog-action { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); border-radius: 0 6px 6px 0; }
.dlog-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.dlog-kind { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 500; }
.dlog-kind input { width: auto; margin: 0; accent-color: var(--brand); }
.dlog-kind:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); font-weight: 700; }
@media (max-width: 640px) {
  .dlog-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .dlog-kind { flex: 1 1 100%; }
}
/* the mandi's total land area: asked once on the Infrastructure register, then a card with an Edit button */
.land-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; border-left: 4px solid var(--brand); }
.land-ask-q { display: flex; flex-direction: column; gap: 3px; flex: 1 1 300px; }
.land-ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.land-ask-row input { width: 130px; }
.land-ask-row select { width: auto; }
.land-stat .btn { margin-top: 8px; }
@media (max-width: 640px) {
  .land-ask-row { width: 100%; }
  .land-ask-row input, .land-ask-row select { flex: 1 1 120px; }
}
@media print {
  .dlog-day, .register-table { break-inside: auto; box-shadow: none; }
  .dlog-entry { break-inside: avoid; }
}
/* reminders: work still to do, due on a day the writer picked */
.dlog-reminders h2 { display: flex; align-items: center; gap: 10px; }
.dlog-reminder {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.dlog-reminder:first-of-type { border-top: 0; }
.dlog-reminder-when { font-weight: 700; color: var(--muted); font-size: .8125rem; }
.dlog-reminder.is-due .dlog-reminder-when { color: var(--debit); }
.dlog-reminder-what .muted { font-size: .78125rem; }
.dlog-reminder-done { display: flex; gap: 6px; margin: 0; }
.dlog-followup-line { margin-top: 6px; font-size: .84375rem; }
.dlog-followup-line.is-done { color: var(--muted); }
.dlog-followup-line .inline-form { display: inline; margin: 0; }
.dlog-followup-line .btn-link { border: 0; background: none; padding: 0 4px; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
/* photos */
.dlog-photo { display: inline-block; margin-top: 8px; }
.dlog-photo img, .dlog-photo-current img, .dlog-photo-preview {
  display: block;
  max-width: min(260px, 100%);
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.dlog-photo-current { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.dlog-photo-preview { margin-top: 8px; }
.dlog-photo-preview[hidden], #dlogPhotoNote[hidden] { display: none; }
@media (max-width: 640px) {
  .dlog-reminder { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .dlog-photo img { max-height: 160px; }
}

/* the "File language" switch beside a page's Download Excel / Download PDF
   links (download_lang_picker() in includes/i18n.php, app.js section 17):
   the pressed language is the one the files come out in */
.dl-lang {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.dl-lang-label {
  padding: 0 6px 0 5px;
  font-size: .78125rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.dl-lang button {
  padding: 5px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.dl-lang button:hover { color: var(--ink); }
.dl-lang button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.dl-lang button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 900px) {
  .form-actions .dl-lang { flex: 1 1 100%; }
  .dl-lang button { flex: 1; min-height: 34px; }
}

/* the note under a commodity's Tamil name box once it fills itself in from
   the name (commodity_tamil_note(), app.js section 18) */
.field .hint.ta-note { display: block; margin-top: 3px; color: var(--brand); }
.field .hint.ta-note[hidden] { display: none; }

/* --------------------------------------------------------------------------
   MI Report (market_info/index.php): the day picker, the rate column groups
   and the weather panel under the table
   -------------------------------------------------------------------------- */
.mi-day { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mi-day .field { min-width: 180px; }
.mi-day-step { display: flex; gap: 8px; flex-wrap: wrap; }
.mi-table th { vertical-align: bottom; }
.mi-table th.mi-group {
  text-align: center;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.mi-table th:nth-child(n+7), .mi-table tr:first-child th.mi-group { white-space: nowrap; }

.mi-wx { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 16px; align-items: stretch; }
.mi-wx-main {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--panel)), var(--panel-2));
  border: 1px solid var(--border);
}
.mi-wx-icon { font-size: 3.25rem; line-height: 1; }
.mi-wx-cond { font-weight: 700; font-size: 1rem; }
.mi-wx-temp { font-size: 1.75rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mi-wx-temp .muted { font-size: 1rem; font-weight: 600; }
.mi-wx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.mi-wx-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.mi-wx-item .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mi-wx-item .value { font-size: 1.1875rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mi-wx-item .sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.mi-wx-loc { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.mi-wx-loc > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.mi-wx-loc form { margin-top: 10px; max-width: 520px; }
@media (max-width: 640px) {
  .mi-wx { grid-template-columns: 1fr; }
  .mi-wx-icon { font-size: 2.625rem; }
  .mi-wx-temp { font-size: 1.5rem; }
}

/* --------------------------------------------------------------------------
   Posting Register (posting_register/index.php): headed in three rows like the
   paper register, the heads not posted to yet tinted and hideable
   -------------------------------------------------------------------------- */
.pr-dates { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pr-dates .field { min-width: 170px; margin: 0; }
.pr-step { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-table th, .pr-table td { padding: 7px 9px; font-size: .8125rem; }
.pr-table th { text-align: center; vertical-align: bottom; border-left: 1px solid var(--border); }
.pr-table td + td { border-left: 1px solid var(--border); }
.pr-table th.pr-group {
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.pr-table .nowrap { white-space: nowrap; }
.pr-table .pr-span { font-weight: normal; font-size: .75rem; white-space: nowrap; }
.pr-table .pr-later { background: color-mix(in srgb, var(--muted) 7%, transparent); }
.pr-table th.pr-later { color: var(--muted); font-weight: 500; }
.pr-table.pr-hide-later .pr-later { display: none; }
.pr-later-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 10px; font-weight: normal; cursor: pointer; }
.pr-later-toggle input { width: auto; margin: 0; }
@media print {
  .pr-table th, .pr-table td { padding: 3px 4px; font-size: .59375rem; }
  .pr-table .pr-later { background: none; }
}

/* The forms on PDL (Form 1, Form 5): a heading over its Inside and Outside columns */
.pdl-form th { vertical-align: bottom; }
.pdl-form th.pdl-group {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
}
.pdl-form .pdl-split { border-left: 1px solid var(--border); }
/* a column title read up the page, so a narrow column of figures needn't be as wide as the words over it */
.th-vert { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; text-align: left; }
/* Form 5: up to last month, this month and this year side by side, each set off from the one before */
.pdl-form .pdl-span { border-left: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); }
/* the Reports page's day picker (the Posting Register): the days picked as
   ticked boxes, and a row for adding one day or a stretch of them */
.report-dates { max-height: 150px; }
.report-dates-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.report-dates-add label { margin: 0; }
.report-dates-add input[type="date"] { width: auto; }

/* every date box, as dd/mm/yyyy (app.js section 24): a text box with a
   calendar button, and the browser's own date box behind it, out of sight,
   so its picker opens where the box is */
.tl-date { position: relative; display: inline-flex; vertical-align: middle; max-width: 100%; }
.tl-date-text { flex: 1 1 auto; width: 10.5em; min-width: 0; font-variant-numeric: tabular-nums; }
.tl-date .tl-date-text { padding-right: 34px; }
.tl-date .tl-date-text.is-bad { border-color: var(--debit); }
.tl-date .tl-date-native {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none;
}
.tl-date-pick {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: none; color: var(--muted); cursor: pointer;
}
.tl-date-pick:hover { color: var(--brand); }
.tl-date-pick:disabled { cursor: default; opacity: .45; }
