/* NBD Projektijuht — disainisüsteem "paekivi, bituumen, kuusk, hi-vis".
 * Allikas: disainisüsteemi artefakt (tokens.json + components/bundle.css), porditud raamistikuvabaks CSS-iks.
 * Kihid: 1) tokenid  2) alus  3) komponendid (.nb-*)  4) äpi kest  5) Tailwindi sild  6) äpi-spetsiifiline.
 * Tailwindi sild kasutab `html`-eesliidet: (0,1,1) > Tailwindi (0,1,0), sõltumata Play CDN-i stiilide järjekorrast. */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Barlow:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

/* ============================ 1. TOKENID ============================ */
:root {
  --ground: #eeeae1;
  --surface: #fbfaf6;
  --surface-sunk: #e5e0d4;
  --line: #d9d3c6;
  --line-strong: #7d7666;
  --ink: #1b1a17;
  --ink-muted: #5e594f;
  --ink-faint: #a59e8f;
  --brand: #1f5138;
  --brand-hover: #173f2b;
  --on-brand: #f7f4ec;
  --brand-soft: #dfe8e0;
  --signal: #d2f03c;
  --on-signal: #1b1a17;
  --rail: #171714;
  --rail-raised: #26251f;
  --rail-line: #34332c;
  --rail-ink: #ece8de;
  --rail-muted: #948f82;
  --ok: #1d6a44;
  --ok-soft: #e0ebe2;
  --wait: #8a5600;
  --wait-soft: #f3e7cc;
  --back: #a3301b;
  --back-hover: #85260f;
  --back-soft: #f5ddd5;
  --future: #4c5763;
  --future-soft: #e2e5e8;
  --focus: #1b1a17;

  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-sans: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius-xs: 2px; --radius-sm: 4px; --radius-md: 6px;
  --shadow-float: 0 1px 0 rgba(27,26,23,0.04), 0 12px 32px -12px rgba(27,26,23,0.28);

  --rail-w: 248px;
  --tabbar-h: 64px;
}

/* ============================ 2. ALUS ============================ */
html { font-size: 16px; background: var(--ground); }
body { font-family: var(--font-sans); font-size: 15px; line-height: 22px; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
html *, html ::before, html ::after { border-color: var(--line); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.nb-mono, .nb-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nb-label { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.nb-ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================ 3. KOMPONENDID ============================ */
/* Button */
.nb-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 15px/1 var(--font-sans); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; text-decoration: none; }
.nb-btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 14px; }
.nb-btn-primary { background: var(--brand); color: var(--on-brand); }
.nb-btn-primary:hover { background: var(--brand-hover); }
.nb-btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.nb-btn-secondary:hover { background: var(--surface-sunk); }
.nb-btn-ghost { background: transparent; color: var(--brand); }
.nb-btn-ghost:hover { background: var(--brand-soft); }
.nb-btn-signal { background: var(--signal); color: var(--on-signal); }
.nb-btn-signal:hover { filter: brightness(.95); }
.nb-btn-danger { background: var(--back); color: #fff; }
.nb-btn-danger:hover { background: var(--back-hover); }
.nb-btn[disabled] { background: var(--surface-sunk); color: var(--ink-faint); border-color: transparent; cursor: not-allowed; filter: none; }
.nb-btn .nb-count { margin-left: 2px; font: 500 11px/18px var(--font-mono); padding: 0 6px; border-radius: var(--radius-xs); background: var(--ink); color: var(--surface); }
.nb-icon-btn { width: 40px; padding: 0; }

/* Segmented */
.nb-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); max-width: 100%; overflow-x: auto; }
.nb-seg button { height: 38px; padding: 0 var(--space-4); border: 0; background: transparent; font: 600 14px/1 var(--font-sans); color: var(--ink-muted); cursor: pointer; white-space: nowrap; }
.nb-seg button + button { border-left: 1px solid var(--line); }
.nb-seg button[aria-pressed="true"], .nb-seg button.active { background: var(--ink); color: var(--surface); }

/* StatusTag */
.nb-tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-xs); font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.nb-tag svg { width: 10px; height: 10px; flex: none; }
.nb-tag-ootel { background: var(--wait-soft); color: var(--wait); }
.nb-tag-kinnitatud, .nb-tag-aktiivne { background: var(--ok-soft); color: var(--ok); }
.nb-tag-tagasi { background: var(--back-soft); color: var(--back); }
.nb-tag-planeeritud { background: var(--future-soft); color: var(--future); }
.nb-tag-mustand { background: transparent; color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* StatStrip */
.nb-stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.nb-stat { position: relative; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); min-height: 148px; }
.nb-stat + .nb-stat { border-left: 1px solid var(--line); }
.nb-stat.hidden { display: none; }
.nb-stat-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.nb-stat-fig { font: 500 44px/40px var(--font-mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); margin-top: auto; }
.nb-stat-fig small { font-size: 15px; letter-spacing: 0; color: var(--ink-muted); margin-left: 6px; font-weight: 400; }
.nb-stat-note { font-size: 13px; line-height: 18px; color: var(--ink-muted); min-height: 18px; }
.nb-stat-flag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; padding: 2px 8px 2px 6px; background: var(--signal); color: var(--on-signal); border-radius: var(--radius-xs); font: 500 11px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }

/* QuickActions */
.nb-quick { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.nb-qa { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--surface); border: 0; text-align: left; cursor: pointer; font: 600 15px/20px var(--font-sans); color: var(--ink); transition: background .12s; min-width: 0; }
.nb-qa.hidden { display: none; }
.nb-qa:hover { background: var(--surface-sunk); }
.nb-qa-ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); color: var(--ink); flex: none; }
.nb-qa-txt { display: flex; flex-direction: column; min-width: 0; white-space: nowrap; }
.nb-qa-txt, .nb-qa-txt small { overflow: hidden; text-overflow: ellipsis; }
.nb-qa-txt small { font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
.nb-qa-primary { background: var(--brand); color: var(--on-brand); }
.nb-qa-primary:hover { background: var(--brand-hover); }
.nb-qa-primary .nb-qa-ico { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
.nb-qa-primary small { color: var(--on-brand); opacity: .8; }

/* Panel */
.nb-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.nb-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-5) var(--space-4); }
.nb-panel-head h2 { margin: 0; font: 600 28px/30px var(--font-display); color: var(--ink); }
.nb-panel-head .nb-label { display: block; margin-bottom: var(--space-1); }
.nb-panel-body { padding: 0 var(--space-5) var(--space-5); }
.nb-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; text-decoration: none; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 0; }
.nb-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.nb-empty { padding: var(--space-6) var(--space-5); text-align: center; color: var(--ink-muted); font-size: 14px; }

