/* ==========================================================================
   AHRL Mine-to-Metal — design system v3 (2026-11)
   Tokens · layout shell · components · motion · 3D · dark mode · responsive
   ========================================================================== */
:root {
  --maroon: #713722; --maroon-d: #4A2417; --maroon-l: #94503A;
  --gold: #D5A024; --gold-d: #B98A1D; --gold-l: #E9C35E;
  --bg: #F3F0EC; --surface: #FFFFFF; --surface-2: #FBF9F6; --surface-3: #F5F1EC;
  --text: #241812; --muted: #6D6058; --faint: #9A8E86; --line: #E6DFD8; --line-2: #EFE9E3;
  --ink: #713722;            /* headings / accents on surface */
  --input: #FFFDF9;
  --gold-soft: #FBF0DA; --lightgold: #FBF0DA; --lightgrey: #F3F0EC;
  --green: #2F7D4B; --green-soft: #E3F2E8; --green-bg: rgba(47,125,75,.09);
  --amber: #B7791F; --amber-soft: #FBEFD5; --amber-bg: rgba(183,121,31,.10);
  --red: #B33B3B; --red-soft: #F8E1DE; --red-bg: rgba(179,59,59,.09);
  --blue: #3B6DA8;
  --grey: #8C8179; --darktext: #241812; --white: #FFFFFF;
  --shadow-1: 0 1px 2px rgba(36,24,18,.06), 0 2px 8px rgba(36,24,18,.05);
  --shadow-2: 0 2px 4px rgba(36,24,18,.06), 0 10px 28px rgba(36,24,18,.10);
  --shadow-3: 0 4px 8px rgba(36,24,18,.08), 0 22px 48px rgba(36,24,18,.18);
  --radius: 16px; --radius-s: 10px;
  --sbw: 264px; --sbw-rail: 78px;
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #120E0C; --surface: #1C1613; --surface-2: #231C18; --surface-3: #2A221D;
  --text: #F4EDE7; --muted: #B6A89E; --faint: #857970; --line: #362B25; --line-2: #2C2420;
  --ink: #E9C35E; --input: #16110E;
  --gold-soft: #2E2412; --lightgold: #2E2412; --lightgrey: #120E0C;
  --green: #5FC083; --green-soft: #17301F; --green-bg: rgba(95,192,131,.10);
  --amber: #E5AD45; --amber-soft: #33270F; --amber-bg: rgba(229,173,69,.11);
  --red: #F07272; --red-soft: #3A1B1B; --red-bg: rgba(240,114,114,.11);
  --blue: #6FA3E0; --grey: #9B8E85; --darktext: #F4EDE7; --white: #1C1613;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  --shadow-2: 0 2px 4px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.45);
  --shadow-3: 0 4px 8px rgba(0,0,0,.5), 0 22px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
body.app-shell {
  background:
    radial-gradient(1100px 520px at 105% -10%, rgba(213,160,36,.11), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(113,55,34,.09), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--maroon-l); text-decoration: none; }
a:hover { text-decoration: underline; }
html[data-theme="dark"] a { color: var(--gold-l); }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
::selection { background: var(--gold); color: #2B1B12; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; border: 2px solid transparent; }

/* ---------- App shell: top navigation ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topnav {
  position: sticky; top: 0; z-index: 300; display: flex; align-items: center; gap: 6px; height: 64px; padding: 0 22px;
  background: linear-gradient(100deg, #6E3421 0%, #512516 52%, #3A190E 100%); color: #F5E8DD;
  border-bottom: 2px solid var(--gold); box-shadow: 0 8px 26px rgba(36,24,18,.28);
}
.topnav::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(520px 120px at 0% 0%, rgba(213,160,36,.22), transparent 70%); }
.topnav > * { position: relative; }
.tn-brand { display: flex; align-items: center; gap: 14px; align-self: stretch; margin: 0 18px 0 -22px; padding: 0; flex: none; text-decoration: none !important; }
.tn-brand img { height: 100%; width: auto; max-width: none; box-sizing: border-box; padding: 8px 20px 8px 18px; display: block; background: #fff; border-radius: 0 0 22px 0; box-shadow: 4px 0 14px rgba(0,0,0,.22); object-fit: contain; }
.tn-brand .bt { display: block; font-weight: 800; font-size: 12.5px; letter-spacing: .7px; line-height: 1.15; white-space: nowrap; color: #fff; }
.tn-brand .bs { display: block; font-size: 10px; color: var(--gold-l); letter-spacing: 1.2px; font-weight: 800; margin-top: 3px; }
.mainnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.nv-link, .nv-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px; border-radius: 12px; border: 0; background: none; cursor: pointer;
  color: rgba(245,232,221,.92) !important; font: inherit; font-size: 13.5px; font-weight: 650; white-space: nowrap; text-decoration: none !important;
  transition: background .18s, color .18s, transform .18s, box-shadow .18s;
}
.nv-link svg, .nv-btn svg:not(.caret) { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nv-btn .caret { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; transition: transform .2s; opacity: .85; }
.nv-link:hover, .nv-btn:hover, .nv-group:hover > .nv-btn, .nv-group.open > .nv-btn, .nv-group:focus-within > .nv-btn { background: rgba(255,255,255,.13); color: #fff !important; }
.nv-group:hover > .nv-btn .caret, .nv-group.open > .nv-btn .caret { transform: rotate(180deg); }
.nv-link.on, .nv-btn.on { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: #2B1B12 !important; box-shadow: 0 6px 16px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.45); }
.nv-group { position: relative; display: flex; }
.nv-panel { position: absolute; top: 100%; left: 0; padding-top: 10px; z-index: 320; opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); transform-origin: top left; transition: opacity .16s, transform .2s cubic-bezier(.2,.8,.2,1), visibility .16s; }
.nv-panel.right { left: auto; right: 0; transform-origin: top right; }
.nv-group:hover > .nv-panel, .nv-group.open > .nv-panel, .nv-group:focus-within > .nv-panel { opacity: 1; visibility: visible; transform: none; }
.nv-card { min-width: 320px; padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3); }
.nv-user .nv-card, .nv-new .nv-card { min-width: 250px; }
.nv-head { font-size: 10.5px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; color: var(--faint); padding: 8px 12px 6px; }
.nv-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--text) !important; text-decoration: none !important; transition: background .15s, transform .15s; }
.nv-item:hover { background: var(--surface-3); transform: translateX(3px); }
.nv-item.on { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.nv-item b { display: block; font-size: 13.5px; font-weight: 700; }
.nv-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.ni-ico { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #A5593F, #713722); box-shadow: 0 5px 12px rgba(113,55,34,.3), inset 0 1px 0 rgba(255,255,255,.3); }
.ni-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nu-who { display: flex; align-items: center; gap: 12px; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nu-who b { display: block; font-size: 14px; } .nu-who small { color: var(--muted); font-size: 12px; }
.tn-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.tn-icon { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .15s, transform .15s; }
.tn-icon:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.tn-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tn-icon .sun { display: none; } html[data-theme="dark"] .tn-icon .sun { display: block; } html[data-theme="dark"] .tn-icon .moon { display: none; }
#nav-burger { display: none; }
.tn-new { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px; border-radius: 12px; border: 0; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 800; color: #2B1B12; background: linear-gradient(180deg, var(--gold-l), var(--gold)); box-shadow: 0 6px 16px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.5); transition: transform .15s, box-shadow .2s; }
.tn-new:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.tn-new svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; }
.tn-user { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.tn-user .avatar { width: 40px; height: 40px; font-size: 16px; border: 2px solid rgba(255,255,255,.35); transition: transform .15s; }
.tn-user:hover .avatar { transform: scale(1.06); }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #2B1B12; background: linear-gradient(135deg, var(--gold-l), var(--gold)); box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.cmd-btn { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; min-width: 150px; border-radius: 12px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); font: inherit; font-size: 13px; cursor: pointer; transition: background .15s; }
.cmd-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.cmd-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.cmd-btn kbd { margin-left: auto; font: inherit; font-size: 10.5px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 1px 6px; }
.main { min-width: 0; }
.container { width: 100%; max-width: 1560px; margin: 0 auto; padding: 26px 28px 56px; flex: 1; }
.site-banner { margin: 0; padding: 9px 16px; text-align: center; font-size: 13px; font-weight: 600; background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid var(--line); }
.site-foot { text-align: center; padding: 16px; font-size: 11.5px; color: var(--faint); letter-spacing: .4px; }
.nav-scrim { display: none; }
#nprog { position: fixed; left: 0; top: 0; height: 3px; width: 0; z-index: 1000; background: linear-gradient(90deg, var(--gold-l), var(--gold), #fff); box-shadow: 0 0 10px var(--gold); opacity: 0; transition: width .4s ease, opacity .3s; }
#nprog.on { opacity: 1; }
body.bare .topnav { justify-content: space-between; }

/* command palette */
.cmd-wrap { position: fixed; inset: 0; z-index: 900; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(15,8,5,.55); backdrop-filter: blur(5px); }
.cmd-wrap.open { display: flex; animation: fadeIn .15s; }
.cmd { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); overflow: hidden; animation: popIn .25s cubic-bezier(.2,.9,.3,1.2); }
.cmd input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 16px; padding: 16px 18px; outline: none; }
.cmd ul { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow: auto; }
.cmd li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; text-decoration: none; }
.cmd li a small { color: var(--faint); font-weight: 500; }
.cmd li.sel a, .cmd li a:hover { background: var(--gold-soft); text-decoration: none; }

