/* RBARM design system — Liquid Glass, in the same language as rafsanjanirupok.com:
   floating translucent glass surfaces over a soft green glow, system SF type with
   Kalpurush for Bangla, mint active pill, pill buttons, large radii.
   Light, dark, or follow the device: the switch in the header sets data-theme on <html>. Component class names are a contract with
   the modules: keep them stable. */
@font-face { font-family: 'Kalpurush'; src: url('../fonts/kalpurush.ttf') format('truetype'); font-display: swap; size-adjust: 118%; }

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Kalpurush', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg: #EEEDE4;
  --glow-1: rgba(120, 190, 140, .45);
  --glow-2: rgba(215, 237, 178, .55);
  --glow-3: rgba(201, 154, 46, .16);
  --ink: #1D1D1F;
  --ink-2: #3A3F3C;
  --muted: #545A56;
  --line: rgba(29, 29, 31, .10);
  --line-strong: rgba(29, 29, 31, .18);
  --glass: rgba(255, 255, 255, .86);
  --glass-strong: rgba(255, 255, 255, .94);
  --glass-soft: rgba(255, 255, 255, .42);
  --glass-edge: rgba(255, 255, 255, .75);
  --hairline: inset 0 0 0 .5px rgba(255, 255, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(18, 32, 24, .06), 0 18px 40px -18px rgba(18, 32, 24, .28);
  --shadow-hover: 0 2px 4px rgba(18, 32, 24, .08), 0 26px 56px -20px rgba(18, 32, 24, .36);
  --blur: blur(22px) saturate(1.8);
  --sunk: rgba(29, 29, 31, .045);
  --sunk-2: rgba(29, 29, 31, .08);

  --mint: #D7EDB2;
  --mint-ink: #1F2E22;
  --mint-text: #2E7A4C;
  --accent: #1F7A4D;
  --accent-ink: #165C3A;
  --btn-bg: #1D1D1F;
  --btn-ink: #F5F5F7;
  --gold: #C99A2E;

  --ok: #1E7A45;     --ok-bg: rgba(46, 160, 90, .14);
  --warn: #8A5A00;   --warn-bg: rgba(230, 160, 30, .18);
  --bad: #B3261E;    --bad-bg: rgba(220, 60, 50, .13);
  --info: #1F5FBF;   --info-bg: rgba(31, 95, 191, .12);

  --side-ink: #1D1D1F;
  --side-muted: #545A56;
  --side-hover: rgba(29, 29, 31, .06);

  --radius: 16px;
  --radius-lg: 24px;
  --side-w: 268px;
}
/* Dark tokens: chosen with the switch (data-theme="dark"), or following the device when the
   switch is on "auto". The two blocks hold the same values: change both together. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #050706;
    --glow-1: rgba(46, 122, 76, .40);
    --glow-2: rgba(120, 170, 90, .18);
    --glow-3: rgba(201, 154, 46, .14);
    --ink: #F5F5F7;
    --ink-2: #D9DDDA;
    --muted: #B9BDBA;
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);
    --glass: rgba(30, 34, 32, .88);
    --glass-strong: rgba(40, 44, 42, .95);
    --glass-soft: rgba(38, 42, 40, .40);
    --glass-edge: rgba(255, 255, 255, .10);
    --hairline: inset 0 0 0 .5px rgba(255, 255, 255, .10), inset 0 1px 0 rgba(255, 255, 255, .06);
    --shadow: 0 1px 3px rgba(18, 32, 24, .08), 0 20px 50px -16px rgba(0, 0, 0, .6);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .2), 0 28px 60px -18px rgba(0, 0, 0, .7);
    --sunk: rgba(255, 255, 255, .04);
    --sunk-2: rgba(255, 255, 255, .08);
    --mint-text: #9FD8B4;
    --accent: #9FD8B4;
    --accent-ink: #C4EBD2;
    --btn-bg: #F5F5F7;
    --btn-ink: #1D1D1F;
    --ok: #8EDCAA;  --ok-bg: rgba(46, 160, 90, .20);
    --warn: #F2C46B; --warn-bg: rgba(230, 160, 30, .18);
    --bad: #FF9A8F;  --bad-bg: rgba(220, 60, 50, .20);
    --info: #9DC2FF; --info-bg: rgba(80, 140, 230, .18);
    --side-ink: #EFF1EA;
    --side-muted: #B9BDBA;
    --side-hover: rgba(255, 255, 255, .07);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #050706;
    --glow-1: rgba(46, 122, 76, .40);
    --glow-2: rgba(120, 170, 90, .18);
    --glow-3: rgba(201, 154, 46, .14);
    --ink: #F5F5F7;
    --ink-2: #D9DDDA;
    --muted: #B9BDBA;
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);
    --glass: rgba(30, 34, 32, .88);
    --glass-strong: rgba(40, 44, 42, .95);
    --glass-soft: rgba(38, 42, 40, .40);
    --glass-edge: rgba(255, 255, 255, .10);
    --hairline: inset 0 0 0 .5px rgba(255, 255, 255, .10), inset 0 1px 0 rgba(255, 255, 255, .06);
    --shadow: 0 1px 3px rgba(18, 32, 24, .08), 0 20px 50px -16px rgba(0, 0, 0, .6);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .2), 0 28px 60px -18px rgba(0, 0, 0, .7);
    --sunk: rgba(255, 255, 255, .04);
    --sunk-2: rgba(255, 255, 255, .08);
    --mint-text: #9FD8B4;
    --accent: #9FD8B4;
    --accent-ink: #C4EBD2;
    --btn-bg: #F5F5F7;
    --btn-ink: #1D1D1F;
    --ok: #8EDCAA;  --ok-bg: rgba(46, 160, 90, .20);
    --warn: #F2C46B; --warn-bg: rgba(230, 160, 30, .18);
    --bad: #FF9A8F;  --bad-bg: rgba(220, 60, 50, .20);
    --info: #9DC2FF; --info-bg: rgba(80, 140, 230, .18);
    --side-ink: #EFF1EA;
    --side-muted: #B9BDBA;
    --side-hover: rgba(255, 255, 255, .07);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; letter-spacing: -.003em;
  background:
    radial-gradient(60vw 50vh at 8% -5%, var(--glow-1), transparent 70%),
    radial-gradient(50vw 45vh at 100% 10%, var(--glow-2), transparent 70%),
    radial-gradient(60vw 50vh at 70% 110%, var(--glow-3), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--ink); }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -.022em; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 14px; color: var(--muted); font-weight: 500; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; flex: none; }
.inline-form { display: inline; margin: 0; }

/* Glass surface (shared) */
.glass, .sidebar, .app-header, .panel, .kpi, .tile, .table-wrap, .auth-card, .sector, .quick-link, .notice, .demo-banner, .date-chip {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow), var(--hairline);
}

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; gap: 0; }
.sidebar {
  position: sticky; top: 12px; height: calc(100vh - 24px); margin: 12px 0 12px 12px; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; border-radius: 28px; color: var(--side-ink); overflow: hidden;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; color: var(--side-ink); }