/* Table */
.nb-table { width: 100%; border-collapse: collapse; }
.nb-table th { text-align: left; padding: 10px var(--space-5); background: var(--surface-sunk); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 500 11px/16px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.nb-table td { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 15px; }
.nb-table tr:last-child td { border-bottom: 0; }
.nb-table tbody tr { transition: background .1s; }
.nb-table tbody tr[data-view-id], .nb-table tbody tr.clickable { cursor: pointer; }
.nb-table tbody tr:hover { background: var(--ground); }
.nb-table .num, .nb-table th.num { text-align: right; }
.nb-table-dense th, .nb-table-dense td { padding-left: 12px; padding-right: 12px; }
.nb-table-dense th:first-child, .nb-table-dense td:first-child { padding-left: 20px; }
.nb-table-dense th:last-child, .nb-table-dense td:last-child { padding-right: 16px; }
.nb-table td.date { font: 400 14px/20px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.nb-table td.date small { display: block; font-size: 11px; color: var(--ink-muted); letter-spacing: .06em; text-transform: uppercase; }
.nb-obj b { display: block; font-weight: 600; font-size: 16px; line-height: 22px; }
.nb-obj span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.nb-obj span .nb-ico { width: 14px; height: 14px; }
.nb-hours { font: 500 16px/20px var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-hours small { font-size: 12px; color: var(--ink-muted); margin-left: 3px; font-weight: 400; }
.nb-actions { display: flex; gap: 2px; align-items: center; white-space: nowrap; }
.nb-actions button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--ink-muted); border-radius: var(--radius-sm); cursor: pointer; }
.nb-actions button:hover { background: var(--surface-sunk); color: var(--ink); }
.nb-actions button.ok:hover { color: var(--ok); background: var(--ok-soft); }
.nb-actions button.danger:hover { color: var(--back); background: var(--back-soft); }
.nb-kind { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-xs); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; color: var(--ink-muted); white-space: nowrap; margin-right: 4px; }
.nb-kind .nb-ico { width: 13px; height: 13px; }
.nb-avatar { flex: none; width: 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; font: 500 12px/1 var(--font-mono); background: var(--surface-sunk); color: var(--ink); border: 1px solid var(--line); }
.nb-sub { display: inline-block; margin-top: 2px; font: 500 10px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 0 5px; border-radius: var(--radius-xs); background: var(--wait-soft); color: var(--wait); }
.nb-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-muted); }
.nb-foot b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.nb-pager { display: flex; align-items: center; gap: 2px; }
.nb-pager button { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); font: 500 13px/1 var(--font-mono); color: var(--ink-muted); cursor: pointer; }
.nb-pager button:hover:not([disabled]) { background: var(--surface-sunk); color: var(--ink); }
.nb-pager button[aria-current="page"] { background: var(--ink); color: var(--surface); }
.nb-pager button[disabled] { opacity: .35; cursor: not-allowed; }
.nb-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-5) var(--space-4); }
.nb-toolbar-r { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.nb-filter { padding: var(--space-4) var(--space-5) var(--space-5); background: var(--surface-sunk); border-top: 1px solid var(--line); }
.nb-menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-float); padding: 4px; z-index: 30; }
.nb-menu button { width: 100%; display: flex; align-items: center; gap: var(--space-2); height: 38px; padding: 0 var(--space-3); border: 0; background: transparent; border-radius: var(--radius-sm); font: 500 14px/1 var(--font-sans); color: var(--ink); cursor: pointer; text-align: left; }
.nb-menu button:hover { background: var(--surface-sunk); }
.nb-bulkbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0 var(--space-5) var(--space-4); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); background: var(--ink); color: var(--surface); border-radius: var(--radius-sm); font-size: 14px; }
.nb-bulkbar b { font-family: var(--font-mono); font-weight: 500; }

/* Page header */
.nb-phead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line-strong); margin-bottom: var(--space-5); }
.nb-phead h1 { margin: var(--space-2) 0 0; font: 600 44px/44px var(--font-display); letter-spacing: -.005em; color: var(--ink); }
.nb-phead-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: flex-end; }
.nb-stack { display: flex; flex-direction: column; gap: var(--space-5); }

/* Project card */
.nb-pcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; transition: border-color .12s; min-height: 200px; text-align: left; }
.nb-pcard:hover { border-color: var(--line-strong); }
.nb-pcard-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-5) 0; }
.nb-pcard h3 { margin: var(--space-3) var(--space-5) var(--space-3); font: 600 28px/30px var(--font-display); color: var(--ink); }
.nb-pcard-meta { padding: 0 var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-muted); }
.nb-pcard-meta span { display: inline-flex; align-items: center; gap: var(--space-2); }
.nb-pcard-meta .nb-ico { width: 15px; height: 15px; }
.nb-pcard-empty { color: var(--ink-faint); font-size: 14px; }
.nb-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }

/* Machine card — ProjectCardi sugulane: numbrimärk koodina, kehtivused, kolm näitajat */
.nb-mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: var(--space-5); }
.nb-mcard { cursor: default; min-height: 0; }
.nb-mcard:hover { border-color: var(--line); }
.nb-mcard.is-off h3 { color: var(--ink-muted); }
.nb-code { display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); font: 500 13px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.nb-code.empty { border-style: dashed; border-color: var(--line); color: var(--ink-faint); font-size: 11px; }
.nb-mcard-desc { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nb-mdocs { margin: auto 0 0; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nb-mdocs > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 22px; }
.nb-mdocs dt { font: 500 10px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.nb-mdocs dd { margin: 0; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 6px; font: 400 13px/20px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
.nb-mdocs .none, .nb-mfig .none { color: var(--ink-faint); }
.nb-mfig { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.1fr) minmax(0, 1.1fr); border-top: 1px solid var(--line); }
.nb-mfig > div { padding: var(--space-3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nb-mfig > div + div { border-left: 1px solid var(--line); }
.nb-mfig .nb-label { font-size: 10px; }
.nb-mfig b { font: 500 15px/22px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-mfig b small { font-size: 11px; color: var(--ink-muted); margin-left: 2px; font-weight: 400; }
.nb-mfig > div:first-child { padding-left: var(--space-5); }
.nb-mcard-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-2) var(--space-5); border-top: 1px solid var(--line); }
.nb-mcard-foot .nb-link .nb-ico { width: 15px; height: 15px; }
.nb-msearch { width: 240px; }

/* Haldusloendid (materjalid, ettevõtted, tegevuslogi) */
.nb-row-off .nb-obj b, .nb-row-off .nb-wmain b { color: var(--ink-muted); }
.nb-wunit b { font-size: 16px; }
.nb-code.nb-unit { text-transform: none; letter-spacing: 0; }
.nb-wunit small { letter-spacing: .04em; }
.nb-unit-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.nb-co-ids { font-size: 12px !important; }
.nb-co-ids .nb-mono { color: var(--ink); }
.nb-act-search { flex: 1 1 280px; max-width: 420px; }
.nb-act-count { font: 500 12px/1 var(--font-mono); color: var(--ink-muted); }
.nb-act-count:empty { display: none; }
.nb-person { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.nb-person .nb-obj { min-width: 0; }
.nb-person .nb-obj b { white-space: nowrap; }
.nb-act-gap { display: inline-block; width: 34px; height: 34px; flex: none; }
.nb-pend-m { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-4); }
.nb-pend-m .nb-btn-row .nb-btn { flex: 1; }
.nb-pend-m .nb-obj span { white-space: normal; }

/* Raportid */
.nb-rep-filter { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4); }
.nb-rep-periods { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.nb-scroll-x { overflow-x: auto; }
.nb-table th.n, .nb-table td.n { text-align: right; white-space: nowrap; }
.nb-table td.n { font: 500 15px/20px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.nb-table td.n small { font-size: 11px; color: var(--ink-muted); font-weight: 400; }
.nb-table td.t { font: 400 14px/20px var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-table td.muted { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.nb-sub-t { display: block; font: 400 11px/16px var(--font-mono); color: var(--ink-muted); }
.nb-table tfoot td { background: var(--surface-sunk); border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; }
.nb-table tfoot td.lbl { font: 500 11px/16px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.nb-table-report td { font-size: 14px; white-space: nowrap; }
.nb-table-report td.wrap, .nb-table-report td.muted { white-space: normal; min-width: 170px; }
.nb-table-report .nb-obj b { white-space: nowrap; }
.nb-table-report td.wrap .nb-obj b { white-space: normal; }
.nb-share { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.nb-share-bar { width: 120px; height: 6px; background: var(--surface-sunk); border-radius: 1px; overflow: hidden; }
.nb-share-bar i { display: block; height: 100%; background: var(--brand); }
.nb-rep-desc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-table-maint td.wrap { min-width: 220px; max-width: 420px; }
.nb-maint-worker .nb-toolbar:first-child { padding-top: var(--space-4) !important; }
@media (max-width: 1180px) { .nb-rep-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Kitsas arvutivaade (külgriba + ~450–750px sisu): numbririba 2×2, muidu jooksevad numbrid üle ääre */
@media (min-width: 769px) and (max-width: 1100px) {
  .nb-stats { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .nb-stat + .nb-stat { border-left: 0; }
  .nb-stats > .nb-stat:not(.hidden):nth-child(even) { border-left: 1px solid var(--line); }
  .nb-stats > .nb-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.nb-role b { font-size: 14px; font-weight: 500; line-height: 20px; }
.nb-me { margin-left: 8px; font: 500 10px/16px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 0 5px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); vertical-align: 2px; }
.nb-wavatar { width: 40px; height: 40px; font-size: 13px; }
.nb-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nb-btn-danger-text { color: var(--back) !important; }
.nb-actions button.nb-attn { color: var(--back); background: var(--back-soft); }
.nb-note { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; color: var(--ink); }
.nb-note .nb-ico { width: 16px; height: 16px; margin-top: 2px; color: var(--ink-muted); }
.nb-note-warn { background: var(--back-soft); border-color: transparent; }
.nb-note-warn .nb-ico { color: var(--back); }
.nb-act-user { display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; font-weight: 500; }
.nb-act-what { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nb-act-ent { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); white-space: nowrap; }
.nb-act-ent .nb-ico, .nb-act-tech .nb-ico { width: 15px; height: 15px; color: var(--ink-muted); }
.nb-act-what .nb-kind { margin-right: 0; }
.nb-act-tech { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-muted); white-space: nowrap; }

/* Toast + dialog */
.nb-toast { position: fixed; left: 50%; bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 10000; display: flex; align-items: center; gap: var(--space-3); max-width: min(560px, calc(100vw - 32px)); padding: var(--space-3) var(--space-4); background: var(--rail); color: var(--rail-ink); border-radius: var(--radius-sm); box-shadow: var(--shadow-float); font-size: 15px; animation: nbToastIn .18s ease-out; }
.nb-toast-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: var(--signal); color: var(--on-signal); border-radius: var(--radius-xs); }
.nb-toast-mark svg { width: 12px; height: 12px; }
@keyframes nbToastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.nb-dialog-back { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: var(--space-4); background: rgba(23,23,20,.55); }
.nb-dialog { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-float); overflow: hidden; }
.nb-dialog-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.nb-dialog-head h2 { margin: 0; font: 600 24px/26px var(--font-display); }
.nb-dialog-body { padding: var(--space-5); font-size: 16px; line-height: 24px; white-space: pre-line; color: var(--ink); }
.nb-dialog-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-4); }
.nb-dialog-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-xs); flex: none; }
.nb-dialog-mark svg { width: 14px; height: 14px; }
.nb-dialog-mark.err { background: var(--back-soft); color: var(--back); }
.nb-dialog-mark.ask { background: var(--surface-sunk); color: var(--ink); }
.nb-dialog-mark.danger { background: var(--back-soft); color: var(--back); }

/* Mobiili komponendid (disainisüsteemist) */
.nb-wlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border-top: 1px solid var(--line); }
.nb-wlist li + li { border-top: 1px solid var(--line); }
.nb-wrow { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: var(--space-3); align-items: center; min-height: 72px; padding: var(--space-3) var(--space-4); border: 0; background: transparent; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.nb-wrow:active { background: var(--ground); }
.nb-wdate { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); }
.nb-wdate b { font: 500 18px/20px var(--font-mono); }
.nb-wdate small { font: 500 9px/12px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.nb-wmain { min-width: 0; display: flex; flex-direction: column; }
.nb-wmain b { font-weight: 600; font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-wmain span { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-wside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.nb-wselect { display: flex; align-items: center; }
.nb-only-mobile { display: none; }

/* DayStrip — nädal telefonis (disainisüsteemist) */
.nb-dstrip { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; touch-action: pan-y; }
.nb-dstrip-d { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 76px; padding: var(--space-2) 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; font: inherit; position: relative; }
.nb-dstrip-d + .nb-dstrip-d { border-left: 1px solid var(--line); }
.nb-dstrip-d.we { background: repeating-linear-gradient(135deg, var(--surface-sunk) 0 1px, transparent 1px 7px); }
.nb-dstrip-w { font: 500 10px/14px var(--font-mono); letter-spacing: .08em; color: var(--ink-muted); }
.nb-dstrip-n { font: 500 18px/26px var(--font-mono); width: 32px; text-align: center; border-radius: var(--radius-xs); }
.nb-dstrip-d.today .nb-dstrip-n { background: var(--signal); color: var(--on-signal); }
.nb-dstrip-d.sel { background: var(--ink); color: var(--surface); }
.nb-dstrip-d.sel .nb-dstrip-w { color: var(--surface); opacity: .75; }
.nb-dstrip-m { display: flex; gap: 3px; height: 12px; align-items: center; }
.nb-dstrip-m > span { display: grid; }
.nb-dstrip-m svg { width: 9px; height: 9px; }
.nb-dstrip-m .nb-ev-ok { color: var(--ok); } .nb-dstrip-m .nb-ev-back { color: var(--back); } .nb-dstrip-m .nb-ev-future { color: var(--future); }
/* Valitud (tume) päeval: olekute heledad toonid, et kuju JA värv jääksid eristatavaks */
.nb-dstrip-d.sel .nb-ev-ok { color: #7fd1a2; } .nb-dstrip-d.sel .nb-ev-back { color: #f08b74; } .nb-dstrip-d.sel .nb-ev-future { color: #a9b4c0; }
.pl-wk-nav { display: flex; gap: 4px; }
.pl-wk-nav button { height: 40px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 600 14px/1 var(--font-sans); display: inline-grid; place-items: center; cursor: pointer; }
.pl-wk-nav button:nth-child(2) { flex: 1; }

/* Agenda — päeva tööd telefonis (disainisüsteemist) */
.nb-agenda-h { display: flex; justify-content: space-between; padding: 0 2px var(--space-2); }
.nb-agenda ol { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.nb-agenda-i { display: grid; grid-template-columns: 58px 1fr; grid-template-rows: auto auto; column-gap: var(--space-3); row-gap: var(--space-2); padding: var(--space-3) var(--space-4); cursor: pointer; }
.nb-agenda-i:active { background: var(--ground); }
.nb-agenda-i + .nb-agenda-i { border-top: 1px solid var(--line); }
.nb-agenda-i .nb-tag { grid-column: 2; justify-self: start; }
.nb-agenda-t { grid-row: span 2; display: flex; flex-direction: column; padding-right: var(--space-3); border-right: 1px solid var(--line-strong); }
.nb-agenda-t b { font: 500 15px/20px var(--font-mono); }
.nb-agenda-t small { font: 400 12px/16px var(--font-mono); color: var(--ink-muted); }
.nb-agenda-b { display: flex; flex-direction: column; min-width: 0; }
.nb-agenda-b b { font-size: 16px; line-height: 20px; font-weight: 600; }
.nb-agenda-b span { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-muted); }
.nb-agenda-empty { margin: 0; padding: var(--space-5) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); font-size: 14px; text-align: center; }

/* ============================ 4. ÄPI KEST ============================ */
/* Külgriba (arvuti ≥769px) */
#sidebar { display: none; }
.nb-rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; }
.nb-rail-brand { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-5) var(--space-5) var(--space-4); cursor: pointer; background: none; border: 0; color: inherit; text-align: left; }
.nb-rail-brand b { font: 700 26px/1 var(--font-display); letter-spacing: .02em; }
.nb-rail-brand span { font: 500 11px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--rail-muted); }
.nb-rail-co { display: block; margin: 0 var(--space-4) var(--space-3); color: var(--rail-muted); font: 500 10px/14px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-rail-co:empty { display: none; }
.nb-rail-controls { display: flex; align-items: center; gap: var(--space-2); margin: 0 var(--space-4) var(--space-3); }
.nb-rail-controls:empty { display: none; }
.nb-rail-scroll { flex: 1; overflow-y: auto; padding-bottom: var(--space-4); }
.nb-rail-sec { padding: var(--space-4) var(--space-5) var(--space-2); font: 500 10px/14px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--rail-muted); display: flex; align-items: center; gap: var(--space-2); }
.nb-rail-sec::after { content: ""; flex: 1; height: 1px; background: var(--rail-line); }
.nb-rail-nav { display: flex; flex-direction: column; padding: 0 var(--space-3); gap: 1px; }
.nb-rail-item { position: relative; display: flex; align-items: center; gap: var(--space-3); height: 38px; padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--rail-ink); font: 500 15px/1 var(--font-sans); text-decoration: none; cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.nb-rail-item.hidden, .nb-rail-group.hidden { display: none; }
.nb-rail-item .nb-ico { color: var(--rail-muted); }
.nb-rail-item:hover { background: var(--rail-raised); }
.nb-rail-item[aria-current="page"] { background: var(--rail-raised); font-weight: 600; }
.nb-rail-item[aria-current="page"] .nb-ico { color: var(--signal); }
.nb-rail-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; background: var(--signal); border-radius: 0 2px 2px 0; }
.nb-rail-item .nb-count { margin-left: auto; font: 500 11px/18px var(--font-mono); padding: 0 6px; border-radius: var(--radius-xs); background: var(--rail-raised); color: var(--rail-ink); border: 1px solid var(--rail-line); }
.nb-rail-item:focus-visible, .nb-rail-brand:focus-visible, .nb-rail-user button:focus-visible { outline-color: var(--signal); }
.nb-rail-user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--rail-line); }
.nb-rail-av { width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); background: var(--rail-raised); border: 1px solid var(--rail-line); display: grid; place-items: center; font: 600 13px/1 var(--font-mono); color: var(--rail-ink); cursor: pointer; }
.nb-rail-who { flex: 1; min-width: 0; cursor: pointer; }
.nb-rail-who b { display: block; font-size: 14px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-rail-who small { display: block; font: 500 10px/14px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--rail-muted); }
.nb-rail-user button.nb-rail-out { background: transparent; border: 0; color: var(--rail-muted); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.nb-rail-user button.nb-rail-out:hover { color: var(--rail-ink); background: var(--rail-raised); }

/* Kelluke + ettevõtte-valija (tume taust — külgribas ja mobiili ülaribas) */
.nb-bell { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--rail-ink); border-radius: var(--radius-sm); cursor: pointer; }
.nb-bell:hover { background: var(--rail-raised); }
.nb-bell:focus-visible { outline-color: var(--signal); }
#notifBadge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; background: var(--rail-ink); color: var(--rail); border-radius: var(--radius-xs); font: 500 10px/1 var(--font-mono); }
#notifBadge.hidden { display: none; }
#companySwitcher { height: 34px; max-width: 170px; min-height: 0; padding: 0 8px; background: var(--rail-raised); color: var(--rail-ink); border: 1px solid var(--rail-line); border-radius: var(--radius-sm); font: 500 13px/1 var(--font-sans); }
#notifDropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: 90vw; max-height: 420px; overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-float); z-index: 50; }
#notifDropdown.hidden { display: none; }