/* ---------- Home (start page for data entry) ---------- */
.home-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.home-hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.home-hero p { margin: 4px 0 0; color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; margin-bottom: 26px; perspective: 1200px; }
.task { --accent: var(--gold); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 20px; background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .3s; }
.task::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--accent), transparent); }
.task::after { content: ""; position: absolute; width: 150px; height: 150px; right: -50px; top: -50px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); pointer-events: none; }
.task:hover { box-shadow: var(--shadow-3); }
.task .th { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.task .ti { width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent)); box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.4); transform: translateZ(26px); }
.task .ti svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.task h3 { margin: 0; font-size: 17px; color: var(--ink); } .task .td { color: var(--muted); font-size: 12.5px; }
.task .ts { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.task .ts div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.task .ts div span:first-child { color: var(--muted); } .task .ts b { font-variant-numeric: tabular-nums; }
.task .tb { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 750; }
.chip.ok { background: var(--green-soft); color: var(--green); } .chip.ok::before { content: "✓"; }
.chip.todo { background: var(--amber-soft); color: var(--amber); } .chip.todo::before { content: "●"; font-size: 9px; }
.chip.warn { background: var(--red-soft); color: var(--red); padding: 2px 9px; font-size: 11px; }
.btn.ghost.on { background: var(--gold); color: #2B1B12; border-color: var(--gold); }
.chip.info { background: var(--surface-3); color: var(--muted); }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.quick-links a { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--text); font-weight: 650; text-decoration: none !important; transition: transform .15s, box-shadow .2s; }
.quick-links a:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.quick-links svg { width: 18px; height: 18px; stroke: var(--maroon-l); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Page header ---------- */
h1.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.4px; margin: 0 0 4px; color: var(--ink); }
.page-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; max-width: 980px; }
.page-sub strong { color: var(--text); }
h2.section-h { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }
h2.section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Cards ---------- */
.card {
  position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-1); margin-bottom: 22px;
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.card:hover { box-shadow: var(--shadow-2); }
.card > h2 { font-size: 15px; font-weight: 750; letter-spacing: -.1px; color: var(--ink); margin: 0 0 16px; padding: 0 0 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > h2::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(180deg, var(--gold-l), var(--gold-d)); flex: none; }
.card h3 { font-size: 14px; margin: 0 0 10px; }
.card > h2 .small-note { margin: 0; font-weight: 500; }
.card.card-flat { box-shadow: none; }
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 22px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: minmax(0,1fr) !important; } }