.sidebar-brand:hover { color: var(--side-ink); }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(150deg, #E9C766, var(--gold)); color: #2A2410; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 6px 14px -6px rgba(140, 100, 20, .55); }
.logo .icon { width: 22px; height: 22px; }
.logo-lg { width: 52px; height: 52px; border-radius: 16px; }
.logo-lg .icon { width: 28px; height: 28px; }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-text strong { font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.sidebar-brand-text small { font-size: 13px; color: var(--side-muted); line-height: 1.35; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; display: flex; flex-direction: column; gap: 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--side-muted); padding: 8px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 23px; color: var(--side-ink); font-weight: 500; font-size: 16px; transition: background .15s, color .15s, box-shadow .15s; }
.nav-item .icon { width: 21px; height: 21px; opacity: .8; }
.nav-item:hover { background: var(--side-hover); color: var(--side-ink); }
.nav-item.is-active { background: var(--mint); color: var(--mint-ink); font-weight: 600; box-shadow: 0 6px 16px -6px rgba(20, 40, 28, .45), inset 0 1px 0 rgba(255, 255, 255, .4); }
.nav-item.is-active .icon { opacity: 1; }
.sidebar-foot { margin: 0 10px 10px; padding: 10px; border-radius: 20px; background: var(--glass-soft); box-shadow: var(--hairline); display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(150deg, #3E8F5E, #1F5E3B); color: #FFFFFF; font-weight: 700; font-size: 14px; box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.user-card-text { display: flex; flex-direction: column; min-width: 0; }
.user-card-text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-text small { font-size: 13px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.seg-group { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sunk-2); gap: 2px; margin: 0; }
.seg { min-height: 34px; padding: 0 13px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg.is-on { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(0,0,0,.2), var(--hairline); }
.seg-dark { background: var(--sunk-2); }
.theme-switch .seg { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; }
.theme-switch .icon { width: 18px; height: 18px; }
.theme-switch .seg-text { font-size: 13px; }
@media (max-width: 1180px) { .theme-switch .seg-text { display: none; } }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--side-hover); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header { position: sticky; top: 12px; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 58px; margin: 12px 16px 0; padding: 0 12px 0 18px; border-radius: 24px; }
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; }
.crumb-mill { font-weight: 700; letter-spacing: .03em; color: var(--muted); }
.crumb-sep { width: 16px; height: 16px; color: var(--line-strong); }
.crumb-page { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; font-size: 14px; color: var(--ink-2); }
.date-chip .icon { width: 16px; height: 16px; color: var(--muted); }
.env-badge { padding: 6px 12px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 600; }
.content { width: 100%; max-width: 1360px; padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; }
.sidebar-backdrop { display: none; }

@media (max-width: 980px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; margin: 10px; height: calc(100vh - 20px); transform: translateX(-110%); transition: transform .25s cubic-bezier(.2,.8,.2,1); background: var(--glass-strong); }
  .nav-open .sidebar { transform: translateX(0); }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  .menu-btn { display: inline-flex; }
  .app-header { margin: 10px 10px 0; padding: 0 10px; }
  .content { padding: 18px 14px 48px; }
  .date-chip { display: none; }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .kpi, .tile { transition: none !important; } }

/* ---------- Sign-in (bare) ---------- */
.auth-shell { display: grid; grid-template-columns: minmax(320px, 46%) 1fr; min-height: 100vh; gap: 0; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; margin: 14px; padding: 40px 44px; border-radius: 32px; color: #F5F5F7;
  background: radial-gradient(90% 70% at 10% 0%, rgba(80, 170, 110, .55), transparent 65%), radial-gradient(80% 60% at 100% 100%, rgba(201, 154, 46, .35), transparent 60%), #0B110D;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,.6), inset 0 0 0 .5px rgba(255,255,255,.08); }
.auth-brand-top { display: flex; align-items: center; gap: 14px; }
.auth-brand-mark { font-weight: 700; font-size: 22px; letter-spacing: .06em; }
.auth-brand-body { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.auth-brand-name { font-size: 36px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.auth-brand-place { font-size: 18px; color: #9FD8B4; }
.auth-points { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 16px; color: #DDE3DE; }
.auth-points .icon { width: 22px; height: 22px; color: #D7EDB2; }
.auth-brand-foot { font-size: 13px; color: #A1A1A6; }
.auth-main { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 40px clamp(20px, 6vw, 88px); max-width: 640px; width: 100%; }
.auth-lang { align-self: flex-end; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.auth-card { border-radius: 28px; padding: 32px 30px; display: flex; flex-direction: column; gap: 16px; background: var(--glass-strong); }
.auth-card h1 { font-size: 32px; }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 24px 20px; gap: 14px; margin: 10px; border-radius: 24px; }
  .auth-brand-name { font-size: 24px; }
  .auth-points, .auth-brand-foot { display: none; }
  .auth-main { padding: 18px 14px 40px; }
}

/* ---------- Page building blocks ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { border-radius: var(--radius-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--radius); color: var(--ink); min-height: 80px; transition: transform .18s, box-shadow .18s; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover), var(--hairline); color: var(--ink); }
.tile-label { font-weight: 600; font-size: 16px; }
.tile-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.facts li { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: 0; }
.facts li > span:first-child { color: var(--muted); }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 15px; }
.activity li { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity-who { font-weight: 600; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .icon { width: 32px; height: 32px; opacity: .45; }

/* Notices and pills */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: var(--radius); font-weight: 500; }
.notice .icon { width: 18px; height: 18px; margin-top: 2px; }
.notice-ok { color: var(--ok); background: var(--ok-bg); }
.notice-error { color: var(--bad); background: var(--bad-bg); }
.notice-warn { color: var(--warn); background: var(--warn-bg); }
.notice-info { color: var(--info); background: var(--info-bg); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--sunk-2); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-dark { background: var(--btn-bg); color: var(--btn-ink); }

/* Buttons: pills, like the website */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--glass-strong); color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06), var(--hairline), inset 0 0 0 1px var(--line); transition: transform .12s, box-shadow .15s, background .15s; }
.btn .icon { width: 18px; height: 18px; }
.btn:hover { color: var(--ink); box-shadow: 0 6px 16px -8px rgba(0,0,0,.3), var(--hairline), inset 0 0 0 1px var(--line-strong); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); box-shadow: 0 8px 20px -10px rgba(0,0,0,.55); }
.btn-primary:hover { color: var(--btn-ink); background: var(--btn-bg); box-shadow: 0 12px 26px -10px rgba(0,0,0,.6); }
.btn-accent { background: var(--mint); color: var(--mint-ink); box-shadow: 0 6px 16px -6px rgba(20, 40, 28, .45), inset 0 1px 0 rgba(255,255,255,.4); }
.btn-secondary { background: var(--glass-strong); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-small { min-height: 38px; padding: 0 15px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-weight: 600; font-size: 15px; color: var(--ink-2); }
.field-hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 14px; color: var(--bad); font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=email], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 14px; background: var(--glass-strong); color: var(--ink); font: inherit; font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { min-height: 96px; resize: vertical; }
.has-error input, .has-error select, .has-error textarea { box-shadow: inset 0 0 0 1.5px var(--bad); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--glass-soft); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--sunk); }
.table td a { font-weight: 600; }
.table .actions { text-align: right; white-space: nowrap; }