/* Mobiili ülariba */
.nb-mtop { display: none; }

/* Mobiili alumine riba */
.nb-tabs { display: none; }
.nb-tab { position: relative; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--rail-muted); background: transparent; border: 0; cursor: pointer; font: inherit; min-width: 0; }
.nb-tab.hidden { display: none; }
.nb-tab-l { font: 500 11px/14px var(--font-sans); letter-spacing: .01em; white-space: nowrap; }
.nb-tab .nb-ico { width: 22px; height: 22px; }
.nb-tab[aria-current="page"] { color: var(--rail-ink); }
.nb-tab[aria-current="page"] .nb-ico { color: var(--signal); }
.nb-tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px; background: var(--signal); }
.nb-tab:focus-visible, .nb-fab:focus-visible { outline-color: var(--signal); outline-offset: -4px; }
.nb-fab { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 0 0 9px; border: 0; background: transparent; color: var(--rail-ink); cursor: pointer; font: inherit; }
.nb-fab-sq { width: 54px; height: 54px; margin-top: -24px; display: grid; place-items: center; background: var(--signal); color: var(--on-signal); border-radius: var(--radius-sm); box-shadow: 0 0 0 5px var(--rail); }
.nb-fab-sq .nb-ico { width: 24px; height: 24px; stroke-width: 2.2; }

