/* Layout: app shell = left rail (desktop) / bottom bar (phone), work area with page header + content; grids are the main surface. */
:root {
  --bg: #f3f4f1;          /* unbleached grey cloth */
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --line: #dfe2dc;
  --line-strong: #c6cbc2;
  --fg: #1d2622;
  --fg-2: #4d5853;
  --fg-3: #7a847f;
  --ink: #0f4c5c;         /* indigo-teal dye, primary */
  --ink-2: #0b3a47;
  --ink-soft: #e2eef0;
  --haldi: #d8962a;       /* turmeric, attention/active marker */
  --haldi-soft: #fbf0db;
  --ok: #2f7d4f; --ok-soft: #e1f1e6;
  --warn: #a8660b; --warn-soft: #fdf0d8;
  --bad: #b23a2e; --bad-soft: #f8e2df;
  --info: #2c5d9e; --info-soft: #e1eaf6;
  --muted-soft: #eceeea;
  --shadow: 0 1px 2px rgba(20,30,25,.06), 0 4px 16px rgba(20,30,25,.06);
  --shadow-pop: 0 8px 30px rgba(15,30,25,.18);
  --rail: #13221f;        /* loom-frame dark */
  --rail-fg: #c9d4cf;
  --rail-hover: #1f322e;
  --font-display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Noto Sans Gujarati", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 8px; --r-sm: 6px;
  --rail-w: 232px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111715; --surface: #18201d; --surface-2: #1d2622; --line: #2a3531; --line-strong: #3a4742;
    --fg: #e4ebe7; --fg-2: #b2bdb8; --fg-3: #84918b;
    --ink: #5fb3c4; --ink-2: #8ccfdc; --ink-soft: #1b3439;
    --haldi: #e8ac45; --haldi-soft: #3a2e17;
    --ok: #5cc285; --ok-soft: #173426; --warn: #e2a24a; --warn-soft: #3a2c15; --bad: #ec7a6c; --bad-soft: #3c1f1b; --info: #7fa9e6; --info-soft: #1b2a40;
    --muted-soft: #222c28; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-pop: 0 8px 30px rgba(0,0,0,.5);
    --rail: #0b100f; --rail-fg: #b7c4be; --rail-hover: #17211e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111715; --surface: #18201d; --surface-2: #1d2622; --line: #2a3531; --line-strong: #3a4742;
  --fg: #e4ebe7; --fg-2: #b2bdb8; --fg-3: #84918b;
  --ink: #5fb3c4; --ink-2: #8ccfdc; --ink-soft: #1b3439;
  --haldi: #e8ac45; --haldi-soft: #3a2e17;
  --ok: #5cc285; --ok-soft: #173426; --warn: #e2a24a; --warn-soft: #3a2c15; --bad: #ec7a6c; --bad-soft: #3c1f1b; --info: #7fa9e6; --info-soft: #1b2a40;
  --muted-soft: #222c28; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-pop: 0 8px 30px rgba(0,0,0,.5);
  --rail: #0b100f; --rail-fg: #b7c4be; --rail-hover: #17211e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--fg-3); }
.sm { font-size: 12px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hide-sm {}
@media (max-width: 760px) { .hide-sm { display: none !important; } }
@media (min-width: 761px) { .only-sm { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Shell ---------- */
#app { height: 100%; }
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0,1fr); height: 100%; }
.shell.collapsed { --rail-w: 64px; }
.rail { background: var(--rail); color: var(--rail-fg); display: flex; flex-direction: column; min-height: 0; padding-left: env(safe-area-inset-left, 0px); }
.brand { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: #fff; white-space: nowrap; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--haldi); }
.collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-chev, .collapsed .nav-sub, .collapsed .rail-foot-text { display: none; }
.nav { flex: 1 1 auto; overflow-y: auto; padding: 8px 8px 16px; scrollbar-width: thin; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f7e78; padding: 14px 10px 6px; }
.collapsed .nav-sec { visibility: hidden; height: 8px; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: inherit; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; }
.nav-item:hover { background: var(--rail-hover); color: #fff; }
.nav-item.active { background: rgba(216,150,42,.14); color: #fff; box-shadow: inset 3px 0 0 var(--haldi); }
.nav-item .ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chev { width: 14px; height: 14px; opacity: .6; transition: transform .15s; }
.nav-item.open .nav-chev { transform: rotate(90deg); }
.nav-sub { padding: 2px 0 6px 28px; display: flex; flex-direction: column; }
.nav-sub button { border: 0; background: none; color: #a9b6b0; text-align: left; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; position: relative; }
.nav-sub button::before { content: ""; position: absolute; left: -10px; top: 50%; width: 6px; height: 1px; background: #3d4c47; }
.nav-sub button:hover { color: #fff; background: var(--rail-hover); }
.nav-sub button.active { color: var(--haldi); font-weight: 600; }
.rail-foot { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; color: #6f7e78; display: flex; gap: 8px; align-items: center; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 10px; height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid transparent; background: none; cursor: pointer; color: var(--fg-2); position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--fg); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.search-trigger { flex: 1 1 280px; max-width: 420px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); color: var(--fg-3); cursor: pointer; min-width: 0; }
.search-trigger svg { width: 16px; height: 16px; flex: none; }
.search-trigger span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--fg-2); background: var(--surface); }
.ctx-select { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); height: 36px; padding: 0 8px; cursor: pointer; min-width: 0; }
.ctx-select select { border: 0; background: transparent; font-weight: 600; max-width: 190px; cursor: pointer; }
.ctx-select .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.content { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 18px 40px; }
.page { max-width: 1480px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--fg-3); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs button { border: 0; background: none; padding: 0; color: var(--fg-3); cursor: pointer; }
.crumbs button:hover { color: var(--ink); text-decoration: underline; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 2px 0 0; text-wrap: balance; }
.page-sub { color: var(--fg-2); margin: 4px 0 0; max-width: 70ch; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--fg-3); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0b1714; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0b1714; } }
.btn.primary:hover { background: var(--ink-2); }
.btn.haldi { background: var(--haldi); border-color: var(--haldi); color: #241703; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; cursor: pointer; color: var(--fg-2); border-right: 1px solid var(--line); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink-soft); color: var(--ink); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .flabel { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.field .req { color: var(--bad); }
.field .hint { font-size: 11.5px; color: var(--fg-3); }
.field .err { font-size: 11.5px; color: var(--bad); }
.inp, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); padding: 0 10px; width: 100%; min-width: 0; }
.field textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.field input[readonly] { background: var(--surface-2); color: var(--fg-2); }
.field.bad input, .field.bad select { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.radio-row { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; cursor: pointer; background: var(--surface); }
.radio-row label.on { border-color: var(--ink); background: var(--ink-soft); color: var(--ink); font-weight: 600; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Cards, sections ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-title { font-weight: 650; font-size: 14.5px; margin: 0; }
.card-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; } }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: default; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--ink); }
.kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-3); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 13px; font-family: var(--font-body); font-weight: 500; color: var(--fg-3); margin-left: 3px; }
.kpi-foot { font-size: 12px; color: var(--fg-2); display: flex; gap: 6px; align-items: center; }
.up { color: var(--ok); } .down { color: var(--bad); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--muted-soft); color: var(--fg-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.ink { background: var(--ink-soft); color: var(--ink); }
.badge.haldi { background: var(--haldi-soft); color: var(--warn); }
.grade { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-weight: 700; font-size: 12px; border: 1px solid var(--line-strong); }
.grade.A { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.grade.B { background: var(--info-soft); color: var(--info); border-color: transparent; }
.grade.C { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.grade.D { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.bar { height: 6px; border-radius: 3px; background: var(--muted-soft); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bar.warn > i { background: var(--haldi); } .bar.bad > i { background: var(--bad); } .bar.ok > i { background: var(--ok); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--fg-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 650; }
.tabs button .count { margin-left: 6px; font-size: 11px; background: var(--muted-soft); border-radius: 999px; padding: 1px 7px; color: var(--fg-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--fg-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
:root[data-theme="dark"] .chip.on { color: #0b1714; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { color: #0b1714; } }
.chip .x { margin-left: 4px; opacity: .7; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--fg); border: 1px solid transparent; }
.callout.warn { background: var(--warn-soft); } .callout.bad { background: var(--bad-soft); } .callout.ok { background: var(--ok-soft); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--fg-3); } .kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 16px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--ink); background: var(--surface); margin-top: 2px; }
.tl-dot.haldi { border-color: var(--haldi); } .tl-dot.ok { border-color: var(--ok); } .tl-dot.muted { border-color: var(--line-strong); }

/* ---------- Data grid ---------- */
.dg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; }
.dg-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dg-search { display: flex; align-items: center; gap: 6px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0 10px; background: var(--surface); flex: 1 1 220px; max-width: 320px; min-width: 0; }
.dg-search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; }
.dg-search svg { width: 15px; height: 15px; color: var(--fg-3); flex: none; }
.dg-quick { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: var(--surface-2); }
.dg-bulk { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--ink-soft); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dg-wrap { overflow: auto; max-height: min(68vh, 760px); min-width: 0; }
.dg table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.dg th, .dg td { padding: 0 10px; height: 38px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.dg.compact th, .dg.compact td { height: 30px; padding: 0 8px; font-size: 12.5px; }
.dg.comfy th, .dg.comfy td { height: 46px; }
.dg th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-2); font-weight: 650; user-select: none; }
.dg th.sortable { cursor: pointer; }
.dg th.sortable:hover { color: var(--fg); }
.dg th .th-in { display: inline-flex; align-items: center; gap: 4px; }
.dg th .sort-ico { width: 12px; height: 12px; opacity: .35; }
.dg th.sorted .sort-ico { opacity: 1; color: var(--ink); }
.dg th .sort-n { font-size: 9px; color: var(--ink); }
.dg th .flt-btn { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--fg-3); display: inline-grid; place-items: center; border-radius: 3px; }
.dg th .flt-btn.on { color: var(--haldi); }
.dg th .flt-btn svg { width: 12px; height: 12px; }
.dg td.r, .dg th.r { text-align: right; }
.dg td.r .th-in, .dg th.r .th-in { flex-direction: row-reverse; }
.dg td.c, .dg th.c { text-align: center; }
.dg tbody tr { cursor: default; }
.dg tbody tr.clickable { cursor: pointer; }
.dg tbody tr:hover td { background: var(--surface-2); }
.dg tbody tr.sel td { background: var(--ink-soft); }
.dg .sticky-l { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.dg th.sticky-l { z-index: 3; background: var(--surface-2); }
.dg tbody tr:hover td.sticky-l { background: var(--surface-2); }
.dg tbody tr.sel td.sticky-l { background: var(--ink-soft); }
.dg .cb { width: 36px; text-align: center; padding: 0 6px; }
.dg .cb input { width: 15px; height: 15px; accent-color: var(--ink); cursor: pointer; }
.dg .act { width: 1%; text-align: right; }
.dg tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; z-index: 1; }
.dg .grp td { background: var(--muted-soft); font-weight: 650; font-size: 12.5px; cursor: pointer; }
.dg .link { color: var(--ink); font-weight: 600; cursor: pointer; }
.dg .link:hover { text-decoration: underline; }
.dg-foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--fg-2); flex-wrap: wrap; }
.dg-foot select { border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); height: 28px; }
.pager { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.pager button { min-width: 30px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; cursor: pointer; }
.pager button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager button[disabled] { opacity: .4; cursor: default; }
.dg-empty { padding: 40px 16px; text-align: center; color: var(--fg-3); }
.dg-cards { display: none; }
@media (max-width: 760px) {
  .dg.auto-cards .dg-wrap { display: none; }
  .dg.auto-cards .dg-cards { display: flex; flex-direction: column; }
  .dg-search { max-width: none; }
}
.dg-card { padding: 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: start; }
.dg-card .t { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.dg-card .s { color: var(--fg-2); font-size: 12.5px; grid-column: 2; min-width: 0; }
.dg-card .v { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.dg-card .m { grid-column: 2 / 4; display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; color: var(--fg-3); }
.dg-card .m b { color: var(--fg-2); font-weight: 600; }
.dg-card input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--ink); }

/* ---------- Popovers, modals, drawers ---------- */
.pop-anchor { position: relative; display: inline-flex; }
.pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); min-width: 220px; max-width: min(320px, 90vw); padding: 6px; max-height: 60vh; overflow: auto; }
.pop.left { right: auto; left: 0; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-size: 13.5px; }
.pop-item:hover { background: var(--surface-2); }
.pop-item svg { width: 16px; height: 16px; color: var(--fg-3); flex: none; }
.pop-item .k { margin-left: auto; font-size: 11px; color: var(--fg-3); }
.pop-sep { height: 1px; background: var(--line); margin: 4px 0; }
.pop-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); padding: 6px 10px 4px; font-weight: 650; }