/* Access levels (designations matrix) */
.lv { display: inline-flex; align-items: center; justify-content: center; min-width: 84px; min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--sunk-2); color: var(--muted); }
.lv-1 { background: var(--info-bg); color: var(--info); }
.lv-2 { background: var(--ok-bg); color: var(--ok); }
.lv-3 { background: var(--warn-bg); color: var(--warn); }
.lv-4 { background: var(--btn-bg); color: var(--btn-ink); }

/* QR labels (print) */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.qr-label { border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #FFFFFF; color: #1D1D1F; box-shadow: var(--shadow); break-inside: avoid; }
.qr-label canvas, .qr-label img { width: 150px; height: 150px; image-rendering: pixelated; }
.qr-tag { font-family: var(--mono); font-weight: 600; font-size: 15px; }

/* ---------- Cockpit (home) ---------- */
.cockpit-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.cockpit-head > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.cockpit-head h1 { font-size: 34px; }
.cockpit-stage { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--radius-lg); color: var(--ink); min-height: 150px; transition: transform .18s, box-shadow .18s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover), var(--hairline); color: var(--ink); }
.kpi-label { font-size: 15px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 38px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-sub { font-size: 14px; color: var(--muted); line-height: 1.4; flex: 1; }
.kpi .pill { align-self: flex-start; }
.kpis-coming .kpi.is-coming { background: var(--glass-soft); box-shadow: var(--hairline), inset 0 0 0 1px var(--line); min-height: 128px; }
.kpi.is-coming .kpi-value { color: var(--line-strong); }
.meter { display: block; height: 8px; border-radius: 4px; background: var(--sunk-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3E8F5E, #D7EDB2); width: 0; }
.meter-10 { width: 10%; } .meter-20 { width: 20%; } .meter-30 { width: 30%; } .meter-40 { width: 40%; } .meter-50 { width: 50%; }
.meter-60 { width: 60%; } .meter-70 { width: 70%; } .meter-80 { width: 80%; } .meter-90 { width: 90%; } .meter-100 { width: 100%; background: var(--bad); }
.sector-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.sector { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: var(--radius); color: var(--ink); position: relative; transition: transform .18s, box-shadow .18s; }
.sector::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: #3E8F5E; }
.sector:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover), var(--hairline); color: var(--ink); }
.sector-service::before { background: var(--gold); }
.sector.is-empty::before { background: var(--line-strong); }
.sector-name { font-weight: 600; font-size: 15px; line-height: 1.35; }
.sector-count { font-size: 13px; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-link { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px; color: var(--ink); font-weight: 600; }
.quick-link:hover { color: var(--ink); box-shadow: var(--shadow-hover), var(--hairline); }

/* Demo data banner */
.demo-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); color: var(--ink-2); font-size: 15px; }
.demo-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 700; letter-spacing: .03em; }

