/* ════════════════════════════════════════════════════════════════════════════
   INSIGHT Template — the reference shell for INSIGHT WebBios apps.

   Design system  : OpenGTD (dark header, drawer sidebar, sub-toolbar, hero,
                    stat tiles, light/dark theme, session-timer box, language flags).
   Login          : OPQ (standard Google id_token → app-issued session).
   Menu-collapse  : OPQ (hamburger collapses the sidebar on desktop).

   Clone this app, rename the APP constants in app.js, swap the menu list and the
   dashboard copy, and you have a new INSIGHT app on the house style.
════════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }

:root {
  color-scheme: light;
  --bg:#f0f2fa; --bg-card:#ffffff; --bg-hover:#e8eaf6; --bg-stripe:#f7f8fd;
  --header-bg:#13152a; --toolbar-bg:#f8f9fe;
  --text:#1e2340; --text-muted:#5a6280; --text-dim:#9aa0c0;
  --border:#dde0f0; --border-strong:#c0c6e0;
  --accent:#c0392b; --success:#27ae60; --warning:#e67e22; --info:#2980b9;
  --header-h:56px; --toolbar-h:40px;
}
html.dark {
  color-scheme: dark;
  --bg:#1e2030; --bg-card:#252840; --bg-hover:#2d3156; --bg-stripe:#222438; --toolbar-bg:#1a1c30;
  --text:#dde1f0; --text-muted:#8891b4; --text-dim:#555e80; --border:#2e3459; --border-strong:#3a4070;
}
html.dark body { color-scheme: dark; }
html, body { height:100%; background:var(--bg); color:var(--text); font-family:'Segoe UI', system-ui, -apple-system, sans-serif; font-size:13px; }

/* ─── Scrollbars — shared INSIGHT design (thin, theme-aware via color-scheme) ──
   color-scheme (above) makes the browser paint a matching native scrollbar in
   dark mode; the rules below just make it thin. Applies everywhere (global).   */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--border-strong); border: 2px solid transparent; background-clip: content-box; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-dim); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ─── Header ───────────────────────────────────────────────────────────────── */