/* tilt / glare (3D hover) */
.tilt { will-change: transform; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .3s; }
.tilt.tilting { transition: transform .08s linear, box-shadow .3s; box-shadow: var(--shadow-3); }
.tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.28), transparent 60%); }
html[data-theme="dark"] .tilt::after { background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(233,195,94,.16), transparent 60%); }
.tilt.tilting::after { opacity: 1; }

/* ---------- KPI tiles (3D cards) ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; perspective: 1100px; }
.card > .kpi-grid:last-child, .card > .kpi-grid:only-of-type { margin-bottom: 0; }
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
.kpi-tile {
  --accent: var(--gold); position: relative; min-width: 0; overflow: hidden; border-radius: var(--radius); padding: 16px 16px 14px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .3s, border-color .3s;
}
html[data-theme="dark"] .kpi-tile { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.04); }
.kpi-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); }
.kpi-tile::after { content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -40px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); pointer-events: none; opacity: .9; }
.kpi-tile > * { position: relative; z-index: 1; }
.kpi-tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.kpi-tile.tilting { box-shadow: var(--shadow-2); }
.kpi-tile .label { font-size: 12px; font-weight: 650; color: var(--muted); line-height: 1.3; padding-right: 44px; min-height: 31px; }
.kpi-tile .value { font-size: 25px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-tile .sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.kpi-tile .tgt { font-size: 11.5px; margin-top: 6px; font-weight: 650; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--muted); }
.kpi-tile .tgt.pos { color: var(--green); background: var(--green-soft); } .kpi-tile .tgt.pos::before { content: "▲"; font-size: 9px; }
.kpi-tile .tgt.neg { color: var(--red); background: var(--red-soft); } .kpi-tile .tgt.neg::before { content: "▼"; font-size: 9px; }
.kpi-tile .tgt.warn { color: var(--amber); background: var(--amber-soft); }
.kpi-tile.good { --accent: var(--green); background: linear-gradient(160deg, var(--surface), var(--green-bg)); }
.kpi-tile.warn { --accent: var(--red); background: linear-gradient(160deg, var(--surface), var(--red-bg)); }
.kpi-tile.amber { --accent: var(--amber); background: linear-gradient(160deg, var(--surface), var(--amber-bg)); }
.kpi-ico { position: absolute !important; right: 14px; top: 16px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 28%, transparent); }
.kpi-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-ring { position: absolute !important; right: 12px; top: 12px; width: 46px; height: 46px; }
.kpi-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; filter: drop-shadow(0 3px 5px color-mix(in srgb, var(--accent) 45%, transparent)); }
.kpi-ring .trk { fill: none; stroke: var(--line); stroke-width: 6; }
.kpi-ring .bar { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 0 999; transition: stroke-dasharray 1.3s cubic-bezier(.2,.8,.2,1); }
.kpi-tile.has-ring .value { padding-right: 0; } .kpi-tile.has-ring .label { padding-right: 56px; }

/* process chain (mine → metal) */
.chain { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; margin-bottom: 24px; perspective: 1200px; }
.chain .step { --accent: var(--gold); position: relative; min-width: 0; padding: 16px 14px 14px; border-radius: var(--radius); background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: visible; transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .3s; }
.chain .step.metal { --accent: var(--maroon-l); }
html[data-theme="dark"] .chain .step.metal { --accent: #D98A67; }
.chain .step::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 4px; border-radius: 0 0 6px 6px; background: var(--accent); box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 55%, transparent); }
.chain .step .label { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.chain .step .value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chain .step .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.chain .step:not(:last-child)::after { content: ""; position: absolute; right: -13px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-top: 3px solid var(--gold); border-right: 3px solid var(--gold); transform: rotate(45deg); z-index: 3; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(0) rotate(45deg); opacity: .6 } 50% { transform: translateX(4px) rotate(45deg); opacity: 1 } }
@media (max-width: 1280px) { .chain { grid-template-columns: repeat(3, minmax(0,1fr)); } .chain .step::after { display: none !important; } }
@media (max-width: 640px) { .chain { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- Gauges / hero ---------- */
.hero-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 24px; perspective: 1200px; }
.hero-card { position: relative; border-radius: 20px; padding: 18px 20px 16px; color: #fff; overflow: hidden; border: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(500px 220px at 80% -20%, rgba(213,160,36,.35), transparent 60%), linear-gradient(150deg, #7A3D27, #3D1B10);
  box-shadow: 0 2px 6px rgba(36,24,18,.2), 0 18px 36px rgba(61,27,16,.35), inset 0 1px 0 rgba(255,255,255,.14); }
.hero-card.alt { background: radial-gradient(500px 220px at 80% -20%, rgba(255,255,255,.14), transparent 60%), linear-gradient(150deg, #2A2320, #14100E); }
.hero-card .ht { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gold-l); }
.hero-card .hs { font-size: 12px; color: rgba(255,255,255,.72); margin-top: 2px; }
.hero-card .gauge { margin: 6px auto 2px; max-width: 250px; }
.gauge svg { width: 100%; height: auto; display: block; overflow: visible; }
.gauge .gtrk { fill: none; stroke: rgba(255,255,255,.14); stroke-width: 14; stroke-linecap: round; }
.gauge .gbar { fill: none; stroke-width: 14; stroke-linecap: round; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
.gauge .gtick { stroke: rgba(255,255,255,.35); stroke-width: 1.5; }
.gauge .gneedle { transform-origin: 100px 100px; transition: transform 1.4s cubic-bezier(.2,.9,.25,1.15); }
.gauge .gval { font: 800 28px var(--font); fill: #fff; text-anchor: middle; font-variant-numeric: tabular-nums; }
.gauge .glab { font: 600 10.5px var(--font); fill: rgba(255,255,255,.7); text-anchor: middle; letter-spacing: .6px; }
.hero-card .hmeta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-top: 6px; color: rgba(255,255,255,.82); border-top: 1px solid rgba(255,255,255,.14); padding-top: 8px; }
.hero-card .hmeta b { color: #fff; font-variant-numeric: tabular-nums; }
.pile-wrap { position: relative; height: 380px; border-radius: 14px; overflow: hidden; background: radial-gradient(600px 300px at 50% 0%, var(--surface-3), var(--surface-2)); border: 1px solid var(--line); cursor: grab; touch-action: none; }
.pile-wrap.small { height: 300px; } .pile-layout:has(.pile-wrap.small) .pile-side { max-height: 300px; }
.pile-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 14px; align-items: stretch; }
.pile-side { max-height: 380px; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pile-wrap:not(.small) { align-self: start; }
.ps-scroll { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; flex: 1; padding-right: 4px; }
.ps-head { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.ps-row { display: flex; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 10px; transition: background .15s; cursor: default; }
.ps-row:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.ps-dot { width: 12px; height: 12px; border-radius: 4px; margin-top: 4px; flex: none; box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.ps-main { flex: 1; min-width: 0; }
.ps-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; } .ps-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ps-top span { font-weight: 800; font-variant-numeric: tabular-nums; }
.ps-bar { height: 6px; border-radius: 4px; background: var(--line); margin: 5px 0 3px; overflow: hidden; } .ps-bar i { display: block; height: 100%; border-radius: 4px; }
.ps-sub { font-size: 11.5px; color: var(--muted); }
.ps-total { margin-top: auto; display: flex; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 9px; font-size: 13px; } .ps-total b { font-size: 16px; color: var(--ink); }
@media (max-width: 900px) { .pile-layout { grid-template-columns: 1fr; } }
.pile-wrap:active { cursor: grabbing; }
.pile-wrap canvas { width: 100%; height: 100%; display: block; }
.pile-tip { position: absolute; pointer-events: none; padding: 7px 11px; border-radius: 10px; background: rgba(20,12,8,.92); color: #fff; font-size: 12px; box-shadow: var(--shadow-2); opacity: 0; transition: opacity .12s; white-space: nowrap; transform: translate(12px, 12px); z-index: 5; }
.pile-leg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; }
.pile-leg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pile-hint { position: absolute; left: 12px; bottom: 8px; font-size: 11px; color: var(--faint); pointer-events: none; }

/* ---------- Tables ---------- */
.tbl-scroll { overflow-x: auto; max-width: 100%; border-radius: 12px; -webkit-overflow-scrolling: touch; }
.tall-scroll { max-height: 560px; overflow: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 2; text-align: left; padding: 10px 12px; font-size: 11.5px; font-weight: 750; letter-spacing: .4px; text-transform: uppercase;
  color: #FBEFE4; background: linear-gradient(180deg, #7A3D27, #5F2D1C); white-space: nowrap; border-bottom: 2px solid var(--gold);
}
html[data-theme="dark"] table.data th { background: linear-gradient(180deg, #3A2A20, #2D2019); color: var(--gold-l); }
table.data th:first-child { border-top-left-radius: 10px; } table.data th:last-child { border-top-right-radius: 10px; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); color: var(--text); vertical-align: middle; }
table.data tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover td { background: var(--gold-soft); }
table.data tr.status-exhausted td { color: var(--faint); }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.neg { color: var(--red); font-weight: 700; }
table.data td.pos { color: var(--green); font-weight: 700; }
table.data td.warn { color: var(--amber); font-weight: 700; }
table.data tr.totals-row td { background: var(--gold-soft) !important; font-weight: 700; border-top: 2px solid var(--gold); }
table.data tfoot td { border-top: 2px solid var(--ink); padding: 10px 12px; font-weight: 700; background: var(--surface-3); }
table.data th.grp { text-align: center; border-left: 1px solid rgba(255,255,255,.25); }
table.data td.sep, table.data th.sep { border-left: 1px solid var(--line); }
table.data tr.sel-row td { background: var(--gold-soft); }
.tbl-scroll table.data th, .tbl-scroll table.data td { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.tbl-scroll table.data td.flags { white-space: normal; min-width: 120px; }
.nowrap, td.nowrap, th.nowrap { white-space: nowrap !important; }
td.actions { min-width: 118px; }
td.actions .btn, td.actions .inline-form { display: inline-block; vertical-align: middle; margin: 0 2px 0 0; white-space: nowrap; }
td.flags .badge { display: block; width: fit-content; margin: 1px 0; }
table.data td:first-child a, table.data td a { font-weight: 650; }
table.data.compact th, table.data.compact td { padding-left: 8px; padding-right: 8px; }

/* ---------- Badges / notices / flashes ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 750; letter-spacing: .2px; }
.badge.active { background: var(--green-soft); color: var(--green); }
.badge.exhausted { background: var(--surface-3); color: var(--muted); }
.badge.flag { background: var(--red-soft); color: var(--red); margin-right: 3px; white-space: nowrap; }
.badge.info { background: var(--gold-soft); color: var(--gold-d); }
html[data-theme="dark"] .badge.info { color: var(--gold-l); }
.flash, .notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); animation: slideDown .4s cubic-bezier(.2,.8,.2,1); }
.flash.success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.flash.error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.notice { background: var(--gold-soft); border-left: 4px solid var(--gold); color: var(--text); }
.small-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.tag-navigate { color: var(--faint); font-style: italic; font-size: 11px; }
.legend-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.variance-legend, .flow-legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin: 2px 0 10px; }
.variance-legend .sw, .flow-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .btn { margin: 6px; }
.empty-art { width: 170px; margin: 0 auto 14px; display: block; animation: floaty 4s ease-in-out infinite; filter: drop-shadow(0 14px 18px rgba(61,27,16,.25)); }
.empty-state p { margin: 6px auto; max-width: 520px; }
.empty-state p strong { color: var(--ink); font-size: 18px; }

/* ---------- Forms & buttons ---------- */
form .field, .field { margin-bottom: 14px; }
form label, .field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; letter-spacing: .1px; }
form input:not([type=checkbox]):not([type=radio]):not([type=file]), form select, form textarea, .field input, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--input); transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
form input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--faint); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; }
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 25%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--maroon); width: 16px; height: 16px; vertical-align: middle; }
input[type=date], input[type=number] { font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none !important; font-family: inherit; font-weight: 750; font-size: 13.5px; letter-spacing: .1px;
  padding: 10px 18px; min-height: 40px; border-radius: 12px; color: #fff !important; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #8B4630, #6A311E); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 14px rgba(113,55,34,.32);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px rgba(113,55,34,.4); filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(0) scale(.98); }
.btn.secondary { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: #2B1B12 !important; box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 6px 14px rgba(213,160,36,.35); }
.btn.secondary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 10px 22px rgba(213,160,36,.45); }
.btn.danger { background: linear-gradient(180deg, #CC4F4F, #A53232); box-shadow: 0 6px 14px rgba(179,59,59,.3); }
.btn.small { padding: 5px 12px; font-size: 12px; min-height: 32px; border-radius: 10px; }
.btn.ghost { background: var(--surface); color: var(--text) !important; border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.inline-form { display: inline; margin: 0; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-bottom: 22px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.filter-bar form { margin: 0; }
.filter-bar .field { margin-bottom: 0; min-width: 130px; }
.filter-bar > form { display: flex; gap: 12px 14px; align-items: flex-end; flex-wrap: wrap; }
details.targets { margin-bottom: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
details.targets > summary { cursor: pointer; padding: 14px 18px; font-weight: 750; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 10px; }
details.targets > summary::-webkit-details-marker { display: none; }
details.targets > summary::before { content: "▸"; transition: transform .2s; color: var(--gold-d); }
details.targets[open] > summary::before { transform: rotate(90deg); }
details.targets .tg-body { padding: 0 18px 16px; display: flex; flex-wrap: wrap; gap: 14px 28px; }
details.targets .tg-body form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* charts */
.chart-box { position: relative; height: 320px; min-width: 0; }
.chart-box.short { height: 270px; }
.chart-box canvas { max-width: 100%; }

/* ---------- Tabs, lists ---------- */
.pd-tabs { display: flex; gap: 6px; margin: 0 0 18px; padding: 5px; flex-wrap: wrap; background: var(--surface-3); border-radius: 14px; border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.pd-tabs a { padding: 8px 16px; text-decoration: none !important; color: var(--muted); font-weight: 700; font-size: 13px; border-radius: 10px; transition: background .2s, color .2s, box-shadow .2s; }
.pd-tabs a:hover { color: var(--text); background: var(--surface); }
.pd-tabs a.on { background: linear-gradient(180deg, #8B4630, #6A311E); color: #fff; box-shadow: 0 4px 10px rgba(113,55,34,.35); }
.flowbar { display: flex; height: 30px; border-radius: 10px; overflow: hidden; background: var(--surface-3); margin: 6px 0; box-shadow: inset 0 2px 4px rgba(0,0,0,.12); }
.flowbar div { display: flex; align-items: center; padding: 0 10px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; min-width: 0; }
.check-list, .alert-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.check-list li, .alert-list li { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.note-list { max-height: 360px; overflow: auto; font-size: 12.5px; }
.note-list table td:not(.nowrap) { white-space: normal !important; }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 12.5px; margin: 0; }
.defs dt { font-weight: 700; color: var(--ink); } .defs dd { margin: 0; color: var(--muted); }
@media (max-width: 700px) { .defs { grid-template-columns: 1fr; } }
.lims-upload { display: flex; gap: 10px; align-items: flex-end; padding-left: 14px; border-left: 3px solid var(--gold-soft); flex-wrap: wrap; }
table.mill-grid td input.mnum { width: 130px; text-align: right; padding: 5px 8px; min-height: 34px; font-variant-numeric: tabular-nums; }
table.mill-grid tr.grp-row td { background: var(--gold-soft) !important; color: var(--ink); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.mill-grid tr.calc td { color: var(--muted); }
.split-help { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.split-help label { font-weight: 500; font-size: 11px; margin: 0; display: inline; }
.split-help input { width: 100px !important; padding: 3px 6px !important; min-height: 28px !important; }
.dispatch-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 14px; }
.dispatch-form .field { margin: 0; flex: 1; min-width: 130px; }

/* ---------- Login / standalone pages: 3D scene ---------- */
.login-wrap { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; overflow: hidden;
  background: radial-gradient(900px 600px at 20% 10%, #8B4630, transparent 60%), radial-gradient(800px 600px at 90% 90%, rgba(213,160,36,.35), transparent 55%), linear-gradient(135deg, #5A2B1A, #2B130A); perspective: 1000px; }
.scene { position: absolute; inset: 0; pointer-events: none; transform-style: preserve-3d; }
.cube { position: absolute; width: var(--s); height: var(--s); left: var(--x); top: var(--y); transform-style: preserve-3d; animation: spin var(--d) linear infinite, bob 7s ease-in-out infinite; opacity: .9; }
.cube i { position: absolute; inset: 0; border: 1px solid rgba(233,195,94,.5); background: linear-gradient(135deg, rgba(213,160,36,.22), rgba(113,55,34,.18)); backdrop-filter: blur(1px); }
.cube i:nth-child(1) { transform: translateZ(calc(var(--s)/2)); } .cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s)/2)); }
.cube i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s)/2)); } .cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s)/2)); }
.cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s)/2)); } .cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s)/2)); }
@keyframes spin { from { transform: rotateX(20deg) rotateY(0deg) rotateZ(0deg); } to { transform: rotateX(380deg) rotateY(360deg) rotateZ(0deg); } }
@keyframes bob { 0%,100% { margin-top: 0; } 50% { margin-top: -26px; } }
.login-card { position: relative; width: min(400px, 100%); padding: 38px 34px 30px; border-radius: 24px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(213,160,36,.2); animation: popIn .7s cubic-bezier(.2,.9,.3,1.1); }
.login-card img { height: 56px; display: block; margin: 0 auto 10px; }
.login-card h1 { text-align: center; font-size: 17px; line-height: 1.35; margin: 0 0 24px; font-weight: 800; letter-spacing: .3px; }
.login-card h1 small { display: block; color: var(--gold-d); font-size: 11.5px; letter-spacing: 1.2px; margin-top: 4px; font-weight: 700; }