/* Feature map */
.feature-layer { display: flex; flex-direction: column; gap: 12px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.feature { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius-lg); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow), var(--hairline); }
.feature-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.feature h3 { font-size: 18px; }
.feature ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.feature a.btn { align-self: flex-start; }
.feature-legend { display: flex; flex-wrap: wrap; gap: 8px; }

@media print {
  .sidebar, .app-header, .no-print, .sidebar-backdrop { display: none !important; }
  body { background: #FFFFFF; color: #000; }
  .content { padding: 0; max-width: none; }
  .panel, .table-wrap, .kpi { box-shadow: none; background: #FFFFFF; backdrop-filter: none; }
}

/* Rice-mill identity: paddy sheaf watermark in the sidebar, rice-gold rule under page titles */
.sidebar::after { content: ''; position: absolute; right: -18px; bottom: 120px; width: 150px; height: 190px; opacity: .07; pointer-events: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E7A4C' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M12 23V9'/%3E%3Cpath d='M12 9c0-3 1.5-5 4-6-.3 3-1.6 5-4 6z'/%3E%3Cpath d='M12 13c0-2.6-1.4-4.4-4-5.2.2 2.7 1.6 4.4 4 5.2z'/%3E%3Cpath d='M12 16c0-2.4 1.3-4 3.8-4.8-.2 2.5-1.5 4-3.8 4.8z'/%3E%3Cpath d='M12 19c0-2.2-1.2-3.6-3.5-4.3.2 2.2 1.4 3.6 3.5 4.3z'/%3E%3C/svg%3E"); }
.page-head h1::after, .cockpit-head h1::after { content: ''; display: block; width: 44px; height: 4px; margin-top: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), #E9C766); }

/* Page-swap progress line (assets/js/app.js) */
.swap-bar { position: fixed; z-index: 100; left: 0; top: 0; height: 3px; width: 0; opacity: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); box-shadow: 0 0 8px var(--accent); pointer-events: none; }
.swap-bar.is-on { opacity: 1; width: 80%; transition: width 8s cubic-bezier(.1, .7, .2, 1); }
.swap-bar.is-done { opacity: 0; width: 100%; transition: width .15s ease, opacity .25s ease .1s; }
@media print { .swap-bar { display: none; } }
.logo.logo-img { background: #FFFFFF; overflow: hidden; padding: 3px; }
.logo.logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Form errors and required marks (assets/js/app.js, layout $formAlert) */
.form-alert { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--radius); background: var(--bad-bg); color: var(--bad); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bad) 45%, transparent); scroll-margin-top: 90px; }
.form-alert:focus { outline: none; box-shadow: inset 0 0 0 2px var(--bad), 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent); }
.form-alert-head { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.form-alert-head .icon { width: 22px; height: 22px; }
.form-alert ul { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.form-alert li::marker { color: var(--bad); }
.form-alert li.is-link { cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); text-underline-offset: 3px; }
.form-alert li.is-link:hover, .form-alert li.is-link:focus-visible { color: var(--bad); }
.req-mark { color: var(--bad); font-weight: 700; margin-left: 4px; }
.opt-mark { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--sunk-2); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.form-legend { font-size: 14px; color: var(--muted); }
.field.has-error .field-label, .check.has-error { color: var(--bad); }
.field-error::before { content: "⚠ "; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { box-shadow: inset 0 0 0 1.5px var(--bad); }
@media print { .form-legend, .opt-mark, .req-mark { display: none; } }
.form-alert-field { color: var(--bad); }

/* Shared fixes from the Settings/Staff reviews */
[hidden] { display: none !important; }
@media print { .demo-banner, .env-badge, .theme-switch { display: none !important; } }
.auth-shell { max-width: 100vw; overflow-x: hidden; }
.auth-main { min-width: 0; }
@media (max-width: 520px) {
  .auth-main { padding: 18px 14px; }
  .auth-card { padding: 22px 18px; }
  .auth-lang { justify-content: center; align-self: stretch; }
  .theme-switch .seg { padding: 0 9px; }
}