/* "Menüü" alt-üles leht */
.more-sheet-overlay { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(23,23,20,.55); align-items: flex-end; justify-content: center; }
.more-sheet-overlay.open { display: flex; }
.more-sheet { width: 100%; max-height: 85vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius-md) var(--radius-md) 0 0; padding: var(--space-2) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom)); animation: sheetUp .22s ease-out; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.more-grabber { width: 40px; height: 4px; background: var(--line-strong); border-radius: 2px; margin: 6px auto 10px; }
.more-profile { display: flex; align-items: center; gap: var(--space-3); padding: 4px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.more-avatar { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--rail); color: var(--rail-ink); display: grid; place-items: center; font: 600 14px/1 var(--font-mono); flex-shrink: 0; }
.more-name { font-weight: 600; color: var(--ink); font-size: 16px; }
.more-role { font: 500 10px/14px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.more-group { font: 500 10px/14px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); padding: 12px 12px 4px; }
.more-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; background: none; border: none; text-align: left; color: var(--ink); font: 500 16px/1 var(--font-sans); border-radius: var(--radius-sm); cursor: pointer; }
.more-item:active { background: var(--surface-sunk); }
.more-item .nb-ico { width: 20px; height: 20px; color: var(--ink-muted); }
.more-item.hidden, .more-group.hidden { display: none; }
.more-footer { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }
.more-logout, .more-logout .nb-ico { color: var(--back); }

/* Sisu ala */
.app-content { padding: var(--space-6) var(--space-7) var(--space-7); max-width: 1480px; }

@media (min-width: 769px) {
  #sidebar { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w); z-index: 35; }
  #appContainer.active { padding-left: var(--rail-w); }
  .notif-dd-sidebar { position: fixed !important; left: calc(var(--rail-w) + 8px) !important; top: 16px !important; right: auto !important; }
}

@media (max-width: 768px) {
  .nb-mtop { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--space-2); height: 56px; padding: 0 var(--space-2) 0 var(--space-4); padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box; background: var(--rail); color: var(--rail-ink); }
  .nb-mtop-brand { font: 700 24px/1 var(--font-display); letter-spacing: .02em; background: none; border: 0; color: inherit; padding: 0; cursor: pointer; }
  .nb-mtop-ctrls { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
  .nb-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--rail); border-top: 1px solid var(--rail-line); }
  .app-content { padding: var(--space-5) var(--space-4) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--space-6)); }
  .nb-phead { flex-direction: column; align-items: stretch; gap: var(--space-3); padding-bottom: var(--space-3); }
  .nb-phead h1 { font-size: 36px; line-height: 36px; }
  .nb-phead-actions { justify-content: flex-start; }
  .nb-stats { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .nb-stat { min-height: 0; padding: var(--space-4); gap: var(--space-2); }
  .nb-stat + .nb-stat { border-left: 0; }
  .nb-stats > .nb-stat:not(.hidden):nth-child(even) { border-left: 1px solid var(--line); }
  .nb-stats > .nb-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .nb-stat-fig { font-size: 32px; line-height: 32px; margin-top: var(--space-1); }
  .nb-stat .nb-label { font-size: 10px; letter-spacing: .06em; }
  .nb-quick { grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); overflow-x: auto; }
  .nb-grid3 { grid-template-columns: 1fr; }
  .nb-msearch { width: 100%; order: -1; }
  .nb-act-search { max-width: none; flex-basis: 100%; }
  .nb-rep-filter { grid-template-columns: 1fr 1fr; }
  .nb-rep-filter > div:nth-child(3) { grid-column: 1 / -1; }
  .nb-share-bar { width: 48px; }
  .nb-mcard-desc { display: none; }
  .nb-only-desktop { display: none !important; }
  .nb-hide-m { display: none !important; }
  #dashQuick { display: none; }
  /* Kerimisribad peidetud (sisu keritav sõrmega); ribad segavad vahelehtede ja tabelite all */
  ::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; }
  .nb-only-mobile { display: block; }
  .nb-panel-head { padding: var(--space-4) var(--space-4) var(--space-3); }
  .nb-panel-head h2 { font-size: 24px; line-height: 26px; }
  .nb-toolbar, .nb-filter { padding-left: var(--space-4); padding-right: var(--space-4); }
  .nb-foot { padding: var(--space-3) var(--space-4); }
  .nb-bulkbar { margin: 0 var(--space-4) var(--space-3); }
  .nb-toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--space-3)); }
  .nb-dialog-foot .nb-btn { flex: 1; height: 48px; }
}

/* ============================ 5. TAILWINDI SILD ============================ */
/* Pinnad */
html body.bg-gray-100 { background: var(--ground); }
html .bg-white { background-color: var(--surface); }
html .bg-gray-50, html .bg-slate-50 { background-color: var(--surface-sunk); }
html .bg-gray-100, html .bg-slate-100 { background-color: var(--surface-sunk); }
html .bg-gray-200, html .bg-gray-300 { background-color: var(--surface-sunk); }
html .bg-slate-900 { background-color: var(--rail); }
html .hover\:bg-gray-50:hover { background-color: var(--ground); }
html .hover\:bg-gray-100:hover, html .hover\:bg-gray-200:hover, html .hover\:bg-slate-100:hover { background-color: var(--surface-sunk); }
html .hover\:bg-gray-300:hover { background-color: var(--line); }
html .bg-black.bg-opacity-50, html .bg-black.bg-opacity-40, html .bg-black\/50, html .bg-slate-900\/50 { background-color: rgba(23,23,20,.55); }