.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(12,20,18,.42); display: flex; align-items: flex-start; justify-content: center; padding: max(40px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); width: 100%; max-width: 640px; display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal.wide { max-width: 980px; } .modal.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.drawer-ov { position: fixed; inset: 0; z-index: 70; background: rgba(12,20,18,.35); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(520px, 100vw); background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); animation: slideIn .18s ease-out; }
@keyframes slideIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) {
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.toasts { position: fixed; z-index: 90; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: max(20px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
@media (max-width: 760px) { .toasts { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); } }
.toast { background: var(--rail); color: #fff; padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; max-width: 420px; font-size: 13.5px; animation: slideIn .18s; }
.toast svg { width: 18px; height: 18px; color: var(--haldi); flex: none; }

/* command palette */
.cmdk { max-width: 620px; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; min-width: 0; }
.cmdk-in svg { width: 18px; height: 18px; flex: none; color: var(--fg-3); }
.cmdk-in input { color: var(--fg); height: 28px; padding: 0; box-shadow: none; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-item.on { background: var(--ink-soft); }
.cmdk-item .p { font-size: 11.5px; color: var(--fg-3); }
.cmdk-item svg { width: 16px; height: 16px; color: var(--fg-3); flex: none; }

/* ---------- Mobile shell ---------- */
.bottom-nav { display: none; }
.fab { display: none; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .rail { position: fixed; z-index: 75; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s; padding-top: env(safe-area-inset-top, 0px); }
  .shell.drawer-open .rail { transform: none; }
  .shell.collapsed { --rail-w: 232px; }
  .collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-chev, .collapsed .nav-sub { display: revert; }
  .rail-scrim { position: fixed; inset: 0; z-index: 74; background: rgba(0,0,0,.4); }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); padding-top: 14px; }
  .page-title { font-size: 22px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .bottom-nav button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 10.5px; color: var(--fg-3); cursor: pointer; }
  .bottom-nav button svg { width: 21px; height: 21px; }
  .bottom-nav button.on { color: var(--ink); font-weight: 650; }
  .fab { display: grid; place-items: center; position: fixed; z-index: 31; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(72px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; border-radius: 16px; background: var(--haldi); color: #241703; border: 0; box-shadow: var(--shadow-pop); cursor: pointer; }
  .fab svg { width: 24px; height: 24px; }
  .page-actions { margin-left: 0; width: 100%; }
  .topbar .ctx-select { display: none; }
}

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--fg-3); font-size: 10.5px; font-family: var(--font-body); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-l { stroke: var(--line-strong); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* loom board */
.loom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.loom { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-width: 0; position: relative; }
.loom:hover { border-color: var(--ink); }
.loom .lno { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.loom .lq { font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loom .state { position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.loom.idle .state { background: var(--fg-3); }
.loom.change .state { background: var(--haldi); }
.loom.alert .state { background: var(--bad); }
.loom.alert { border-color: var(--bad); }

/* kanban for beams */
.kanban { display: grid; grid-template-columns: repeat(8, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; max-height: 640px; }
.kcol-h { padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-weight: 650; border-bottom: 1px solid var(--line); }
.kcol-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.kcard:hover { border-color: var(--ink); }

/* document preview (invoice) */
.doc { background: #fff; color: #1a1a1a; border: 1px solid var(--line); border-radius: 4px; padding: 24px; font-size: 12.5px; max-width: 820px; margin: 0 auto; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th, .doc td { border: 1px solid #c9c9c9; padding: 5px 7px; text-align: left; }
.doc .r { text-align: right; }
.doc h2 { font-family: var(--font-display); margin: 0; font-size: 20px; }
.doc-wrap { overflow-x: auto; }

/* misc */
.empty { text-align: center; padding: 40px 16px; color: var(--fg-3); }
.step-bar { display: flex; gap: 0; counter-reset: s; overflow-x: auto; }
.step { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--fg-3); font-weight: 600; font-size: 13px; border-bottom: 3px solid var(--line); white-space: nowrap; }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--muted-soft); font-size: 12px; }
.step.on { color: var(--ink); border-color: var(--ink); } .step.on .n { background: var(--ink); color: #fff; }
.step.done { color: var(--ok); border-color: var(--ok); } .step.done .n { background: var(--ok); color: #fff; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; font-variant-numeric: tabular-nums; }
.totals .gt { font-family: var(--font-display); font-size: 20px; font-weight: 700; border-top: 1px solid var(--line-strong); padding-top: 8px; }
.sticky-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; z-index: 5; border-radius: 0 0 var(--r) var(--r); }
.entry-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.entry-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.entry-table td { padding: 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.entry-table tr.has-note td { border-bottom: 0; }
.entry-table input, .entry-table select { height: 32px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: var(--surface); width: 100%; min-width: 64px; }
.entry-table input:focus, .entry-table select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink-soft); }
.scroll-x { overflow-x: auto; min-width: 0; }
.lang-gu { font-family: "Noto Sans Gujarati", var(--font-body); }
.topbar > .row { flex-wrap: nowrap; gap: 4px; }
@media (max-width: 760px) { .topbar { gap: 6px; } .search-trigger { flex: 1 1 auto; } }
.grid-21 { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 16px; }
@media (max-width: 1000px) { .grid-21 { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 760px) {
  .sticky-foot { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .shell:has(.sticky-foot) .fab { display: none; }
}
.badge.muted { background: var(--muted-soft); color: var(--fg-2); }
.callout.info { background: var(--info-soft); }
.entry-table input[type=checkbox], .entry-table input[type=radio] { width: 18px; height: 18px; min-width: 0; accent-color: var(--ink); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.linkish:hover { text-decoration-color: currentColor; }

/* ---------- horizontal (top) menu layout ---------- */
@media (min-width: 761px) {
  .shell.layout-top { grid-template-columns: minmax(0,1fr); }
  .shell.layout-top .rail { display: none; }
}
.top-brand { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 0 6px 0 0; cursor: pointer; flex: none; }
.top-brand .brand-mark { width: 28px; height: 28px; }
.top-brand .brand-name { color: var(--fg); font-size: 16px; line-height: 1.05; text-align: left; }
.hnav { position: relative; flex: none; z-index: 19; display: flex; align-items: center; gap: 2px; background: var(--rail); color: var(--rail-fg); border-bottom: 1px solid rgba(255,255,255,.06); padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); height: 44px; }
.hnav-sec { position: relative; height: 100%; display: flex; align-items: center; }
.hnav-btn, .hnav-quick { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 0; background: none; color: inherit; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.hnav-btn .ico { width: 16px; height: 16px; opacity: .85; }
.hnav-btn .hnav-chev { width: 12px; height: 12px; transform: rotate(90deg); opacity: .6; }
.hnav-btn:hover, .hnav-btn.open, .hnav-quick:hover { background: var(--rail-hover); color: #fff; }
.hnav-btn.active { color: #fff; box-shadow: inset 0 -2px 0 var(--haldi); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.hnav-quick { font-size: 12.5px; color: #a9b6b0; }
.hnav-quick.active { color: var(--haldi); font-weight: 600; }
@media (max-width: 1180px) { .hnav-quick { display: none; } }
@media (max-width: 960px) { .hnav-btn .ico { display: none; } .hnav-btn { padding: 0 8px; } }
.mega { position: absolute; top: 100%; left: 0; z-index: 70; display: grid; gap: 4px 18px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 0 var(--r) var(--r) var(--r); box-shadow: var(--shadow-pop); padding: 14px 16px; width: max-content; max-width: min(860px, calc(100vw - 32px)); }
.mega.cols-1 { grid-template-columns: minmax(200px, 1fr); }
.mega.cols-2 { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
.mega.cols-3 { grid-template-columns: repeat(3, minmax(190px, 1fr)); }
.mega.cols-4 { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.mega.right { left: auto; right: 0; border-radius: var(--r) 0 var(--r) var(--r); }
.mega-col { display: flex; flex-direction: column; min-width: 0; }
.mega-h { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); font-weight: 650; padding: 4px 8px 6px; }
.mega-h .ico { width: 14px; height: 14px; }
.mega-link { display: flex; align-items: center; gap: 9px; border: 0; background: none; color: var(--fg); text-align: left; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.mega-link .ico { width: 16px; height: 16px; color: var(--fg-3); }
.mega-link:hover { background: var(--surface-2); }
.mega-link.active { color: var(--ink); font-weight: 600; background: var(--ink-soft); }
.mega-link.strong { font-weight: 550; }
@media (min-width: 761px) and (max-width: 1050px) { .topbar .ctx-select[title="Financial year"] { display: none; } }
.topbar { flex: none; }
/* Taka entry & folding: folded-metre difference and the per-row checking panel */
.pe-table td { vertical-align: top; }
.pe-diff { font-size: 11px; color: var(--fg-3); margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pe-diff.down { color: var(--bad); }
.icon-btn.pe-chk { width: 30px; height: 30px; }
.icon-btn.pe-chk.on { background: var(--ink-soft); border-color: var(--ink); color: var(--ink); }
.pe-dot { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--warn); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.pe-dot.plain { background: var(--fg-3); }
.pe-panel > td { background: var(--surface-2); padding-top: 0 !important; }
.pe-ck { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.pe-ck-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pe-defs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.pe-ck-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; }
.pe-ck-grid > .field { flex: 0 1 190px; min-width: 0; }
.pe-ck-grid > .pe-wide { flex: 0 0 auto; }
.pe-ck-grid > .pe-rem { flex: 1 1 220px; }

/* ===================== Role apps: sign-in, platform console, owner extras, floor apps ===================== */
.si { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 0.9fr) 1.4fr; background: var(--bg); }
.si-brand { background: var(--ink-2); color: #fff; padding: 48px 44px; display: flex; flex-direction: column; gap: 18px; }
.si-brand h1 { font-family: var(--font-display); font-size: 34px; line-height: 1.15; margin: 24px 0 0; letter-spacing: -.02em; text-wrap: balance; }
.si-brand p { color: #cfe0dc; max-width: 46ch; margin: 0; }
.si-langs { display: flex; gap: 6px; margin-top: auto; }
.si-langs button { border: 1px solid rgba(255,255,255,.3); background: none; color: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.si-langs button.on { background: var(--haldi); color: #13221f; border-color: var(--haldi); }
.si-main { padding: 40px; display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 28px; align-items: start; }
.si-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.si-card h2 { margin: 0 0 4px; font-family: var(--font-display); }
.si-roles { display: flex; flex-direction: column; gap: 8px; }
.si-role { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 14px; cursor: pointer; color: var(--fg); font: inherit; }
.si-role:hover { border-color: var(--ink); }
.si-ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--ink-soft); color: var(--ink); flex: none; }
.si-ic.sm { width: 34px; height: 34px; }
@media (max-width: 1000px) { .si { grid-template-columns: 1fr; } .si-main { grid-template-columns: 1fr; padding: 20px 16px; } .si-brand { padding: 28px 20px; } }

.role-bar { display: flex; align-items: center; gap: 10px; padding: 6px 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }

.pb-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pb-tbl th, .pb-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.pb-tbl th { color: var(--fg-3); font-weight: 600; font-size: 12.5px; }
.pb-tbl .r { text-align: right; } .pb-tbl tr.off td { opacity: .5; } .pb-tbl tfoot td { border-bottom: 0; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dev-card { padding: 14px; }
.pair-code { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: .15em; text-align: center; padding: 10px; margin-top: 8px; border: 2px dashed var(--haldi); border-radius: 8px; background: var(--haldi-soft); }

.linkrow { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; flex-wrap: nowrap; color: var(--fg); font: inherit; }
.ent { display: flex; flex-direction: column; }
.ent-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ent-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.plan-card { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.plan-card h3 { margin: 0; font-family: var(--font-display); font-size: 20px; }
.plan-card ul { margin: 6px 0; padding-left: 18px; font-size: 13px; color: var(--fg-2); }
.plan-price { width: 110px; font-size: 22px; font-weight: 700; height: 40px; }
.msg { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); max-width: 85%; }
.msg.me { align-self: flex-end; background: var(--ink-soft); }

/* karigar phone */
.ph-wrap { min-height: 100vh; background: var(--bg); }
.phone { width: 390px; max-width: 100%; height: 800px; margin: 20px auto; border: 10px solid #1d2622; border-radius: 38px; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.ph-top { background: var(--ink-2); color: #fff; padding: 18px 14px 14px; }
.ph-top .avatar { background: var(--haldi); color: #13221f; width: 40px; height: 40px; }
.ph-lang { display: flex; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; overflow: hidden; }
.ph-lang button { background: none; border: 0; color: #fff; padding: 4px 9px; cursor: pointer; font: inherit; font-size: 13px; }
.ph-lang button.on { background: var(--haldi); color: #13221f; }
.ph-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ph-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 10px; }
.ph-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); margin-top: 6px; }
.ph-alert { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 0; background: var(--bad); color: #fff; cursor: pointer; font: inherit; animation: pulse 1.4s infinite; }
.ph-loom { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1px solid var(--line); border-left: 6px solid var(--ok); background: var(--surface); border-radius: 14px; padding: 12px; cursor: pointer; color: var(--fg); font: inherit; }
.ph-loom.stop { border-left-color: var(--bad); } .ph-loom.beam, .ph-loom.trial { border-left-color: var(--haldi); }
.ph-st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.ph-loom.stop .ph-st { background: var(--bad-soft); color: var(--bad); } .ph-loom.beam .ph-st, .ph-loom.trial .ph-st { background: var(--haldi-soft); color: var(--warn); }
.ph-loom-nums, .ph-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 4px; }
.ph-loom-nums div, .ph-kpis div { display: flex; flex-direction: column; } .ph-loom-nums b { font-size: 16px; } .ph-loom-nums span, .ph-kpis span { font-size: 11.5px; color: var(--fg-3); }
.ph-kpis div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; } .ph-kpis b { font-size: 22px; }
.ph-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph-quick button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--fg); text-align: center; }
.ph-quick .ico { width: 24px; height: 24px; color: var(--ink); }
.ph-list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ph-li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ph-li:last-child { border-bottom: 0; }
.ph-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--surface); padding-bottom: 6px; }
.ph-tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; cursor: pointer; font: inherit; font-size: 12px; color: var(--fg-3); }
.ph-tabs button.on { color: var(--ink); font-weight: 700; }
.reason-grid, .act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reason-grid button, .act-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 86px; padding: 8px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; color: var(--fg); text-align: center; }
.reason-grid button.on { border-color: var(--ink); background: var(--ink-soft); }
.act-grid button.ok { background: var(--ok); color: #fff; border-color: var(--ok); } .act-grid button.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.act-grid small { font-weight: 400; opacity: .8; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }

/* shared floor screens: fixed high-contrast dark look for the shop floor */
.st-wrap { min-height: 100vh; background: #0b1311; }
.st { --s-bg: #0b1311; --s-card: #15211d; --s-line: #2a3833; --s-fg: #eef4f1; --s-mut: #9fb0a9; --s-ok: #2fae62; --s-bad: #e0503f; --s-warn: #e5a630; color: var(--s-fg); background: var(--s-bg); min-height: calc(100vh - 45px); display: flex; flex-direction: column; font-size: 16px; }
.st .muted { color: var(--s-mut); }
.st .btn { background: var(--s-card); color: var(--s-fg); border-color: var(--s-line); height: 44px; font-size: 15px; }
.st .btn.primary { background: var(--haldi); color: #13221f; border-color: var(--haldi); }
.st .btn.lg, .btn.lg { height: 52px; padding: 0 22px; font-size: 16px; }
.st .inp { background: #0f1916; color: var(--s-fg); border-color: var(--s-line); }
.st-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--s-line); flex-wrap: wrap; }
.st-net { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(47,174,98,.15); color: #7fe0a6; font-size: 14px; }
.st-net.off { background: rgba(224,80,63,.18); color: #ff9c8f; }
.st-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--s-mut); border: 1px dashed var(--s-line); padding: 4px 8px; border-radius: 6px; }
.st-lang { display: flex; border: 1px solid var(--s-line); border-radius: 999px; overflow: hidden; }
.st-lang button { background: none; border: 0; color: var(--s-fg); padding: 6px 12px; font: inherit; cursor: pointer; }
.st-lang button.on { background: var(--haldi); color: #13221f; }
.st-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px 20px; }
.st-tile { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 18px 20px; border-radius: 16px; border: 2px solid var(--s-line); border-top: 10px solid var(--s-ok); background: var(--s-card); color: var(--s-fg); cursor: pointer; font: inherit; }
.st-tile.stop { border-top-color: var(--s-bad); } .st-tile.beam, .st-tile.trial { border-top-color: var(--s-warn); }
.st-tile.flash { border-color: var(--s-bad); animation: stflash 1.1s infinite; }
@keyframes stflash { 0%, 100% { background: var(--s-card); } 50% { background: #3a1914; } }
.st-badge { margin-left: auto; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; background: rgba(47,174,98,.2); color: #7fe0a6; }
.st-tile.stop .st-badge { background: rgba(224,80,63,.22); color: #ff9c8f; } .st-tile.beam .st-badge, .st-tile.trial .st-badge { background: rgba(229,166,48,.2); color: #ffcf73; }
.st-who { display: flex; align-items: center; gap: 6px; color: var(--s-mut); }
.st-why { background: var(--s-bad); color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 10px; font-size: 18px; }
.st-why.soft { background: rgba(224,80,63,.2); color: #ffb2a8; font-size: 15px; }
.st-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: auto; }
.st-nums div { display: flex; flex-direction: column; } .st-nums b { font-size: 24px; } .st-nums span { font-size: 12.5px; color: var(--s-mut); }
.st .bar { background: #24312d; height: 8px; } .st .bar > i { background: var(--haldi); }
.st-foot { display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--s-line); align-items: center; flex-wrap: wrap; }
.st-foot button { display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-fg); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.st-last { color: var(--s-mut); font-size: 13px; }
.st-panel { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.st-panel h3 { margin: 0; }
.st .reason-grid.big, .st .act-grid.big { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.st .reason-grid button, .st .act-grid button { background: var(--s-card); border-color: var(--s-line); color: var(--s-fg); min-height: 130px; font-size: 18px; border-radius: 16px; }
.st .act-grid button.ok { background: var(--s-ok); border-color: var(--s-ok); } .st .act-grid button.bad { background: var(--s-bad); border-color: var(--s-bad); }
.st-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: #7fe0a6; }
.st-done h2 { font-size: 40px; margin: 0; } .st-done p { color: var(--s-fg); font-size: 20px; margin: 0 0 8px; }
.idn { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px; }
.idn-what { color: var(--s-mut); font-size: 15px; } .idn h2 { margin: 0; font-size: 26px; }
.idn-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; width: 100%; max-width: 900px; }
.idn-people button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 16px; border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-fg); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; background: var(--ink); }
.pin-dots { display: flex; gap: 16px; } .pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--s-mut); } .pin-dots i.on { background: var(--haldi); border-color: var(--haldi); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 92px); gap: 10px; }
.pin-pad button { height: 76px; border-radius: 16px; border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-fg); font-size: 28px; font-weight: 600; cursor: pointer; }
.pin-pad button.ok { background: var(--s-ok); border-color: var(--s-ok); }

/* folding station */
.fold-grid { flex: 1; display: grid; grid-template-columns: 260px 1fr 250px; min-height: 0; }
.fold-queue, .fold-side { border-right: 1px solid var(--s-line); display: flex; flex-direction: column; overflow-y: auto; }
.fold-side { border-right: 0; border-left: 1px solid var(--s-line); padding: 0 12px 12px; }
.fold-h { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--s-mut); padding: 14px 12px 8px; }
.fold-side .fold-h { padding-left: 0; }
.fold-q { text-align: left; border: 0; border-bottom: 1px solid var(--s-line); background: none; color: var(--s-fg); padding: 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.fold-q.on { background: var(--s-card); box-shadow: inset 4px 0 0 var(--haldi); }
.fold-main { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.empty-fold { align-items: center; justify-content: center; text-align: center; color: var(--s-mut); }
.fold-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fold-f { background: var(--s-card); border: 1px solid var(--s-line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fold-f span, .fold-lbl { color: var(--s-mut); font-size: 13px; } .fold-f b { font-size: 30px; } .fold-f small { color: var(--s-mut); }
.fold-f.in input { font-size: 30px; height: 48px; font-weight: 700; }
.fold-lbl { margin-bottom: 6px; }
.scale { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 16px; border: 2px solid var(--s-line); background: #0f1916; }
.scale.stable { border-color: var(--s-ok); } .scale.bad { border-color: var(--s-bad); }
.scale-l { display: flex; align-items: center; gap: 14px; flex: 1; }
.scale-v { font-family: var(--font-mono); font-size: 56px; font-weight: 600; line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.scale-v small { font-size: 20px; color: var(--s-mut); }
.scale-r { display: flex; align-items: center; gap: 14px; text-align: right; }
.scale-r b { font-size: 26px; }
.grade-row { display: flex; gap: 10px; }
.grade-row button { width: 84px; height: 60px; border-radius: 12px; border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-fg); font-size: 22px; font-weight: 700; cursor: pointer; }
.grade-row button.on { background: var(--haldi); color: #13221f; border-color: var(--haldi); }
.st .chip { background: var(--s-card); color: var(--s-fg); border-color: var(--s-line); padding: 8px 14px; font-size: 14px; }
.st .chip.on { background: var(--haldi); color: #13221f; border-color: var(--haldi); }
.st .callout.bad { background: rgba(224,80,63,.16); color: var(--s-fg); } .st .callout.warn { background: rgba(229,166,48,.14); color: var(--s-fg); }
.fold-tot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.fold-tot div { background: var(--s-card); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; } .fold-tot b { font-size: 20px; } .fold-tot span { font-size: 12px; color: var(--s-mut); }
.fold-done { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--s-line); font-size: 14px; }
.tlabel { display: flex; gap: 14px; align-items: center; border: 2px solid #000; border-radius: 6px; padding: 12px; background: #fff; color: #000; }

/* wall board */
.wall { background: #070d0b; color: #eef4f1; min-height: calc(100vh - 45px); display: flex; flex-direction: column; padding: 18px 24px; gap: 16px; }
.wall-head { display: flex; align-items: center; }
.wall-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.wall-kpis div { background: #121c19; border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; border-top: 6px solid #4b5b55; }
.wall-kpis div.ok { border-top-color: #2fae62; } .wall-kpis div.bad { border-top-color: #e0503f; } .wall-kpis div.warn { border-top-color: #e5a630; }
.wall-kpis span { color: #9fb0a9; } .wall-kpis b { font-size: 48px; line-height: 1.1; } .wall-kpis small { font-size: 22px; color: #9fb0a9; }
.wall-body { flex: 1; display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; align-content: start; }
.wall-loom { border-radius: 12px; padding: 12px; background: #173a27; display: flex; flex-direction: column; gap: 2px; font-size: 20px; }
.wall-loom b { font-size: 22px; } .wall-loom span { font-size: 18px; opacity: .9; }
.wall-loom.stop { background: #5a1e17; } .wall-loom.beam, .wall-loom.trial { background: #4e3a12; }
.wall-loom.flash { animation: wflash 1.1s infinite; }
@keyframes wflash { 0%, 100% { background: #5a1e17; } 50% { background: #a3352a; } }
.wall-side { background: #121c19; border-radius: 14px; padding: 14px 18px; }
.wall-side h3 { margin: 6px 0 10px; color: #9fb0a9; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; }
.wall-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #24312d; font-size: 18px; }
.wall-row.long { color: #ff9c8f; }
/* icon sizes inside the role apps (an Icon with a size prop keeps its own size) */
:is(.si, .role-bar, .ph-wrap, .st-wrap, .sa-shell, .dev-card, .ent, .plan-card, .linkrow) svg.ico:not([width]) { width: 18px; height: 18px; flex: none; }
.ph-tabs svg.ico:not([width]) { width: 22px; height: 22px; }
.st-foot svg.ico:not([width]), .st-net svg.ico:not([width]) { width: 22px; height: 22px; }
.ph-quick svg.ico:not([width]) { width: 24px; height: 24px; }
.st .btn svg.ico:not([width]) { width: 18px; height: 18px; }

/* ---------- sign-in page (live mode) ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg, #f4f3ef); }
.login-card { width: 400px; max-width: 100%; padding: 26px 26px 22px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; }
.login-card .btn.primary { width: 100%; justify-content: center; }