/* ---------- Motion ---------- */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .7s cubic-bezier(.2,.8,.2,1); transition-delay: var(--rd, 0s); }
.reveal.in { opacity: 1; transform: none; }
.container > .card, .container > .grid-2 > .card { }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cmd-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; } .cmd-btn span, .cmd-btn kbd { display: none; }
  .nv-link span, .nv-btn { font-size: 13px; } .nv-link, .nv-btn { padding: 0 10px; }
}
@media (max-width: 1000px) {
  .topnav { padding: 0 14px; }
  #nav-burger { display: inline-grid; margin-right: 4px; order: -1; }
  .tn-brand .bs { display: none; } .tn-brand { margin-left: -14px; }
  .mainnav { position: fixed; top: 64px; left: 0; right: 0; bottom: 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 14px 40px; overflow-y: auto; z-index: 290;
    background: linear-gradient(180deg, #4A2214, #2E140B); transform: translateX(-102%); transition: transform .3s cubic-bezier(.2,.8,.2,1); flex: none; }
  body.nav-open .mainnav { transform: none; }
  body.nav-open { overflow: hidden; }
  .nv-link, .nv-btn { height: 46px; flex: none; font-size: 15px; width: 100%; justify-content: flex-start; }
  .nv-group { flex-direction: column; } .nv-btn { cursor: default; font-size: 11px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; color: rgba(245,232,221,.55) !important; height: 34px; pointer-events: none; }
  .nv-btn .caret { display: none; } .nv-btn.on { background: none; box-shadow: none; color: var(--gold-l) !important; }
  .mainnav .nv-panel { position: static; opacity: 1; visibility: visible; transform: none; padding-top: 0; }
  .mainnav .nv-card { background: transparent; border: 0; box-shadow: none; min-width: 0; padding: 0; }
  .mainnav .nv-head { display: none; }
  .mainnav .nv-item { color: #F5E8DD !important; padding: 8px 6px; } .mainnav .nv-item small { display: none; } .mainnav .nv-item b { font-size: 15px; }
  .mainnav .nv-item:hover { background: rgba(255,255,255,.1); } .mainnav .nv-item.on { background: rgba(213,160,36,.25); box-shadow: inset 3px 0 0 var(--gold); }
  .mainnav .ni-ico { width: 32px; height: 32px; border-radius: 10px; }
  .tn-new span { display: none; } .tn-new { width: 40px; padding: 0; justify-content: center; }
  .tn-right .nv-card { min-width: 230px; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 64px 0 0 0; background: rgba(10,5,3,.5); z-index: 280; }
  .container { padding: 18px 16px 40px; }
}
@media (max-width: 640px) {
  .topnav { gap: 6px; padding: 0 10px; } .tn-brand span { display: none; } .tn-brand { margin: 0 6px 0 -10px; } .tn-brand img { padding: 10px 12px; border-radius: 0 0 14px 0; } .tn-right { gap: 6px; }
  .tn-icon, .cmd-btn, .tn-new { width: 38px; height: 38px; } .tn-user .avatar { width: 38px; height: 38px; }
  .tn-right .nv-panel { right: -4px; max-width: calc(100vw - 20px); } .tn-right .nv-card { min-width: 0; width: min(260px, calc(100vw - 24px)); }
  h1.page-title { font-size: 23px; }
  .card { padding: 16px 14px; border-radius: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 10px; }
  .kpi-tile { padding: 12px 12px 10px; } .kpi-tile .value { font-size: 20px; } .kpi-tile .label { padding-right: 0; min-height: 0; font-size: 11.5px; }
  .kpi-ico { display: none; } .kpi-tile.has-ring .value { padding-right: 0; } .kpi-ring { width: 36px; height: 36px; right: 8px; top: 8px; }
  .filter-bar, .filter-bar > form { flex-direction: column; align-items: stretch; } .filter-bar .field { min-width: 0; width: 100%; }
  .filter-bar .btn, details.targets .btn { width: 100%; }
  details.targets .tg-body form { flex-direction: column; align-items: stretch; }
  .chart-box { height: 260px; }
  .hero-row { grid-template-columns: 1fr; }
  .pd-tabs { width: 100%; } .pd-tabs a { flex: 1; text-align: center; padding: 8px 10px; }
  .dispatch-form .field { flex: 1 1 100%; }
}
@media (max-width: 380px) { .kpi-grid { grid-template-columns: minmax(0,1fr) !important; } }
@media print {
  .topnav, .site-foot, .filter-bar, .cmd-wrap { display: none !important; } body { background: #fff; } .card, .kpi-tile { box-shadow: none; break-inside: avoid; }
}


/* ---------- Executive: 12 speedometers + Month / YTD tabs ---------- */
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.view-tabs a { display: flex; flex-direction: column; padding: 8px 20px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--muted) !important; text-decoration: none !important; line-height: 1.2; }
.view-tabs a small { font-weight: 600; font-size: 11px; opacity: .8; }
.view-tabs a.on { background: linear-gradient(180deg, var(--maroon-l), var(--maroon-d)); color: #fff !important; box-shadow: 0 4px 12px rgba(90,43,26,.3); }
.gauge-grid[hidden] { display: none; } .gauge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.gcard { padding: 14px 16px 12px; border-radius: 18px; min-width: 0; }
.gcard .ht { font-size: 11.5px; }
.gcard .gauge { max-width: 230px; margin: 2px auto 0; }
.gcard .gauge .gval { font-size: 22px; }
.gcard .hmeta { font-size: 11.5px; margin-top: 4px; }
.gcard-empty { height: 120px; display: grid; place-items: center; color: rgba(255,255,255,.55); font-size: 12.5px; }
@media (max-width: 1100px) { .gauge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .gauge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .view-tabs { display: flex; } .view-tabs a { flex: 1; text-align: center; padding: 8px 8px; } }
@media (max-width: 420px) { .gcard .gauge .gval { font-size: 20px; } }

.tbl-scroll.tall { max-height: 520px; overflow: auto; }
.tbl-scroll.tall thead th { position: sticky; top: 0; z-index: 2; }

/* Executive filter panel (compact) */
.fpanel { background: #403d3b; color: #fff; border-radius: 14px; padding: 8px 14px; margin: 0 0 14px; box-shadow: var(--shadow-1); }
.fp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 2px 0; }
.fp-head::-webkit-details-marker { display: none; }
.fp-sum { font-weight: 800; font-size: 13.5px; color: #E9C35E; }
.fp-tog { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 3px 11px; }
.fpanel[open] .t-shut, .fpanel:not([open]) .t-open { display: none; }
.fp-body { padding-top: 6px; border-top: 1px solid rgba(255,255,255,.12); margin-top: 6px; }
.frow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 26px; padding: 3px 0; }
.fgroup { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.fg-t { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.55); width: 92px; flex: none; line-height: 1.2; }
.fchips { display: flex; flex-wrap: wrap; gap: 4px; }
.fchip { padding: 3px 11px; border-radius: 999px; background: #5a5755; color: #e8e6e4 !important; font-size: 11.5px; font-weight: 700; text-decoration: none !important; transition: background .15s, box-shadow .15s; }
.fchip:hover { background: #6b6866; }
.fchip.on { background: #D5A024; color: #2B1B12 !important; box-shadow: 0 0 9px rgba(213,160,36,.6); }
.fp-go { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; }
.fp-go a { font-size: 11px; font-weight: 700; color: #fff !important; text-decoration: none !important; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28); }
.fp-go a:hover { background: rgba(255,255,255,.12); }
.gdelta { text-align: center; font-weight: 800; font-size: 12px; margin-top: 4px; }
.gdelta small { font-weight: 600; opacity: .75; }
.gdelta.up { color: #7fd68b; } .gdelta.down { color: #ff8a80; } .gdelta.flat { color: rgba(255,255,255,.65); }
@media (max-width: 640px) { .fpanel { padding: 8px 10px; } .fg-t { width: 100%; } .frow { gap: 2px 14px; } .fp-go { margin-left: 0; } }
.fchip.cmp { background: transparent; color: #E9C35E !important; box-shadow: inset 0 0 0 1.5px rgba(233,195,94,.85); }
.fp-leg { font-size: 10.5px; color: rgba(255,255,255,.55); }
.gtick-l { fill: rgba(255,255,255,.55); font-size: 8px; font-weight: 700; }