/* Tekst */
html .text-gray-900, html .text-gray-800, html .text-gray-700, html .text-slate-900, html .text-slate-800, html .text-slate-700 { color: var(--ink); }
html .text-gray-600, html .text-gray-500, html .text-gray-400, html .text-gray-300, html .text-slate-600, html .text-slate-500, html .text-slate-400 { color: var(--ink-muted); }
html .hover\:text-gray-900:hover, html .hover\:text-gray-800:hover, html .hover\:text-gray-700:hover, html .hover\:text-gray-600:hover, html .hover\:text-slate-700:hover { color: var(--ink); }

/* Jooned */
html .border-gray-100, html .border-gray-200, html .border-slate-100, html .border-slate-200 { border-color: var(--line); }
html .border-gray-300, html .border-gray-400, html .border-slate-300 { border-color: var(--line-strong); }
html .divide-gray-100 > :not([hidden]) ~ :not([hidden]), html .divide-gray-200 > :not([hidden]) ~ :not([hidden]), html .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--line); }
html .ring-slate-100, html .ring-slate-200, html .ring-gray-200 { --tw-ring-color: var(--line); }

/* Bränd (kuusk) */
html .bg-green-600, html .bg-green-700, html .bg-green-800, html .bg-green-500 { background-color: var(--brand); }
html .hover\:bg-green-600:hover, html .hover\:bg-green-700:hover, html .hover\:bg-green-800:hover, html .hover\:bg-green-900:hover { background-color: var(--brand-hover); }
html .text-green-600, html .text-green-700, html .text-green-900 { color: var(--brand); }
html .hover\:text-green-700:hover, html .hover\:text-green-800:hover, html .hover\:text-green-900:hover { color: var(--brand-hover); }
html .bg-green-50 { background-color: var(--brand-soft); }
html .hover\:bg-green-50:hover { background-color: var(--brand-soft); }
html .border-green-200, html .border-green-500, html .border-green-600, html .border-green-700 { border-color: var(--brand); }
html .border-green-200 { border-color: var(--line); }

/* Staatused */
html .bg-green-100 { background-color: var(--ok-soft); }
html .text-green-800, html .text-green-500 { color: var(--ok); }
html .text-red-500, html .text-red-600, html .text-red-700, html .text-red-800, html .text-rose-700 { color: var(--back); }
html .hover\:text-red-700:hover, html .hover\:text-red-800:hover, html .hover\:text-red-900:hover { color: var(--back-hover); }
html .bg-red-50, html .bg-red-100, html .bg-rose-100 { background-color: var(--back-soft); }
html .hover\:bg-red-50:hover { background-color: var(--back-soft); }
html .bg-red-500, html .bg-red-600 { background-color: var(--back); }
html .hover\:bg-red-600:hover, html .hover\:bg-red-700:hover { background-color: var(--back-hover); }
html .border-red-200, html .border-red-400, html .border-red-500, html .ring-red-200 { border-color: var(--back); --tw-ring-color: var(--back-soft); }
html .text-yellow-500, html .text-yellow-600, html .text-yellow-700, html .text-yellow-800, html .text-amber-500, html .text-amber-600, html .text-amber-700, html .text-amber-800, html .text-orange-600, html .text-orange-800 { color: var(--wait); }
html .hover\:text-yellow-800:hover, html .hover\:text-orange-800:hover { color: var(--ink); }
html .bg-yellow-50, html .bg-yellow-100, html .bg-yellow-200, html .bg-amber-50, html .bg-amber-100, html .bg-orange-100 { background-color: var(--wait-soft); }
html .hover\:bg-yellow-50:hover { background-color: var(--wait-soft); }
html .bg-yellow-400, html .bg-yellow-500, html .bg-orange-500, html .bg-orange-600 { background-color: var(--wait); }
html .hover\:bg-yellow-600:hover, html .hover\:bg-orange-600:hover, html .hover\:bg-orange-700:hover { background-color: #6f4500; }
html .border-yellow-200, html .border-amber-200 { border-color: var(--line); }
html .bg-blue-100, html .bg-teal-100 { background-color: var(--future-soft); }
html .text-blue-600, html .text-blue-700, html .text-blue-800, html .text-teal-600, html .text-teal-700 { color: var(--future); }
html .bg-purple-50, html .bg-purple-100 { background-color: var(--surface-sunk); }
html .text-purple-600, html .text-purple-700, html .text-purple-800 { color: var(--ink); }
html .border-purple-500, html .border-blue-500, html .border-orange-500, html .border-teal-500 { border-color: var(--line-strong); }

/* Värvilised vasak-servad kaartidel on disainis keelatud → tavaline juuksejoon */
html .border-l-4, html .border-l-2 { border-left-width: 1px; border-left-color: var(--line); }

/* Nupud, mille Tailwindi värv tähendab "sekundaarne" */
html button.bg-gray-200, html button.bg-gray-100, html button.bg-gray-500, html a.bg-gray-200 { background-color: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
html button.bg-gray-200:hover, html button.bg-gray-100:hover, html button.bg-gray-500:hover { background-color: var(--surface-sunk); }

/* Nurgad: midagi pole ümaram kui 6px, pill-kujusid pole */
html .rounded, html .rounded-md { border-radius: var(--radius-sm); }
html .rounded-lg, html .rounded-xl, html .rounded-2xl, html .rounded-3xl { border-radius: var(--radius-md); }
html button.rounded-lg, html a.rounded-lg, html input.rounded-lg, html select.rounded-lg, html textarea.rounded-lg, html button.rounded-xl { border-radius: var(--radius-sm); }
html .rounded-full { border-radius: var(--radius-xs); }
html .animate-spin.rounded-full { border-radius: 50%; }
html .rounded-t-xl, html .rounded-t-lg { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }

/* Varjud: lamedad pinnad juuksejoontega; ainult hõljuvad kihid saavad varju */
html .shadow, html .shadow-sm, html .shadow-md, html .shadow-lg { box-shadow: none; }
html .bg-white.shadow, html .bg-white.shadow-sm, html .bg-white.shadow-md, html .bg-white.shadow-lg { border: 1px solid var(--line); }
html .shadow-xl, html .shadow-2xl, html .absolute.shadow-lg, html .absolute.shadow-md, html .absolute.shadow { box-shadow: var(--shadow-float); }
html .hover\:shadow-lg:hover, html .hover\:shadow-md:hover { box-shadow: none; border-color: var(--line-strong); }

/* Tüpograafia sektsioonides ja modaalides */
html .section h1 { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 44px; letter-spacing: -.005em; color: var(--ink); }
html .section h2, html .modal h2, html [id$="Modal"] h2, html [id$="modal"] h2 { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 28px; color: var(--ink); }
html .section h3 { font-weight: 600; }
html .section table th, html .modal table th, html [id$="Modal"] table th { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); background-color: var(--surface-sunk); }
html .section table td { font-size: 15px; }
html .section thead.bg-gray-50, html .section thead.bg-gray-100 { background-color: var(--surface-sunk); }
html .section table tbody tr:hover { background-color: var(--ground); }
html .font-mono { font-family: var(--font-mono); }

/* Vormid */
html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), html select, html textarea {
  min-height: 42px; background-color: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 15px;
}
html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), html select { padding-left: 12px; padding-right: 12px; }
html textarea { padding: 10px 12px; line-height: 22px; }
html input[readonly], html input:disabled, html select:disabled, html textarea:disabled { background-color: var(--surface-sunk); color: var(--ink-muted); }
html input::placeholder, html textarea::placeholder { color: var(--ink-muted); opacity: 1; }
html input:focus, html select:focus, html textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: none; }
html label.block { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px; }
html button { font-family: var(--font-sans); }
html .modal button.bg-green-700, html .modal button.bg-green-600, html .section button.bg-green-600, html .section button.bg-green-700 { font-weight: 600; }