.app-header { height:var(--header-h); background:var(--header-bg); border-bottom:1px solid rgba(255,255,255,0.07); display:flex; align-items:center; justify-content:space-between; padding:0 16px; flex-shrink:0; gap:12px; }
.header-left { display:flex; align-items:center; flex-shrink:0; }
.header-right { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.header-icon-box { width:42px; height:42px; background:#c0392b; border-radius:6px; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-right:11px; box-shadow:0 2px 8px rgba(192,57,43,0.45); }
.header-icon { width:26px; height:26px; object-fit:contain; }
.header-titles { display:flex; flex-direction:column; gap:2px; }
.header-brand-line { display:flex; align-items:baseline; gap:5px; }
.brand-main { font-size:21px; font-weight:700; color:#fff; letter-spacing:1px; }
.brand-version { font-size:11px; color:#8891b4; font-weight:500; letter-spacing:0.5px; }
.brand-tagline { font-size:11px; color:#a0a8c8; letter-spacing:0.2px; }
.header-user-info { display:flex; align-items:center; gap:8px; }
.header-avatar { width:28px; height:28px; border-radius:50%; font-size:10px; font-weight:700; color:#fff; background:#c0392b; display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden; }
.header-avatar img { width:100%; height:100%; object-fit:cover; }
.header-user-name { font-size:12px; color:#c8ccde; white-space:nowrap; max-width:160px; overflow:hidden; text-overflow:ellipsis; }
.header-sep { width:1px; height:22px; background:rgba(255,255,255,0.12); margin:0 2px; }
.theme-toggle { width:30px; height:30px; border-radius:50%; border:1px solid #3a4070; background:#252840; color:#8891b4; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0; transition:color 0.2s, background 0.2s, border-color 0.2s; }
.theme-toggle:hover { color:#fff; border-color:#5a6290; background:#2d3156; }
.btn-logout { display:flex; align-items:center; gap:6px; padding:5px 11px; background:rgba(192,57,43,0.15); color:#e8a09a; border:1px solid rgba(192,57,43,0.35); border-radius:5px; font-size:12px; cursor:pointer; white-space:nowrap; }
.btn-logout:hover { background:rgba(192,57,43,0.3); color:#fff; }
.btn-logout-icon { width:30px; height:30px; border-radius:50%; border:1px solid rgba(192,57,43,0.35); background:rgba(192,57,43,0.15); color:#e8a09a; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0; }
.btn-logout-icon:hover { background:rgba(192,57,43,0.3); color:#fff; }
/* Menu-collapse button (OPQ): always visible — collapses the sidebar on desktop, opens the drawer on mobile */
.hamburger-btn { display:flex; width:34px; height:34px; border-radius:6px; border:1px solid #3a4070; background:transparent; color:#a0a8c8; cursor:pointer; font-size:15px; align-items:center; justify-content:center; flex-shrink:0; margin-right:8px; }
.hamburger-btn:hover { background:rgba(255,255,255,0.1); color:#fff; }

/* ─── Sub-toolbar (carries the back arrow + language flags) ─────────────────── */
.sub-toolbar { min-height:var(--toolbar-h); background:var(--toolbar-bg); border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 14px; gap:8px; flex-shrink:0; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.sub-toolbar:empty { display:none; }
.tb-sep { width:1px; height:26px; background:var(--border-strong); flex-shrink:0; margin:0 2px; }
.tb-label { font-size:10px; font-weight:700; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.5px; white-space:nowrap; flex-shrink:0; }
.tb-back-btn { display:flex; align-items:center; justify-content:center; width:28px; height:28px; flex-shrink:0; border-radius:6px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-dim); text-decoration:none; font-size:12px; cursor:pointer; font-family:inherit; }
.tb-back-btn:hover { color:var(--accent); border-color:var(--accent); }

/* ─── Language flags (translator) — pixel-identical to OpenGTD ──────────────── */
.lang-btn-row { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.lang-btn { display:flex; align-items:center; gap:5px; padding:5px 9px; border-radius:6px; cursor:pointer; border:1px solid var(--border); background:var(--bg-card); color:var(--text-muted); font-size:12px; font-weight:500; font-family:inherit; }
.lang-btn:hover { background:var(--bg-hover); color:var(--text); border-color:var(--border-strong); }
.lang-btn.active { background:rgba(192,57,43,0.10); border-color:rgba(192,57,43,0.45); color:#c0392b; }
html.dark .lang-btn.active { color:#e8a09a; }
.lang-flag { width:16px; height:12px; object-fit:cover; border-radius:1px; }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.app-body { height:calc(100vh - var(--header-h) - var(--toolbar-h)); display:flex; overflow:hidden; }
.sidebar { width:214px; background:var(--bg-card); border-right:1px solid var(--border); display:flex; flex-direction:column; flex-shrink:0; box-shadow:2px 0 8px rgba(0,0,0,0.04); overflow-x:hidden; overflow-y:auto; transition:width 0.24s ease, border-color 0.24s ease; }
/* Collapsed state (menu-collapse): animate the width to 0 instead of snapping away.
   overflow-x:hidden (above) keeps the content clipped cleanly during the slide, and
   prevents a horizontal scrollbar when a vertical one is present. */
body.sidebar-collapsed .sidebar { width:0; border-right-color:transparent; box-shadow:none; }
.nav-section-label { font-size:10px; font-weight:700; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.8px; padding:16px 16px 6px; }
.nav-item { display:flex; align-items:center; gap:10px; padding:9px 16px; font-size:13px; color:var(--text-muted); cursor:pointer; border-left:3px solid transparent; transition:background 0.15s, color 0.15s; text-decoration:none; }
.nav-item:hover { background:var(--bg-hover); color:var(--text); }
.nav-item.active { background:var(--bg-hover); color:var(--text); border-left-color:var(--accent); font-weight:600; }
.nav-item i { width:16px; text-align:center; font-size:13px; flex-shrink:0; }
.nav-item span { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.nav-item.disabled { opacity:.5; cursor:default; pointer-events:none; }
.nav-item .lock-badge { font-size:10px; color:var(--text-dim); flex:0 0 auto; }

/* ─── Session timer — pixel-identical to OpenGTD ───────────────────────────── */
.session-timer-box { margin-top:auto; padding:14px 16px 16px; border-top:1px solid var(--border); cursor:pointer; }
.session-timer-box:hover .session-timer-label { color:var(--accent); }
.session-timer-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.7px; color:var(--text-dim); display:flex; align-items:center; gap:6px; margin-bottom:7px; }
.session-timer-value { font-size:10px; font-weight:700; color:var(--text-dim); letter-spacing:0.04em; font-variant-numeric:tabular-nums; margin-left:auto; }
.session-timer-bar-wrap { height:4px; border-radius:2px; background:var(--border); overflow:hidden; }
.session-timer-bar { height:100%; border-radius:2px; background:#27ae60; transition:width 1s linear, background 0.5s; }

/* ─── Main content ─────────────────────────────────────────────────────────── */
.main-content { flex:1; overflow-y:auto; padding:20px 24px; background:var(--bg); }
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; flex-wrap:wrap; }
.page-title { font-size:18px; font-weight:700; color:var(--text); }
.page-subtitle { font-size:12px; color:var(--text-muted); margin-top:2px; }
.section-title { font-size:12px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; margin:22px 0 10px; display:flex; align-items:center; gap:8px; }
.section-title .st-count { font-weight:500; color:var(--text-dim); background:var(--bg-hover); border-radius:10px; padding:1px 8px; font-size:10px; }

/* ─── Dashboard hero (text left, image right) — from OpenGTD ────────────────── */
.hero { display:flex; gap:16px; align-items:stretch; margin-bottom:20px; }
.hero-info { flex:1; min-width:0; background:var(--bg-card); border:1px solid var(--border); border-radius:14px; padding:26px 30px; box-shadow:0 1px 4px rgba(0,0,0,0.05); display:flex; flex-direction:column; justify-content:flex-start; align-items:flex-start; }
.hero-media { flex:0 0 480px; border:1px solid var(--border); border-radius:14px; box-shadow:0 1px 4px rgba(0,0,0,0.05); overflow:hidden; min-height:300px; background:linear-gradient(135deg,#c0392b 0%,#13152a 100%); display:flex; align-items:center; justify-content:center; }
.hero-img { width:100%; height:100%; object-fit:cover; display:block; }
.hero-media .hero-fallback { color:rgba(255,255,255,0.85); font-size:80px; }
.hero-title { font-size:25px; font-weight:800; color:var(--text); letter-spacing:0.3px; margin-bottom:12px; line-height:1.2; }
.hero-title .accent { color:var(--accent); }
.hero-text { font-size:14px; color:var(--text-muted); line-height:1.65; max-width:620px; }
.hero-list { margin:14px 0 0; padding-left:0; list-style:none; display:flex; flex-direction:column; gap:7px; }
.hero-list li { font-size:13px; color:var(--text-muted); line-height:1.5; display:flex; align-items:flex-start; gap:8px; }
.hero-list li i { color:var(--accent); font-size:11px; margin-top:3px; flex-shrink:0; }

/* ─── Stat tiles — from OpenGTD ────────────────────────────────────────────── */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:14px; margin-bottom:8px; }
.stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:16px 18px; box-shadow:0 1px 4px rgba(0,0,0,0.05); border-left:4px solid var(--tile-color, var(--text-dim)); }
.stat-count { font-size:28px; font-weight:800; color:var(--text); line-height:1; margin-bottom:6px; }
.stat-label { font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.4px; display:flex; align-items:center; gap:6px; }

/* ─── Generic content card (used by the 9 stub pages) ──────────────────────── */
.card { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:18px 20px; box-shadow:0 1px 4px rgba(0,0,0,0.05); margin-bottom:14px; }
.card-title { font-size:13px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.4px; margin-bottom:12px; display:flex; align-items:center; gap:8px; }
.card-title i { color:var(--accent); }
.lorem { font-size:13.5px; color:var(--text-muted); line-height:1.7; }
.lorem + .lorem { margin-top:12px; }
.empty-wrap { text-align:center; color:var(--text-muted); padding:44px 20px; }
.empty-wrap i { font-size:42px; color:var(--text-dim); display:block; margin-bottom:16px; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:9px 15px; border-radius:6px; font-size:13px; font-weight:600; cursor:pointer; border:1px solid transparent; font-family:inherit; }
.btn-sm { padding:5px 10px; font-size:12px; }
.btn-primary { background:#c0392b; color:#fff; border-color:#c0392b; } .btn-primary:hover { background:#a93226; }
.btn-secondary { background:transparent; color:var(--text-muted); border-color:var(--border-strong); } .btn-secondary:hover { background:var(--bg-hover); color:var(--text); }

/* ─── Login (OPQ pattern) ──────────────────────────────────────────────────── */
.login-screen { position:fixed; inset:0; background:var(--header-bg); display:flex; align-items:center; justify-content:center; z-index:100; }
.login-card { width:380px; max-width:90vw; padding:40px 44px; background:var(--bg-card); border:1px solid var(--border); border-radius:12px; box-shadow:0 8px 40px rgba(0,0,0,0.35); text-align:center; }
.login-logo { display:flex; align-items:center; gap:14px; text-align:left; margin-bottom:22px; }
.login-icon-box { width:48px; height:48px; background:var(--accent); border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0; box-shadow:0 3px 10px rgba(192,57,43,0.4); }
.login-icon-box img { width:30px; height:30px; object-fit:contain; }
.login-brand { display:flex; align-items:baseline; gap:5px; }
.login-brand .brand-main { color:#1e2340; } html.dark .login-brand .brand-main { color:#dde1f0; }
.login-brand .brand-version { color:var(--text-dim); }
.login-tagline { font-size:12px; color:var(--text-muted); margin-top:2px; }
.login-desc { font-size:13px; color:var(--text-muted); line-height:1.55; margin-bottom:20px; }
#googleSignInBtn { display:flex; justify-content:center; }
.login-error { font-size:12px; color:#e74c3c; text-align:center; min-height:16px; margin-top:12px; }

/* ─── Toast / loading ──────────────────────────────────────────────────────── */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(80px); background:#2c3060; color:#fff; padding:10px 20px; border-radius:8px; font-size:13px; box-shadow:0 4px 20px rgba(0,0,0,0.25); z-index:360; opacity:0; transition:transform 0.25s ease, opacity 0.25s ease; white-space:nowrap; pointer-events:none; }
.toast.toast-success { background:#1a4a2a; border-left:4px solid #27ae60; }
.toast.toast-error { background:#7b1e1e; border-left:4px solid #e74c3c; }
.toast.toast-show { opacity:1; transform:translateX(-50%) translateY(0); }
.loading-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:200; }
.loading-spinner { width:40px; height:40px; border:3px solid var(--border); border-top-color:#c0392b; border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.content-loading { color:var(--text-muted); padding:48px 0; text-align:center; } .content-loading i { font-size:24px; display:block; margin-bottom:10px; color:var(--accent); }

.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:50; } .overlay-show { display:block; }
.show-mobile { display:none !important; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width:768px) {
  .hide-mobile { display:none !important; }
  .show-mobile { display:flex !important; }
  /* On mobile the sidebar is a drawer (transform-animated); the desktop width-collapse does not apply */
  body.sidebar-collapsed .sidebar { width:250px; border-right-color:var(--border); overflow-y:auto; }
  .sidebar { position:fixed; top:calc(var(--header-h) + var(--toolbar-h)); left:0; height:calc(100vh - var(--header-h) - var(--toolbar-h)); z-index:60; transform:translateX(-100%); transition:transform 0.25s ease; box-shadow:4px 0 20px rgba(0,0,0,0.25); width:250px; }
  .sidebar.sidebar-open { transform:translateX(0); }
  .sidebar-overlay.overlay-show { display:block; z-index:55; }
  .main-content { padding:14px 12px; }
  .page-title { font-size:16px; }
  .hero { flex-direction:column; }
  .hero-media { flex:1 1 auto; order:-1; min-height:180px; }
  .hero-img { height:200px; }
}
@media (max-width:480px) { .app-header { padding:0 10px; gap:6px; } }

/* ════════════════════════════════════════════════════════════════════════════
   Sorting activity — app-specific blocks on top of the INSIGHT template.
   Tokens, header, sidebar, toolbar and login all come from the template above;
   everything below is the grid / form / record-modal layer of this module.
════════════════════════════════════════════════════════════════════════════ */

/* ─── KPI tiles ────────────────────────────────────────────────────────────── */
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(178px,1fr)); gap:13px; margin-bottom:20px; }
.kpi-card { background:var(--bg-card); border:1px solid var(--border); border-radius:8px; padding:14px 16px; display:flex; align-items:center; gap:13px; cursor:pointer; box-shadow:0 1px 4px rgba(0,0,0,0.05); transition:border-color .15s, box-shadow .15s, transform .1s; }
.kpi-card:hover { border-color:var(--border-strong); box-shadow:0 4px 16px rgba(0,0,0,.10); }
.kpi-card:active { transform:scale(.99); }
.kpi-card.on { border-color:var(--accent); }
.kpi-icon { width:42px; height:42px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:17px; color:#fff; flex-shrink:0; }
.kpi-val { font-size:24px; line-height:1; }
.kpi-label { font-size:12px; color:var(--text-muted); margin-top:4px; }
.ic-blue{background:#2980b9}.ic-red{background:#c0392b}.ic-orange{background:#e67e22}
.ic-green{background:#27ae60}.ic-purple{background:#7b3fe4}.ic-grey{background:#7a839f}.ic-teal{background:#0f9d8f}

/* ─── Cards / panels ───────────────────────────────────────────────────────── */
.panel { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:16px 18px; box-shadow:0 1px 4px rgba(0,0,0,.05); }
.panel + .panel { margin-top:16px; }
.panel-title { font-size:13px; color:var(--text); margin-bottom:12px; display:flex; align-items:center; gap:8px; }
.panel-title i { color:var(--accent); }
.panel-title .pt-right { margin-left:auto; font-size:11.5px; color:var(--text-dim); }
.two-col { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:16px; }

/* horizontal bar rows (process / location breakdown) */
.bar-row { display:flex; align-items:center; gap:10px; margin:7px 0; }
.bar-lbl { width:120px; font-size:12px; color:var(--text-muted); flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track { flex:1; height:15px; background:var(--bg-hover); border-radius:8px; overflow:hidden; }
.bar-fill { height:100%; border-radius:8px; min-width:2px; transition:width .4s; }
.bar-n { width:44px; text-align:right; font-size:12px; color:var(--text-muted); }

/* ─── Filter bar ───────────────────────────────────────────────────────────── */
.filterbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px; }
.filterbar select, .filterbar input { padding:7px 10px; border:1px solid var(--border-strong); border-radius:6px; background:var(--bg-card); color:var(--text); font-size:12.5px; font-family:inherit; outline:none; }
.filterbar select:focus, .filterbar input:focus { border-color:var(--accent); }
.filterbar .grow { flex:1; min-width:160px; }
.filter-note { font-size:11.5px; color:var(--text-dim); margin-left:auto; }

/* ─── Data tables ──────────────────────────────────────────────────────────── */
.tbl-wrap { overflow:auto; max-height:calc(100vh - 290px); border:1px solid var(--border); border-radius:10px; background:var(--bg-card); }
.tbl-wrap.short { max-height:none; }
table.data { width:100%; border-collapse:collapse; font-size:12.5px; }
table.data th { text-align:left; padding:9px 12px; background:var(--bg-stripe); color:var(--text-dim); text-transform:uppercase; font-size:10px; letter-spacing:.4px; border-bottom:1px solid var(--border); white-space:nowrap; position:sticky; top:0; z-index:2; }
table.data td { padding:8px 12px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
table.data tbody tr { cursor:pointer; transition:background .1s; }
table.data tbody tr:hover { background:var(--bg-hover); }
table.data tbody tr:last-child td { border-bottom:none; }
.cell-dim { color:var(--text-muted); }
.mono { font-family:'Consolas','Courier New',monospace; font-variant-numeric:tabular-nums; letter-spacing:.3px; }
.num { text-align:right; font-variant-numeric:tabular-nums; }
.ellip { max-width:230px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ─── Status badges ────────────────────────────────────────────────────────── */
.badge { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:12px; font-size:11px; white-space:nowrap; }
.st-INITIATED { background:rgba(41,128,185,.15); color:#2980b9; }
.st-APPROVED  { background:rgba(39,174,96,.15);  color:#27ae60; }
.st-ONGOING   { background:rgba(230,126,34,.15); color:#e67e22; }
.st-CLOSED    { background:rgba(122,131,159,.18); color:var(--text-muted); }
.st-REJECTED  { background:rgba(192,57,43,.15);  color:#c0392b; }
.st-OTHER     { background:var(--bg-hover); color:var(--text-muted); }
.tag { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:6px; background:var(--bg-hover); color:var(--text-muted); font-size:11px; }

/* progress of a sorting (sorted vs prescribed) */
.mini-prog { display:flex; align-items:center; gap:7px; min-width:112px; }
.mini-prog .mp-track { flex:1; height:6px; border-radius:4px; background:var(--bg-hover); overflow:hidden; }
.mini-prog .mp-fill { height:100%; border-radius:4px; background:#27ae60; }
.mini-prog .mp-txt { font-size:11px; color:var(--text-muted); white-space:nowrap; font-variant-numeric:tabular-nums; }

/* ─── Buttons (extends the template .btn) ──────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--border-strong); border-radius:6px; padding:7px 13px; font-size:12px; cursor:pointer; font-family:inherit; background:var(--bg-card); color:var(--text); transition:background .13s, border-color .13s, opacity .13s; }
.btn:hover { background:var(--bg-hover); }
.btn.primary { background:var(--accent); color:#fff; border-color:var(--accent); }
.btn.primary:hover { filter:brightness(1.08); }
.btn.ghost { background:transparent; }
.btn.ghost:hover { border-color:var(--accent); color:var(--accent); background:transparent; }
.btn.sm { padding:5px 9px; font-size:11px; }
.btn:disabled { opacity:.45; cursor:default; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-sect { margin-bottom:20px; }
.form-sect-head { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--text-dim); margin:0 0 11px; padding-bottom:6px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:8px; }
.form-sect-head i { color:var(--accent); }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:13px 16px; }
.form-grid .wide { grid-column:1 / -1; }
.field { display:flex; flex-direction:column; gap:5px; min-width:0; }
.field label { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:5px; }
.field label .req { color:var(--accent); }
.field input, .field select, .field textarea { background:var(--bg-stripe); border:1px solid var(--border-strong); border-radius:6px; padding:8px 11px; font-size:13px; color:var(--text); font-family:inherit; outline:none; width:100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--accent); background:var(--bg-card); }
.field textarea { resize:vertical; min-height:74px; }
.field .hint { font-size:11px; color:var(--text-dim); }
.field.bad input, .field.bad select, .field.bad textarea { border-color:var(--accent); background:rgba(192,57,43,.05); }
.check-row { display:flex; align-items:center; gap:9px; padding-top:20px; font-size:13px; color:var(--text); }
.check-row input[type=checkbox] { width:16px; height:16px; accent-color:var(--accent); }
.form-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:6px; }
.form-actions .spacer { flex:1; }
.form-err { color:var(--accent); font-size:12.5px; min-height:16px; }

/* image / pdf upload boxes */
.updrop-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; }
.updrop { border:1.5px dashed var(--border-strong); border-radius:10px; background:var(--bg-stripe); overflow:hidden; display:flex; flex-direction:column; }
.updrop.ok  { border-color:rgba(39,174,96,.55); }
.updrop.nok { border-color:rgba(192,57,43,.55); }
.updrop.hasfile { border-style:solid; }
.updrop { outline:none; transition:box-shadow .15s, border-color .15s; }
.updrop .paste-tag { margin-left:auto; display:none; align-items:center; gap:5px; font-size:10.5px; color:var(--accent); }
.updrop.selected { border-style:solid; border-color:var(--accent); box-shadow:0 0 0 3px rgba(192,57,43,.18); }
.updrop.selected .paste-tag { display:inline-flex; }
.updrop-head { display:flex; align-items:center; gap:8px; padding:8px 12px; font-size:11.5px; color:var(--text-muted); border-bottom:1px solid var(--border); }
.updrop.ok .updrop-head i  { color:#27ae60; }
.updrop.nok .updrop-head i { color:#c0392b; }
.updrop-body { position:relative; height:190px; display:flex; align-items:center; justify-content:center; cursor:pointer; text-align:center; color:var(--text-dim); font-size:12px; padding:12px; }
.updrop-body img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#0b0d18; }
.updrop-body .up-hint i { display:block; font-size:26px; margin-bottom:8px; }
.updrop-body.busy { opacity:.5; }
.updrop-foot { padding:6px 12px; font-size:10.5px; color:var(--text-dim); border-top:1px solid var(--border); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pdf-box { display:flex; align-items:center; gap:12px; border:1.5px dashed var(--border-strong); border-radius:10px; background:var(--bg-stripe); padding:12px 14px; cursor:pointer; }
.pdf-box.hasfile { border-style:solid; border-color:rgba(41,128,185,.55); }
.pdf-box i { font-size:22px; color:#c0392b; }
.pdf-box .pdf-txt { flex:1; min-width:0; font-size:12.5px; color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* NOK code chips */
.nok-chips { display:flex; flex-wrap:wrap; gap:7px; margin-top:8px; }
.nok-chip { display:inline-flex; align-items:center; gap:6px; background:var(--bg-hover); border-radius:14px; padding:3px 6px 3px 11px; font-size:11.5px; color:var(--text-muted); }
.nok-chip button { border:none; background:none; color:var(--text-dim); cursor:pointer; font-size:11px; padding:2px 4px; border-radius:50%; line-height:1; }
.nok-chip button:hover { color:var(--accent); }

/* ─── Record modal ─────────────────────────────────────────────────────────── */
.modal-host { position:fixed; inset:0; z-index:500; background:rgba(10,12,25,.55); display:flex; align-items:flex-start; justify-content:center; padding:32px 14px; overflow-y:auto; }
.modal { background:var(--bg-card); border-radius:12px; width:100%; max-width:1060px; box-shadow:0 18px 60px rgba(0,0,0,.42); animation:modalIn .16s ease; margin:auto 0; }
@keyframes modalIn { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:none; } }
.modal-head { display:flex; align-items:flex-start; gap:12px; padding:15px 20px; border-bottom:1px solid var(--border); }
.modal-head .mh-id { font-family:'Consolas','Courier New',monospace; font-size:17px; letter-spacing:1px; color:var(--accent); }
.modal-head .mh-sub { font-size:12px; color:var(--text-muted); margin-top:3px; }
.modal-close { margin-left:auto; background:none; border:1px solid var(--border-strong); color:var(--text-muted); font-size:14px; cursor:pointer; padding:6px 10px; border-radius:8px; flex-shrink:0; }
.modal-close:hover { background:var(--bg-hover); color:var(--accent); border-color:var(--accent); }
.modal-body { padding:18px 20px; }
.modal-foot { display:flex; gap:10px; justify-content:flex-end; align-items:center; padding:13px 20px; border-top:1px solid var(--border); background:var(--bg-stripe); border-radius:0 0 12px 12px; flex-wrap:wrap; }

.meta-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:1px; background:var(--border); border:1px solid var(--border); border-radius:10px; overflow:hidden; margin-bottom:16px; }
.meta { background:var(--bg-card); padding:9px 12px; display:flex; flex-direction:column; gap:2px; min-width:0; }
.meta span { font-size:10px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.3px; }
.meta div { font-size:13px; color:var(--text); overflow:hidden; text-overflow:ellipsis; }
.text-block { background:var(--bg-stripe); border:1px solid var(--border); border-radius:10px; padding:11px 14px; margin-bottom:12px; }
.text-block span { font-size:10px; text-transform:uppercase; color:var(--text-dim); letter-spacing:.4px; display:block; margin-bottom:4px; }
.text-block div { font-size:13.5px; color:var(--text); line-height:1.5; white-space:pre-wrap; }
.img-pair { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
.img-card { border:1px solid var(--border); border-radius:10px; overflow:hidden; background:var(--bg-stripe); }
.img-card .ic-head { padding:7px 12px; font-size:11px; color:var(--text-muted); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:7px; }
.img-card.ok .ic-head i { color:#27ae60; } .img-card.nok .ic-head i { color:#c0392b; }
.img-card a { display:block; height:230px; background:#0b0d18; }
.img-card img { width:100%; height:100%; object-fit:contain; display:block; }
.img-card .ic-none { height:230px; display:flex; align-items:center; justify-content:center; color:var(--text-dim); font-size:12px; }
.sub-head { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); margin:18px 0 9px; display:flex; align-items:center; gap:8px; }

/* ─── Empty / loading ──────────────────────────────────────────────────────── */
.empty-state { text-align:center; color:var(--text-muted); padding:44px 20px; background:var(--bg-card); border:1px solid var(--border); border-radius:10px; }
.empty-state i { font-size:30px; color:var(--text-dim); display:block; margin-bottom:12px; }
.inline-load { text-align:center; color:var(--text-muted); padding:40px; }
.inline-load i { font-size:22px; color:var(--accent); }

@media (max-width:640px){
  .img-pair { grid-template-columns:1fr; }
  .tbl-wrap { max-height:none; }
}



/* ─── Lifecycle flow inside the hero panel (on the red/navy gradient) ─────── */
/* The shop-floor photo sits underneath; the dark bordeaux glass layer on top of
   it is what keeps the white lifecycle text readable. */
.hero-media {
  align-items:stretch; justify-content:flex-start; position:relative;
  background-image:
    linear-gradient(125deg, rgba(19,21,42,.92) 0%, rgba(122,28,22,.84) 46%, rgba(192,57,43,.66) 100%),
    url('img/sorting.jpg');
  background-size:cover, cover;
  background-position:center, 58% center;
  background-repeat:no-repeat, no-repeat;
  box-shadow:0 1px 4px rgba(0,0,0,0.05), inset 0 0 90px rgba(0,0,0,.34);
}
.flow { width:100%; padding:22px 24px; display:flex; flex-direction:column; justify-content:center; }
.flow-step { display:flex; gap:13px; align-items:flex-start; position:relative; padding-bottom:16px; opacity:.8; }
.flow-step.here { opacity:1; }
.flow-step:last-child { padding-bottom:0; }
.flow-step:not(:last-child)::before { content:''; position:absolute; left:14px; top:30px; bottom:0; width:2px; background:rgba(255,255,255,.28); }
.flow-dot { width:30px; height:30px; border-radius:50%; background:rgba(255,255,255,.18); backdrop-filter:blur(2px); border:1px solid rgba(255,255,255,.35); display:flex; align-items:center; justify-content:center; font-size:12px; color:#fff; flex-shrink:0; z-index:1; }
.flow-step.here .flow-dot { background:#fff; color:#13152a; border-color:#fff; }
.flow-lbl { font-size:13.5px; color:#fff; line-height:1.25; text-shadow:0 1px 3px rgba(0,0,0,.45); }
.flow-sub { font-size:11px; color:rgba(255,255,255,.78); margin-top:2px; text-shadow:0 1px 3px rgba(0,0,0,.45); }
@media (max-width:900px){ .hero { flex-direction:column; } .hero-media { flex:1 1 auto; min-height:0; } }

/* ─── late tweaks ──────────────────────────────────────────────────────────── */
.nowrap { white-space:nowrap; }
.updrop.dragover { border-style:solid; border-color:var(--accent); background:var(--bg-hover); }

/* ─── Station bookings analytics ───────────────────────────────────────────── */
.bar-row .bar-x { font-size:11px; color:var(--text-muted); white-space:nowrap; min-width:150px; display:flex; align-items:center; gap:6px; }
.cols { display:flex; align-items:flex-end; gap:3px; height:150px; padding-top:4px; }
.col { flex:1; min-width:3px; height:100%; display:flex; flex-direction:column; justify-content:flex-end; }
.col .c-ok { background:#27ae60; border-radius:2px 2px 0 0; }
.col .c-nok { background:#c0392b; border-radius:2px 2px 0 0; }
.col .c-ok + .c-nok, .col .c-nok + .c-ok { border-radius:0; }
.col:hover .c-ok { filter:brightness(1.15); }
.col-lbls { display:flex; gap:3px; margin-top:4px; }
.col-lbl { flex:1; min-width:3px; font-size:9px; color:var(--text-dim); text-align:center; overflow:visible; white-space:nowrap; position:relative; }
.col-lbl span { position:absolute; left:50%; transform:translateX(-50%); }
.bk-grid table.data td { white-space:nowrap; }
.lg { display:inline-block; width:10px; height:10px; border-radius:2px; vertical-align:middle; margin-right:3px; }
.lg.ok { background:#27ae60; } .lg.nok { background:#c0392b; }
table.data tr.row-nok td { background:rgba(192,57,43,.05); }
table.data td.nok { color:#c0392b; }

/* ─── Global SCOPE bar (plant) under the language toolbar ──────────────────── */
:root { --scope-h:38px; }
.scope-bar { min-height:var(--scope-h); background:var(--bg-card); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; padding:0 14px; flex-shrink:0; overflow-x:auto; }
.scope-bar .sc-lbl { font-size:10px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; display:flex; align-items:center; gap:6px; }
.scope-bar .sc-lbl i { color:var(--accent); }
.scope-bar select { padding:5px 30px 5px 10px; border:1px solid var(--border-strong); border-radius:6px; background:var(--bg-stripe); color:var(--text); font-size:12.5px; font-family:inherit; outline:none; min-width:180px; }
.scope-bar select:focus { border-color:var(--accent); }
.scope-bar select.on { border-color:var(--accent); color:var(--accent); }
.scope-bar .sc-note { font-size:11.5px; color:var(--text-muted); white-space:nowrap; }
.scope-bar .sc-note b { color:var(--text); }
body.has-scope .app-body { height:calc(100vh - var(--header-h) - var(--toolbar-h) - var(--scope-h)); }

/* ─── No bold anywhere (user preference); Font Awesome <i> keeps its weight ── */
*:not(i) { font-weight:400 !important; }


/* Clone picker modal (searchable, A-Z) */
.modal.clone-modal { max-width:560px; }
.clone-search { display:flex; align-items:center; gap:9px; background:var(--bg-stripe); border:1px solid var(--border-strong); border-radius:6px; padding:0 11px; color:var(--text-muted); }
.clone-search:focus-within { border-color:var(--accent); background:var(--bg-card); }
.clone-search input { flex:1; border:none; background:transparent; outline:none; padding:9px 0; font-size:13px; color:var(--text); font-family:inherit; }
.clone-list { margin-top:12px; max-height:55vh; overflow-y:auto; border:1px solid var(--border); border-radius:6px; }
.clone-item { padding:8px 12px; font-family:'Consolas','Courier New',monospace; font-size:13px; letter-spacing:.5px; color:var(--text); cursor:pointer; border-bottom:1px solid var(--border); }
.clone-item:last-child { border-bottom:none; }
.clone-item:hover, .clone-item.active { background:var(--bg-hover); color:var(--accent); }
.clone-empty { padding:16px; text-align:center; color:var(--text-muted); font-size:13px; }