/* ============================ 6. ÄPI-SPETSIIFILINE ============================ */
.page { display: none; }
.page.active { display: block; }
.modal { display: none; position: fixed; inset: 0; background: rgba(23,23,20,.55); z-index: 1000; }
.modal.active { display: flex; }
.overflow-x-auto { -webkit-overflow-scrolling: touch; }
.spinner { border: 3px solid var(--line); border-top: 3px solid var(--ink); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes scaleIn { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Piiratud (lukus) funktsioonid: nähtav, aga tuhm + lukk */
.feature-locked { opacity: .5; }
.nb-rail-item.feature-locked::after, .more-item.feature-locked::after { content: "\f023"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 11px; margin-left: auto; opacity: .9; }
.nb-tab.feature-locked::after { content: "\f023"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 9px; position: absolute; top: 10px; left: calc(50% + 8px); color: var(--rail-muted); }
.nb-qa.feature-locked .nb-qa-txt::after { content: " \f023"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 11px; }

/* Staatuse vahekaardid (.ws-tab) → Segmented; konteiner tuvastatakse :has() abil */
html :has(> .ws-tab) { display: inline-flex; padding: 0; gap: 0; background-color: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; overflow-x: auto; max-width: 100%; }
.ws-tab { height: 38px; padding: 0 var(--space-4); border: 0; background: transparent; font: 600 14px/1 var(--font-sans); color: var(--ink-muted); white-space: nowrap; cursor: pointer; }
.ws-tab + .ws-tab { border-left: 1px solid var(--line); }
.ws-tab:hover { color: var(--ink); background: var(--surface-sunk); }
.ws-tab.active, .ws-tab.active:hover { background: var(--ink); color: var(--surface); }
.ws-tab-count { margin-left: 6px; font: 500 11px/18px var(--font-mono); padding: 0 5px; border-radius: var(--radius-xs); background: var(--wait-soft); color: var(--wait); }
.ws-tab.active .ws-tab-count { background: var(--surface); color: var(--ink); }
.ws-tab-count.hidden { display: none; }
/* Eelarve vahelehed (.budget-tab; aktiivne = border-b-2) → sama segmenteeritud juhtelement */
html :has(> .budget-tab) { display: inline-flex; flex-wrap: nowrap; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; overflow-x: auto; max-width: 100%; margin: 16px 20px 0; background-color: var(--surface); border-bottom-width: 1px; }
html .budget-tab { height: 38px; padding: 0 16px; border: 0; border-bottom: 0; background: transparent; font: 600 14px/1 var(--font-sans); color: var(--ink-muted); white-space: nowrap; }
html .budget-tab + .budget-tab { border-left: 1px solid var(--line); }
html .budget-tab.border-b-2 { background: var(--ink); color: var(--surface); }
html .budget-tab i { display: none; }

/* Ekspordi-/impordinupud on alati sekundaarsed (disain: üks täidetud põhinupp vaate kohta) */
html button[onclick*="Pdf"], html button[onclick*="PDF"], html button[onclick*="Excel"], html button[onclick*="xport"] { background-color: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
html button[onclick*="Pdf"]:hover, html button[onclick*="PDF"]:hover, html button[onclick*="Excel"]:hover, html button[onclick*="xport"]:hover { background-color: var(--surface-sunk); }
html button[onclick*="Pdf"] i, html button[onclick*="Excel"] i { color: var(--ink-muted); }
.nb-menu button[onclick*="Pdf"], .nb-menu button[onclick*="Excel"] { box-shadow: none; }

.m-filter-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 4px; background: var(--ink); color: var(--surface); border-radius: var(--radius-xs); font: 500 11px/1 var(--font-mono); }
.m-filter-badge.hidden { display: none; }

/* Mobiil: tabelid → kaardid (JS lisab data-label'id) */
@media (max-width: 768px) {
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) thead { display: none; }
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) tbody tr { display: block; border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: var(--space-3); padding: 4px var(--space-4); background: var(--surface); }
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) tbody td { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: 10px 0; border: none; border-bottom: 1px solid var(--line); text-align: right; white-space: normal; }
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) tbody td:last-child { border-bottom: none; }
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) tbody td:empty { display: none; }
  .section table:not(.pl-cal):not(.pl-grid):not(.m-list):not(.nb-keep) tbody td::before { content: attr(data-label); font: 500 11px/16px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); text-align: left; flex-shrink: 0; }
  .m-list { font-size: 14px; width: 100%; }
  .m-list thead th, .m-list tbody td { padding: 10px 8px !important; white-space: nowrap; }
  .m-list .m-hide { display: none !important; }
  .m-list .ws-cell-trunc { display: block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .m-list tbody tr { cursor: pointer; }
  .m-list tbody tr:active { background: var(--ground); }
  .dt-yr { display: none; }
  .hide-mobile { display: none !important; }
  html .section h1 { font-size: 36px; line-height: 36px; }
  html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), html select, html textarea { min-height: 48px; font-size: 16px; }
  html textarea { min-height: 96px; }
  .modal .grid { grid-template-columns: 1fr !important; }
  input[type="date"], input[type="time"], input[type="datetime-local"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; }
  .modal > div { max-height: 100vh; max-height: 100dvh; border-radius: 0; margin: 0; height: 100%; }
  #worksheetModal > div { height: 100%; max-height: 100dvh; }
  html, body { overflow-x: hidden; overflow-x: clip; }
  button, .btn, input[type="submit"] { min-height: 44px; }
  .nb-actions button, .nb-pager button, .ws-tab { min-height: 0; }
}

/* ── Navirec: ühenduse täpp, masina kasutus, elav olek, töölehe vihjed ─────────────── */
.nb-nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 9999px; background: var(--ink-faint); margin-right: 7px; vertical-align: 1px; }
.nb-nav-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(29,106,68,.18); }
.nb-nav-status { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.nb-nav-status small { color: var(--ink-muted); }
select.nav-map.is-suggested { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(29,106,68,.15); }

.nb-usage { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nb-usage-top { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.nb-usage-top small { margin-left: auto; color: var(--ink-muted); font: 400 12px/16px var(--font-mono); white-space: nowrap; }
.nb-usage-figs { display: flex; gap: var(--space-5); }
.nb-usage-figs > div { display: flex; flex-direction: column; gap: 1px; }
.nb-usage-figs b { font: 500 18px/22px var(--font-mono); font-variant-numeric: tabular-nums; }
.nb-usage-figs b small { font-size: 11px; color: var(--ink-muted); margin-left: 2px; font-weight: 400; }
.nb-usage-bars { display: flex; align-items: flex-end; gap: 2px; height: 28px; }
.nb-usage-bars span { flex: 1 1 0; min-width: 2px; background: var(--line); border-radius: 1px 1px 0 0; }
.nb-usage-bars span[style*="height: 2%"] { background: var(--ground); }
.nb-usage-bars span.is-today { background: var(--brand); }
.nb-usage-note { color: var(--ink-faint); font-size: 12px; }

.nb-live-list { list-style: none; margin: 0; padding: 0; }
.nb-live { display: flex; align-items: center; gap: var(--space-3); padding: 9px var(--space-5); border-top: 1px solid var(--line); min-height: 48px; }
.nb-live:first-child { border-top: 0; }
.nb-live-dot { width: 9px; height: 9px; border-radius: 9999px; background: var(--ink-faint); flex: none; }
.nb-live.is-on .nb-live-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(29,106,68,.16); }
.nb-live.is-stale { opacity: .6; }
.nb-live-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.nb-live-main b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-live-main span { font-size: 12px; color: var(--ink-muted); }
.nb-live-side { display: flex; align-items: center; gap: var(--space-3); flex: none; }
.nb-live-side > small { color: var(--ink-faint); font: 400 12px/16px var(--font-mono); }
.nb-live-loc { display: inline-flex; color: var(--ink-muted); }
.nb-live-loc .nb-ico { width: 16px; height: 16px; }
@media (max-width: 480px) { .nb-live-side > small { display: none; } }

.machine-nav-hint { display: block; margin-top: 3px; font-size: 11px; line-height: 15px; color: var(--ok); }
.machine-nav-hint .nb-ico { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 2px; }
.ws-nav-warn { color: var(--back); font-size: 12px; white-space: nowrap; }
.ws-nav-warn .nb-ico { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; }
.ws-nav-ok { color: var(--ok); font-size: 12px; }
.ws-nav-ok .nb-ico { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; }
.ws-nav-none { color: var(--ink-faint); font-size: 12px; }

/* Segment raadionuppudest (nt masina kategooria) + masinate rühma pealkiri */
.nb-seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--space-3); height: 36px; font: 500 14px/1 var(--font-sans); cursor: pointer; color: var(--ink-muted); border-right: 1px solid var(--line-strong); }
.nb-seg-opt:last-child { border-right: 0; }
.nb-seg-opt:has(input:checked) { background: var(--ink); color: var(--surface); }
.nb-seg-opt input { margin: 0; accent-color: var(--brand); }
.nb-seg-opt:has(input:checked) input { accent-color: var(--surface); }
.nb-mgroup { padding: var(--space-4) 0 var(--space-2); }
.nb-mgroup + .nb-mgrid { margin-top: 0; }
.nb-mgroup:first-child { padding-top: 0; }
select.nav-map.is-new { border-color: var(--brand); background: #eef4ef; }

/* Ala kaardil (projekt / baas) */
.nb-geo-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.nb-geo-set { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.nb-geo-set .nb-ico { width: 15px; height: 15px; color: var(--brand); }
#geoPickerModal .leaflet-container { font: inherit; }
.ws-nav-times { display: block; margin-top: 4px; font-size: 12px; color: var(--ok); }
.ws-nav-times.is-warn { color: var(--back); }
.ws-nav-times .nb-ico { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 2px; }

/* Telefoni esmakasutuse soovitused (avaekraanile, teated) */
.nb-onb-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nb-onb-steps li { display: flex; align-items: center; gap: 10px; }
.nb-onb-steps li > span { flex: none; width: 22px; height: 22px; border-radius: 9999px; background: var(--ink); color: var(--surface); font: 600 12px/22px var(--font-mono); text-align: center; }
@media (max-width: 640px) { .nb-onb { border-bottom-left-radius: 0; border-bottom-right-radius: 0; } }

/* ===== Tõmba-värskenda (telefon) ===== */
.nb-ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 8px); width: 40px; height: 40px; margin-left: -20px; border-radius: 9999px; background: var(--surface); color: var(--brand); border: 1px solid var(--line); box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center; z-index: 90; transform: translateY(-56px); opacity: 0; pointer-events: none; }
.nb-ptr svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nb-ptr.is-armed { background: var(--brand); color: #fff; border-color: var(--brand); }
.nb-ptr.is-anim { transition: transform .2s ease, opacity .2s ease; }
.nb-ptr.is-busy svg { animation: nbPtrSpin .8s linear infinite; }
@keyframes nbPtrSpin { to { transform: rotate(360deg); } }
/* Brauseri enda tõmba-värskenda (Android Chrome) välja — muidu käivituks kaks korda */
@media (pointer: coarse) { html { overscroll-behavior-y: contain; } }

/* ===== Kokkuvolditav vormi osa (nt masina hinnad, dokumendid) ===== */
.nb-fold { border-top: 1px solid var(--line); padding: 10px 0; }
.nb-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; font: 600 14px/1.4 var(--font-sans); color: var(--ink); padding: 4px 0; }
.nb-fold > summary::-webkit-details-marker { display: none; }
.nb-fold > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--ink-muted); border-bottom: 2px solid var(--ink-muted); transform: rotate(-45deg); transition: transform .15s ease; flex: none; margin-right: 2px; position: relative; top: -1px; }
.nb-fold[open] > summary::before { transform: rotate(45deg); top: -3px; }
.nb-fold > summary small { font: 400 12px/1.4 var(--font-sans); color: var(--ink-muted); margin-left: auto; text-align: right; }
.nb-fold > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.nb-fold[open] > summary { margin-bottom: 10px; }
