/* NH Branch Portal - design system. Neutral black/grey palette (same as the NH MODON dashboard),
   status accents only for meaning (green = done, amber = waiting, red = needs action). */
:root {
  --ink: #111214; --ink-2: #2b2d31; --ink-3: #50535a; --muted: #7a7d85; --faint: #a3a6ad;
  --line: #e6e7ea; --line-2: #eff0f2; --bg: #f3f4f6; --surface: #fff; --soft: #f7f7f8; --hover: #f1f2f4;
  --ok: #157347; --ok-bg: #e8f5ee; --ok-line: #bfe3cf;
  --warn: #9a5b00; --warn-bg: #fff5e1; --warn-line: #f3dcae;
  --bad: #b42318; --bad-bg: #fdecea; --bad-line: #f6c4bf;
  --info: #2b2d31; --info-bg: #eef0f3; --info-line: #d9dce1;
  --accent: #111214; --on-accent: #fff; --accent-2: #2b2d31; --active: #ececee; --line-strong: #c9cbd0; --surface-2: #fafafb;
  --r: 14px; --r-sm: 10px; --r-xs: 8px;
  --sh-1: 0 1px 2px rgba(17,18,20,.04), 0 1px 1px rgba(17,18,20,.03);
  --sh-2: 0 1px 2px rgba(17,18,20,.05), 0 8px 24px rgba(17,18,20,.06);
  --sh-3: 0 12px 40px rgba(17,18,20,.14);
  --side: 264px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link, .t td a, .kv a, .feed a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a.link:hover, .t td a:hover, .kv a:hover { text-decoration-color: var(--ink); }
.ic { flex: none; display: block; }
::selection { background: #111214; color: #fff; }

/* ---------- shell */
.app { display: flex; min-height: 100vh; }
.side { width: var(--side); flex: none; background: linear-gradient(180deg, var(--accent) 0%, #17181b 100%); color: #d9dadd;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; background: #fff; color: #111214; display: grid; place-items: center;
  font-weight: 700; letter-spacing: .5px; box-shadow: 0 0 0 4px rgba(255,255,255,.06); }
.brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.brand small { color: #8d9097; font-size: 11.5px; }
.nav-label { color: #6f727a; font-size: 11px; font-weight: 600; letter-spacing: .4px; margin: 18px 12px 8px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #c4c6cb; font-weight: 500; margin-bottom: 2px; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.nav a .count { margin-inline-start: auto; background: rgba(255,255,255,.12); color: #fff; border-radius: 20px; padding: 0 8px; font-size: 11.5px; font-weight: 600; min-width: 22px; text-align: center; }
.nav a.on .count { background: var(--accent); color: var(--on-accent); }
.side-foot { margin-top: auto; padding-top: 16px; }
.side-cta { display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: #111214; border-radius: 12px; padding: 11px; font-weight: 600; transition: transform .15s; }
.side-cta:hover { transform: translateY(-1px); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255,255,255,.85); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .search { flex: 1; max-width: 520px; position: relative; }
.top .search input { padding: 10px 40px 10px 14px; border-radius: 12px; background: var(--soft); border-color: transparent; }
.top .search input:focus { background: var(--surface); border-color: var(--line); }
.top .search .ic { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); position: relative; cursor: pointer; }
.icon-btn:hover { background: var(--hover); }
.icon-btn .dot { position: absolute; top: -5px; inset-inline-end: -5px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 10px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--surface); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 10px); width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-3); z-index: 30; overflow: hidden; }
.menu-pop .mh { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-weight: 600; }
.menu-pop a.item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.menu-pop a.item:hover { background: var(--soft); }
.menu-pop a.item.unread { background: #fafafa; }
.menu-pop a.item.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-top: 7px; flex: none; }
.menu-pop .mf { display: block; text-align: center; padding: 10px; font-size: 13px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.user-chip:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 44px; height: 44px; border-radius: 14px; font-size: 16px; }
.avatar.soft { background: var(--info-bg); color: var(--ink); }
.user-chip .nm { line-height: 1.2; }
.user-chip .nm b { display: block; font-size: 13px; }
.user-chip .nm small { color: var(--muted); font-size: 11.5px; }
.menu-pop.narrow { width: 230px; }
.menu-pop form button, .menu-pop .lnk { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: start; }
.menu-pop form button:hover, .menu-pop .lnk:hover { background: var(--soft); }
.content { padding: 26px 28px 48px; width: 100%; max-width: 1480px; }

/* ---------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; font-weight: 700; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .ic { transform: scaleX(-1); opacity: .5; }

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; box-shadow: var(--sh-1); }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card.flush .card-h { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--line-2); }
.card h2, .card-h h2 { font-size: 15.5px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-h .hint { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.two { grid-template-columns: 1fr 1fr; }
.main-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .main-side { grid-template-columns: 1fr; } .three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .two, .three { grid-template-columns: 1fr; }
  .side { position: fixed; inset-inline-start: 0; z-index: 40; transform: translateX(100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: var(--sh-3); }
  .menu-toggle { display: grid !important; }
  .content, .top { padding-inline: 16px; }
  .user-chip .nm { display: none; }
}
.menu-toggle { display: none !important; }

/* ---------- KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 14px; transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; overflow: hidden; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: #d5d7db; }
.kpi .k-top { display: flex; justify-content: space-between; align-items: center; }
.kpi .k-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--ink); }
.kpi.dark { background: #111214; color: #fff; border-color: #111214; }
.kpi.dark .k-ic { background: rgba(255,255,255,.1); color: #fff; }
.kpi.dark .k-label, .kpi.dark .k-foot { color: #a9abb1; }
.kpi .k-val { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.kpi .k-label { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.kpi .k-foot { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .tag { font-size: 11.5px; font-weight: 600; border-radius: 20px; padding: 2px 9px; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.kpi.dark .tag.bad { background: rgba(255,255,255,.12); color: #ffb4ad; }

/* ---------- charts (pure CSS) */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 22px; background: var(--surface); border-radius: 50%; }
.donut .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 1; }
.donut .c b { font-size: 28px; display: block; line-height: 1; }
.donut .c span { color: var(--muted); font-size: 12px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 180px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 14px; }
.hbar .hl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.hbar .hl b { font-variant-numeric: tabular-nums; }
.stack { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line-2); }
.stack i { display: block; height: 100%; }
.c-office { background: var(--accent); } .c-branch { background: #b42318; } .c-modon { background: #8b8e95; } .c-ok { background: #157347; } .c-other { background: var(--line-strong); }
.mini-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 14px; }
.mini-legend span { display: flex; align-items: center; gap: 6px; }
.mini-legend i { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- tables */
.scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
.t th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft); padding: 11px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.t td { border-bottom: 1px solid var(--line-2); padding: 13px 16px; vertical-align: middle; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tbody tr:last-child td { border-bottom: 0; }
.t td.num, .t th.num { text-align: center; font-variant-numeric: tabular-nums; }
.t .cell-title { font-weight: 600; display: block; }
.t .cell-sub { color: var(--muted); font-size: 12px; }
.t tr.click { cursor: pointer; }
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden; margin-bottom: 18px; }
.table-foot { padding: 12px 16px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-2); background: var(--surface); }
.empty { text-align: center; padding: 40px 16px !important; color: var(--muted); }
.empty .ic { margin: 0 auto 10px; opacity: .45; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--info-bg); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.st-submitted, .st-under_review, .st-accepted, .st-open, .st-in_progress { background: var(--warn-bg); color: var(--warn); }
.st-returned, .st-modon_comments, .st-modon_rejected, .st-waiting_branch, .pr-urgent, .pr-high { background: var(--bad-bg); color: var(--bad); }
.st-modon_uploaded { background: var(--info-bg); color: var(--ink-2); }
.st-modon_approved, .st-modon_done, .st-closed { background: var(--ok-bg); color: var(--ok); }
.pr-normal, .pr-low { background: var(--info-bg); color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
.mono { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- forms */
label { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(17,18,20,.08); }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; color: var(--ink-2); margin: 0; cursor: pointer; }
.fields { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 16px; }
.fields .full { grid-column: 1 / -1; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.form-section { padding: 20px 0; border-top: 1px solid var(--line-2); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section h3 { margin: 0 0 4px; font-size: 14px; }
.form-section p.d { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .opt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); background: var(--surface); transition: all .15s; }
.seg .opt .ic { color: var(--muted); }
.seg input:checked + .opt { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,18,20,.08); color: var(--ink); }
.seg input:checked + .opt .ic { color: var(--ink); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 28px 16px; text-align: center; background: var(--soft); cursor: pointer; transition: all .15s; position: relative; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--surface); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ic { margin: 0 auto 10px; color: var(--ink-3); }
.drop b { display: block; }
.drop span { color: var(--muted); font-size: 12.5px; }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: start; }
.file-list li span { margin-inline-start: auto; color: var(--muted); font-size: 12px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: var(--r-sm); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: all .15s; box-shadow: var(--sh-1); }
.btn:hover { background: var(--hover); border-color: #d3d5d9; }
.btn.dark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.dark:hover { background: var(--accent-2); }
.btn.green { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.green:hover { filter: brightness(1.08); }
.btn.red { background: var(--surface); border-color: var(--bad-line); color: var(--bad); }
.btn.red:hover { background: var(--bad-bg); }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--sh-1); }
.filters .bar > div { min-width: 160px; flex: 1; }
.filters .bar > div.wide { flex: 2; min-width: 220px; }
form.inline { display: inline; }

/* ---------- alerts */
.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--info-line); background: var(--info-bg); font-weight: 500; }
.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash.error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); color: var(--ink-3); font-size: 13px; margin-bottom: 16px; }

/* ---------- document page */
.doc-hero { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.doc-hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.stepper { display: flex; gap: 0; margin: 22px 0 4px; }
.step { flex: 1; position: relative; text-align: center; font-size: 12px; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 15px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:last-child::before { display: none; }
.step .sd { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; margin: 0 auto 8px; position: relative; z-index: 1; font-weight: 700; color: var(--faint); }
.step.done .sd { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.done::before { background: var(--accent); }
.step.now .sd { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 5px rgba(17,18,20,.08); }
.step.now { color: var(--ink); font-weight: 600; }
.step.alert .sd { border-color: var(--bad); color: var(--bad); box-shadow: 0 0 0 5px rgba(180,35,24,.1); }
.step.alert { color: var(--bad); font-weight: 600; }
.step.good .sd { background: var(--ok); border-color: var(--ok); color: #fff; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 12px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; font-weight: 500; }
.files { display: grid; gap: 10px; }
.file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; transition: all .15s; }
.file:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }
.file .fi { width: 40px; height: 40px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-3); flex: none; text-transform: uppercase; }
.file .fn { min-width: 0; }
.file .fn b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file .fn span { color: var(--muted); font-size: 12px; }
.file .btn { margin-inline-start: auto; }
.action { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.action > summary { list-style: none; cursor: pointer; padding: 13px 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.action > summary::-webkit-details-marker { display: none; }
.action > summary .ai { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); flex: none; }
.action[open] > summary { border-bottom: 1px solid var(--line-2); background: var(--soft); }
.action .ab { padding: 14px; }
.action.primary { border-color: var(--accent); }
.action.primary .ai { background: var(--accent); color: var(--on-accent); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 0 0 18px; position: relative; }
.feed li::before { content: ""; position: absolute; top: 34px; bottom: 0; inset-inline-start: 15px; width: 2px; background: var(--line-2); }
.feed li:last-child::before { display: none; }
.feed .fb { min-width: 0; }
.feed .fb b { font-size: 13px; }
.feed .fb .when { color: var(--muted); font-size: 12px; }
.feed .fb .note { margin-top: 6px; background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 13px; white-space: pre-wrap; }
.feed .avatar { width: 32px; height: 32px; }

/* ---------- tickets / chat */
.msg { display: flex; gap: 12px; margin-bottom: 16px; }
.msg .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 12px 14px; flex: 1; box-shadow: var(--sh-1); }
.msg.office .bubble { background: #f8f8f9; }
.msg .h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg .h b { color: var(--ink); font-size: 13px; margin-inline-end: 6px; }

/* ---------- login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.auth-art { background: radial-gradient(1200px 600px at 100% 0%, #2b2d31 0%, #111214 55%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: auto -120px -120px auto; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 0 0 60px rgba(255,255,255,.02), 0 0 0 120px rgba(255,255,255,.015); }
.auth-art h2 { font-size: 34px; line-height: 1.35; margin: 0 0 14px; max-width: 460px; }
.auth-art p { color: #a9abb1; max-width: 440px; margin: 0; }
.auth-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-art li { display: flex; align-items: center; gap: 12px; color: #d9dadd; }
.auth-art li span { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 26px; margin: 0 0 6px; }
.auth-form .lead { color: var(--muted); margin: 0 0 28px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
.brand.dark .mark { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.brand.dark strong { color: var(--ink); }

/* ---------- misc */
.pre { white-space: pre-wrap; }
.progress-bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 70px; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.unread td { font-weight: 600; }
.unread td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-rows li:last-child { border-bottom: 0; }
.list-rows .grow { flex: 1; min-width: 0; }
.list-rows .grow b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 10px; letter-spacing: .3px; }
details.inline-edit > summary { list-style: none; cursor: pointer; }
details.inline-edit > summary::-webkit-details-marker { display: none; }
details.inline-edit[open] { background: var(--soft); border-radius: 12px; padding: 12px; margin-top: 8px; }
.switch-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 10px 0; }
.switch-row .lbl { color: var(--muted); font-size: 12.5px; min-width: 120px; }
@media print { .side, .top { display: none; } .content { padding: 0; } }
/* tables placed directly on a page (admin pages) get the card look */
main.content > .scroll { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); margin-bottom: 18px; }
main.content > .bar { margin-bottom: 16px; }
.kpis.six { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1600px) { .kpis.six { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 700px) { .kpis.six { grid-template-columns: 1fr 1fr; } }
.t .mono, .t .badge, .t .chip { white-space: nowrap; }
.t td { min-width: 70px; }
.t .cell-title[dir=auto] { min-width: 160px; }
.ico-box { width: 32px; height: 32px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; color: var(--ink-3); flex: none; }
/* ---------- analytics dashboard */
.seg-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg-filter select { width: auto; min-width: 150px; padding: 9px 12px; }
.pills { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: var(--sh-1); }
.pills button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; color: var(--ink-3); padding: 6px 14px; border-radius: 9px; cursor: pointer; }
.pills button.on { background: var(--accent); color: var(--on-accent); }
.delta { font-size: 12px; font-weight: 700; border-radius: 20px; padding: 2px 9px; background: var(--soft); color: var(--muted); }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--bad-bg); color: var(--bad); }
.kpi .unit { font-size: 14px; font-weight: 600; color: var(--muted); margin-inline-start: 6px; }
.kpi.dark .unit { color: #a9abb1; }
.chart-box { position: relative; }
.gauge { display: flex; align-items: center; gap: 18px; margin: 0; }
.gauge b { display: block; font-size: 15px; }
.gauge span { color: var(--muted); font-size: 12.5px; }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line-2) 0); }
.ring::before { content: ""; position: absolute; inset: 9px; background: var(--surface); border-radius: 50%; }
.ring span { position: relative; font-weight: 700; font-size: 19px; }
.num-pill { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 8px; font-weight: 700; }
.num-pill.dark { background: var(--accent); color: var(--on-accent); }
.num-pill.bad { background: var(--bad-bg); color: var(--bad); }
.num-pill.ok { background: var(--ok-bg); color: var(--ok); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter .progress-bar { flex: 1; }
.meter span { font-size: 12px; font-weight: 600; min-width: 34px; }
table.heat { border-collapse: separate; border-spacing: 6px; width: 100%; }
.heat th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; white-space: nowrap; }
.heat tbody th { text-align: start; color: var(--ink); }
.heat td { padding: 0; }
.hc { --v: 0; display: block; text-align: center; padding: 10px 6px; border-radius: 8px; font-weight: 600; font-size: 12.5px;
  background: rgba(17, 18, 20, calc(.06 + var(--v) * .86)); color: var(--ink); }
.hc[data-v=""] { background: var(--soft); color: var(--faint); }
.hc.hi { color: #fff; }
.t .cell-sub { display: block; }
.t td > b { white-space: nowrap; display: block; }
.t td:first-child { min-width: 130px; }
.chart-box { overflow: hidden; }
.grid > * { min-width: 0; }

/* ---------- ranking + welcome */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 18px; align-items: end; margin-bottom: 22px; }
.pod { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 18px 0; text-align: center; box-shadow: var(--sh-1); position: relative; overflow: hidden; }
.pod h3 { margin: 10px 0 12px; font-size: 18px; }
.pod-1 { background: linear-gradient(180deg, #17181b, #111214); color: #fff; border-color: #111214; box-shadow: var(--sh-3); padding-top: 34px; }
.pod .medal { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; font-weight: 700; font-size: 18px; background: var(--soft); border: 2px solid var(--line); color: var(--ink); }
.pod-1 .medal { background: #f3c969; border-color: #f3c969; width: 56px; height: 56px; font-size: 22px; box-shadow: 0 0 0 6px rgba(243,201,105,.18); }
.pod-2 .medal { background: var(--line); }
.pod-3 .medal { background: #e9d3bf; border-color: #e9d3bf; }
.pod .crown { position: absolute; top: 12px; inset-inline-end: 14px; color: #f3c969; }
.pod .eng { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 16px; text-align: start; }
.pod .eng b { display: block; font-size: 13px; }
.pod .eng span { font-size: 12px; color: var(--muted); }
.pod-1 .eng span { color: #a9abb1; }
.pod-1 .avatar.soft { background: rgba(255,255,255,.12); color: #fff; }
.pod-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 18px; }
.pod-stats b { display: block; font-size: 18px; }
.pod-stats span { font-size: 11px; color: var(--muted); }
.pod-1 .pod-stats span { color: #a9abb1; }
.pod-base { margin: 0 -18px; padding: 10px; background: var(--soft); font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.pod-1 .pod-base { background: rgba(255,255,255,.08); color: #d9dadd; padding: 16px 10px; }
@media (max-width: 900px) { .podium { grid-template-columns: 1fr; } }
.rank-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-weight: 700; font-size: 13px; background: var(--soft); flex: none; }
.rank-n.r1 { background: #f3c969; color: #111214; }
.rank-n.r2 { background: var(--line); }
.rank-n.r3 { background: #e9d3bf; }
.t tr.me-row td { background: #fbf7ec; }
.leader-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r); margin-bottom: 18px; background: linear-gradient(90deg, #111214, #2b2d31); color: #fff; box-shadow: var(--sh-2); }
.leader-banner > .ic { color: #f3c969; }
.leader-banner b { display: block; }
.leader-banner span { color: #b9bbc0; font-size: 12.5px; }
.leader-banner .btn { margin-inline-start: auto; }
.leader-banner.soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.leader-banner.soft span { color: var(--muted); }
.leader-banner.soft > .ic { color: #9a5b00; }
.celebrate { position: fixed; inset: 0; z-index: 100; background: rgba(17,18,20,.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fadeIn .25s ease; }
.celebrate-card { position: relative; z-index: 2; width: 100%; max-width: 460px; background: linear-gradient(180deg, #17181b, #111214); color: #fff; border-radius: 22px; padding: 34px 28px 28px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.celebrate .trophy { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: #f3c969; color: #111214; box-shadow: 0 0 0 10px rgba(243,201,105,.15), 0 0 0 22px rgba(243,201,105,.06); }
.celebrate .kicker { color: #f3c969; font-size: 12.5px; font-weight: 700; }
.celebrate h2 { font-size: 26px; margin: 6px 0 8px; }
.celebrate p { color: #b9bbc0; margin: 0 0 20px; }
.c-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.c-stats div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 12px 6px; }
.c-stats b { display: block; font-size: 20px; }
.c-stats span { font-size: 11.5px; color: #a9abb1; }
.celebrate .btn { box-shadow: none; }
.celebrate .btn:not(.dark) { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.celebrate .btn.dark { background: #fff; color: #111214; border-color: #fff; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 8px; height: 14px; background: var(--c); border-radius: 2px; opacity: .9; animation: fall 3.2s var(--d) linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .celebrate-card, .celebrate { animation: none; } }

/* ---------- language */
.lang-btn { font-weight: 700; font-size: 13px; text-decoration: none; }
.auth-form { position: relative; }
.auth-lang { position: absolute; top: 20px; inset-inline-end: 20px; }
.top .search input { padding-inline: 40px 14px; }
.crumbs .ic { transform: none; }
[dir=ltr] .crumbs .ic { transform: scaleX(-1); }
[dir=ltr] .msg .bubble { border-radius: 14px 4px 14px 14px; }
[dir=ltr] body { font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", Arial, sans-serif; }

/* ---------- files: revision groups, actions, viewer */
.rev-head { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.rev-head:first-of-type { margin-top: 0; }
.rev-head .btn { margin-inline-start: auto; }
.file-actions { display: flex; gap: 6px; margin-inline-start: auto; }
.file .btn { margin-inline-start: 0; }
.viewer { position: fixed; inset: 0; z-index: 120; background: rgba(17,18,20,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; }
.viewer[hidden] { display: none; }
.viewer-box { width: min(1200px, 100%); height: min(92vh, 1000px); background: var(--surface); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sh-3); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; background: #2b2d31; display: grid; place-items: center; overflow: auto; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 700px) { .viewer { padding: 0; } .viewer-box { height: 100vh; border-radius: 0; } .file { flex-wrap: wrap; } }

/* ---------- project documents */
.doc-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.doc-slot { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 12px 14px; background: var(--soft); margin: 0; font-weight: 500; }
.doc-slot[hidden] { display: none; }
.doc-slot input { background: var(--surface); }
.doc-name { font-weight: 600; color: var(--ink); }
.req { color: var(--bad); }
.doc-list { display: grid; gap: 12px; }
.doc-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.doc-row.missing { border-color: var(--bad-line); background: var(--bad-bg); }
.doc-row-h { display: flex; align-items: center; gap: 8px; }
.doc-row .files { margin-top: 10px; }
.doc-state { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); flex: none; }
.doc-row.missing .doc-state { background: var(--bad-bg); color: var(--bad); }

/* ---------- upload slots: blueprint-style drop cards */
.upl-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.upl { position: relative; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 16px; border-radius: 14px; cursor: pointer;
  font-weight: 500; color: var(--ink); border: 1px solid var(--line); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s;
  background:
    linear-gradient(rgba(17,18,20,.035) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(17,18,20,.035) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(rgba(17,18,20,.06) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(17,18,20,.06) 1px, transparent 1px) 0 0 / 80px 80px, #fbfbfc; }
.upl[hidden] { display: none; }
.upl:hover { border-color: #c4c6cc; box-shadow: var(--sh-2); transform: translateY(-1px); }
.upl.over { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(17,18,20,.08); }
.upl-corner { position: absolute; width: 12px; height: 12px; border-color: var(--accent); border-style: solid; opacity: .55; }
.upl-corner.tl { top: 8px; inset-inline-start: 8px; border-width: 1.5px 0 0 1.5px; }
.upl-corner.tr { top: 8px; inset-inline-end: 8px; border-width: 1.5px 1.5px 0 0; }
.upl-corner.bl { bottom: 8px; inset-inline-start: 8px; border-width: 0 0 1.5px 1.5px; }
.upl-corner.br { bottom: 8px; inset-inline-end: 8px; border-width: 0 1.5px 1.5px 0; }
[dir=rtl] .upl-corner.tl { border-width: 1.5px 1.5px 0 0; } [dir=rtl] .upl-corner.tr { border-width: 1.5px 0 0 1.5px; }
[dir=rtl] .upl-corner.bl { border-width: 0 1.5px 1.5px 0; } [dir=rtl] .upl-corner.br { border-width: 0 0 1.5px 1.5px; }
.upl-head { display: flex; align-items: center; gap: 12px; }
.upl-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px rgba(17,18,20,.18); }
.upl-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.upl-title b { font-size: 14px; }
.upl-req { font-size: 10.5px; font-weight: 700; color: var(--bad); background: var(--bad-bg); border-radius: 6px; padding: 1px 7px; }
.upl-code { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: var(--surface); direction: ltr; }
.upl-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.upl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.upl.is-req .upl-dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.upl.is-req .upl-state { color: var(--bad); }
.upl-zone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1.5px dashed var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.75); color: var(--ink-3); font-size: 13px; }
.upl-zone .ic { color: var(--ink); }
.upl-types { margin-inline-start: auto; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 10.5px; color: var(--faint); direction: ltr; }
.upl-files { display: flex; flex-direction: column; gap: 6px; }
.upl-files:empty { display: none; }
.upl-file { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; min-width: 0; }
.upl-ext { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 2px 6px; flex: none; }
.upl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.upl-size { color: var(--muted); font-size: 12px; flex: none; direction: ltr; }
.upl-remove { align-self: flex-start; border: 0; background: none; color: var(--bad); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.upl-input { position: absolute; width: 1px; height: 1px; opacity: 0; inset-inline-start: 50%; bottom: 20px; }
.upl.has { border-color: var(--ok-line); }
.upl.has .upl-ic { background: var(--ok); box-shadow: 0 6px 14px rgba(21,115,71,.25); }
.upl.has .upl-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.upl.has .upl-state { color: var(--ok); }
.upl.has .upl-zone { display: none; }
.upl.has .upl-corner { border-color: var(--ok); }
.upl-counter { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); font-size: 13px; }
.upl-counter b { font-family: "IBM Plex Mono", Consolas, monospace; }
.upl-counter-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.upl-counter-bar i { display: block; height: 100%; width: 0; background: var(--bad); border-radius: 4px; transition: width .25s, background .25s; }
.upl-counter.done .upl-counter-bar i { background: var(--ok); }
.upl-counter.done { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.upl-name { unicode-bidi: plaintext; text-align: start; }
/* hidden radios behind option cards must not widen the page */
.seg label { position: relative; }
.seg input { width: 1px; height: 1px; inset-inline-start: 0; top: 0; }

/* ---------- project drafts */
.draft-card { border-color: var(--warn-line); background: linear-gradient(180deg, var(--warn-bg), var(--surface) 60%); }
.checklist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; }
.checklist li.ok { color: var(--ok); border-color: var(--ok-line); }
.checklist li.no { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.draft-edit > summary { list-style: none; display: inline-flex; }
.draft-edit > summary::-webkit-details-marker { display: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.3); }


/* =====================================================================
   ACC-style layout (Autodesk Construction Cloud look, NH colours)
   Global dark bar on top, white module menu, flat panels, compact tables.
   This section overrides the earlier shell styles above.
   ===================================================================== */
:root { --r: 6px; --r-sm: 4px; --r-xs: 3px; --bg: #f4f4f5; --line: #dcdde0; --line-2: #ececee; --soft: #f6f6f7; --hover: #f0f0f2;
  --sh-1: none; --sh-2: 0 2px 8px rgba(17,18,20,.08); --sh-3: 0 10px 30px rgba(17,18,20,.18); --side: 236px; --gbar: 56px; }
body { font-size: 13.5px; background: var(--bg); }

/* ---- global bar */
.gbar { position: sticky; top: 0; z-index: 40; height: var(--gbar); display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: #111214; color: #fff; border-bottom: 1px solid #000; }
.gbar-btn { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; color: #e4e5e7; background: transparent;
  border: 0; cursor: pointer; position: relative; font: inherit; font-weight: 700; font-size: 13px; text-decoration: none; list-style: none; }
.gbar-btn::-webkit-details-marker { display: none; }
.gbar-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.gbar-btn .dot { position: absolute; top: 2px; inset-inline-end: 0; background: #d92d20; color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px;
  min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border: 2px solid #111214; }
.gbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding-inline-end: 4px; }
.gbar-brand .mark { width: 30px; height: 30px; border-radius: var(--r-sm); background: #fff; color: #111214; display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: .3px; }
.gbar-product { display: flex; flex-direction: column; line-height: 1.15; }
.gbar-product b { font-size: 13.5px; letter-spacing: .2px; }
.gbar-product span { font-size: 11.5px; color: #a9abb1; }
.gbar-sep { width: 1px; height: 26px; background: rgba(255,255,255,.16); }
.gbar-context { display: flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-sm); color: #d9dadd; }
.gbar-context span { display: flex; flex-direction: column; line-height: 1.15; }
.gbar-context small { font-size: 10.5px; color: #8d9097; }
.gbar-context b { font-size: 12.5px; color: #fff; font-weight: 600; white-space: nowrap; }
.gbar-search { flex: 1; max-width: 460px; position: relative; margin-inline-start: auto; }
.gbar-search .ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: #8d9097; }
.gbar-search input { height: 36px; padding: 0 12px; padding-inline-start: 36px; background: rgba(255,255,255,.08); border: 1px solid transparent; color: #fff; border-radius: var(--r-sm); }
.gbar-search input::placeholder { color: #8d9097; }
.gbar-search input:focus { background: #fff; color: var(--ink); border-color: #fff; box-shadow: none; }
.gbar-actions { display: flex; align-items: center; gap: 4px; }
.gbar-user { display: flex; align-items: center; gap: 9px; padding: 4px 8px; border-radius: var(--r-sm); cursor: pointer; list-style: none; color: #fff; }
.gbar-user::-webkit-details-marker { display: none; }
.gbar-user:hover { background: rgba(255,255,255,.1); }
.gbar-user .avatar { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #111214; font-size: 12px; }
.gbar-user .nm { line-height: 1.15; display: flex; flex-direction: column; }
.gbar-user .nm b { font-size: 12.5px; font-weight: 600; }
.gbar-user .nm small { font-size: 11px; color: #a9abb1; }
.gbar .menu-pop { color: var(--ink); top: calc(100% + 8px); border-radius: var(--r); }

/* ---- module menu */
.app { min-height: calc(100vh - var(--gbar)); }
.side { width: var(--side); background: var(--surface); color: var(--ink); border-inline-end: 1px solid var(--line); top: var(--gbar);
  height: calc(100vh - var(--gbar)); padding: 12px 10px; display: flex; flex-direction: column; transition: width .18s ease; overflow-x: hidden; }
.side-create { display: flex; align-items: center; gap: 10px; justify-content: center; height: 38px; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent);
  font-weight: 600; text-decoration: none; margin-bottom: 14px; white-space: nowrap; }
.side-create:hover { background: var(--accent-2); }
.nav-label { color: #8a8c92; font-size: 11px; font-weight: 700; letter-spacing: .5px; margin: 14px 10px 6px; white-space: nowrap; }
.nav-label:first-child { margin-top: 2px; }
.nav a { color: var(--ink-2); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 1px; gap: 11px; font-weight: 500; white-space: nowrap; }
.nav a .ic { color: #6b6e75; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--active); color: var(--ink); box-shadow: none; font-weight: 600; }
.nav a.on .ic { color: var(--ink); }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav a .count, .nav a.on .count { background: var(--accent); color: var(--on-accent); border-radius: 10px; font-size: 11px; }
.rail-collapse { margin-top: auto; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; }
.rail-collapse:hover { background: var(--hover); color: var(--ink); }
[dir=ltr] .rail-collapse .ic { transform: scaleX(-1); }
html.rail .side { width: 64px; padding-inline: 8px; }
html.rail .side .lbl, html.rail .nav-label { display: none; }
html.rail .nav-label { display: block; height: 1px; background: var(--line-2); margin: 10px 6px; }
html.rail .nav a { justify-content: center; padding: 9px 0; }
html.rail .nav a .count { position: absolute; top: 2px; inset-inline-end: 4px; min-width: 16px; padding: 0 4px; font-size: 10px; }
html.rail .side-create { padding: 0; }
html.rail .rail-collapse { justify-content: center; }
html.rail .rail-collapse .ic { transform: scaleX(-1); }
[dir=ltr] html.rail .rail-collapse .ic, html[dir=ltr].rail .rail-collapse .ic { transform: none; }
.side-backdrop { display: none; }

/* ---- page */
.content { padding: 20px 24px 48px; max-width: none; }
.page-head { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: 0; }
.crumbs { font-size: 12px; }

/* ---- panels, cards, tables: flat ACC style */
.card, .table-card, .filters, .kpi, .callout, .file, .action, .doc-row, .upl, .msg .bubble { border-radius: var(--r); box-shadow: none; }
.card { padding: 18px; border-color: var(--line); }
.card.flush .card-h { padding: 12px 16px; background: var(--surface-2); }
.card-h h2, .card h2 { font-size: 14.5px; }
.kpi { padding: 16px; gap: 12px; }
.kpi:hover { transform: none; box-shadow: var(--sh-2); }
.kpi .k-ic { border-radius: var(--r-sm); width: 36px; height: 36px; }
.kpi .k-val { font-size: 28px; }
.t th { background: var(--surface); color: var(--ink-3); font-size: 12px; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.t td { padding: 10px 14px; border-bottom-color: var(--line-2); }
.t tbody tr:hover td { background: var(--hover); }
.table-foot { background: var(--surface-2); }
.filters { padding: 12px 14px; }
.badge { border-radius: var(--r-xs); padding: 2px 8px; font-size: 11.5px; }
.chip { border-radius: var(--r-xs); }
.btn { border-radius: var(--r-sm); height: 34px; padding: 0 14px; font-size: 13px; box-shadow: none; border-color: var(--line-strong); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-xs); }
.btn.block { height: 38px; }
input, select, textarea { border-radius: var(--r-sm); border-color: var(--line-strong); }
input, select { height: 36px; padding-top: 0; padding-bottom: 0; }
input[type=file] { height: auto; padding: 6px; }
textarea { padding: 8px 10px; }
input[type=checkbox], input[type=radio] { height: auto; }
.icon-btn { border-radius: var(--r-sm); }
.flash { border-radius: var(--r-sm); }
.menu-pop { border-radius: var(--r); }
.avatar { border-radius: 50%; }
.avatar.lg { border-radius: 50%; }
.seg .opt { border-radius: var(--r-sm); }
.pills { border-radius: var(--r-sm); box-shadow: none; }
.pills button { border-radius: var(--r-xs); }
.ring::before { inset: 8px; }
.leader-banner { border-radius: var(--r); }
.upl-zone { border-radius: var(--r-sm); }
.upl-ic { border-radius: var(--r-sm); }
.pod { border-radius: var(--r); }
.celebrate-card { border-radius: 14px; }
.viewer-box { border-radius: var(--r); }
.stepper .sd { border-radius: 50%; }

/* ---- phones: menu slides in under the bar */
@media (max-width: 900px) {
  .gbar-context, .gbar-product span, .gbar-user .nm, .gbar-sep { display: none; }
  .gbar-search { max-width: none; }
  .side { position: fixed; top: var(--gbar); inset-inline-start: 0; z-index: 45; width: 260px; transform: translateX(100%); transition: transform .2s; }
  [dir=ltr] .side { transform: translateX(-100%); }
  body.nav-open .side { transform: none; box-shadow: var(--sh-3); }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: var(--gbar) 0 0 0; background: rgba(17,18,20,.35); z-index: 44; }
  html.rail .side { width: 260px; }
  html.rail .side .lbl, html.rail .nav-label { display: initial; }
  .rail-collapse { display: none; }
  .content { padding-inline: 14px; }
}
@media (max-width: 560px) { .gbar-search { display: none; } }

/* ---- MODON slots card */
.quota { margin-bottom: 18px; }
.quota-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.qt { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.qt.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.qt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qt-top b { font-size: 13.5px; }
.qt-num { display: flex; align-items: baseline; gap: 8px; }
.qt-free { font-size: 32px; font-weight: 700; line-height: 1; }
.qt.ok .qt-free { color: var(--ok); }
.qt.warn .qt-free { color: var(--warn); }
.qt.bad .qt-free { color: var(--bad); }
.qt-of { color: var(--ink-3); font-size: 12.5px; }
.qt-bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.qt-bar i { display: block; height: 100%; background: var(--accent); }
.qt.bad .qt-bar i { background: var(--bad); }
.qt-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: 12px; }
.qt-foot b { color: var(--ink); }

/* ---- KPI cards: number centred, icon and tag tucked into the top corners, shorter card */
.kpi { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0; padding: 14px 12px 12px; }
.kpi .k-top { position: absolute; top: 10px; inset-inline: 10px; pointer-events: none; }
.kpi .k-ic { width: 28px; height: 28px; }
.kpi .k-ic .ic { width: 16px; height: 16px; }
.kpi .k-val { font-size: 34px; margin-top: 18px; font-variant-numeric: tabular-nums; }
.kpi .k-label { margin-top: 6px; font-weight: 600; color: var(--ink-2); }
.kpi.dark .k-label { color: #e4e5e7; }
.kpi .k-foot { justify-content: center; margin-top: 3px; font-size: 11.5px; }
.kpi .tag { font-size: 11px; padding: 1px 8px; }
.qt-num { justify-content: center; }
.qt-foot { justify-content: center; gap: 16px; }
.kpi .k-val { display: flex; align-items: baseline; justify-content: center; white-space: nowrap; margin-top: 14px; }

/* ---- project types as check cards */
.type-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.tchk { position: relative; cursor: pointer; margin: 0; }
.tchk input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tchk-box { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--surface); height: 100%; transition: border-color .15s, box-shadow .15s; }
.tchk-box b { display: block; font-size: 13px; }
.tchk-box small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.5; }
.tchk-ic { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--soft); display: grid; place-items: center; flex: none; }
.tchk-mark { margin-inline-start: auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.tchk:hover .tchk-box { border-color: var(--line-strong); }
.tchk input:checked + .tchk-box { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tchk input:checked + .tchk-box .tchk-ic { background: var(--accent); color: var(--on-accent); }
.tchk input:checked + .tchk-box .tchk-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tchk input:focus-visible + .tchk-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tchip-architectural { background: var(--info-bg); }
.tchip-safety { background: var(--warn-bg); color: var(--warn); }
.tchip-supervision { background: var(--ok-bg); color: var(--ok); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }

/* ---- project statuses */
.badge.pst-Draft { background: var(--soft); color: var(--ink-3); }
.badge.pst-Pending { background: var(--accent); color: var(--on-accent); }
.badge.pst-Held { background: var(--warn-bg); color: var(--warn); }
.badge.pst-Active { background: var(--ok-bg); color: var(--ok); }
.badge.pst-OnHold { background: var(--soft); color: var(--ink-2); }
.badge.pst-Cancelled { background: var(--bad-bg); color: var(--bad); }
.badge.pst-Completed, .badge.pst-Closed { background: var(--soft); color: var(--muted); }

/* ---- acceptance card */
.approval { border-color: var(--accent); }
.approval.held { border-color: var(--warn-line); background: var(--warn-bg); }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.ap { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ap.bad { border-color: var(--bad-line); }
.ap-num { font-size: 26px; font-weight: 700; line-height: 1; }
.ap-num small { font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 6px; }
.ap.ok .ap-num { color: var(--ok); }
.ap.bad .ap-num { color: var(--bad); }
.ap-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-form input { flex: 1; min-width: 200px; }

/* ---- MODON drawing flow + longer document timeline */
.flow-row { padding: 12px 0; border-top: 1px solid var(--line-2); }
.flow-row:first-of-type { border-top: 0; }
.flow-name { font-size: 13px; }
.flow-details { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.stepper.compact { margin: 12px 0 4px; }
.step-sub { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.step.alert .step-sub { color: var(--bad); }
.stepper.long { overflow-x: auto; padding-bottom: 4px; }
.stepper.long .step { min-width: 96px; font-size: 11.5px; }
.cancel-card { padding: 14px 16px; }
.cancel-card summary { list-style: none; }
.cancel-card summary::-webkit-details-marker { display: none; }
.qt-foot a { color: inherit; }


/* =====================================================================
   Dark mode: html[data-theme="dark"] (set before paint from the saved choice or the system setting).
   Light colours above are tokens; this block only redefines them, plus the parts that are dark in both themes.
   ===================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ececee; --ink-2: #d5d6da; --ink-3: #a9acb3; --muted: #8b8f97; --faint: #6b6f77;
  --line: #2c2e33; --line-2: #24262a; --line-strong: #3a3d43; --bg: #0e0f11; --surface: #17181b; --surface-2: #1b1c20;
  --soft: #1f2125; --hover: #222428; --active: #2a2c31;
  --accent: #ececee; --on-accent: #111214; --accent-2: #ffffff;
  --ok: #3fb67a; --ok-bg: rgba(63,182,122,.14); --ok-line: rgba(63,182,122,.35);
  --warn: #e3a94b; --warn-bg: rgba(227,169,75,.14); --warn-line: rgba(227,169,75,.35);
  --bad: #f2776c; --bad-bg: rgba(242,119,108,.14); --bad-line: rgba(242,119,108,.38);
  --info: #d5d6da; --info-bg: #23252a; --info-line: #34363c;
  --sh-1: none; --sh-2: 0 2px 10px rgba(0,0,0,.45); --sh-3: 0 14px 40px rgba(0,0,0,.6);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
/* buttons and marks that sit on the brand green keep a deep green with white text */
html[data-theme="dark"] .btn.green, html[data-theme="dark"] .step.good .sd { background: #1f8a57; border-color: #1f8a57; color: #fff; }
html[data-theme="dark"] .btn.dark:hover, html[data-theme="dark"] .side-create:hover { background: #ffffff; }
/* parts that are dark in both themes */
html[data-theme="dark"] .gbar { background: #0a0a0b; border-bottom-color: var(--line); }
html[data-theme="dark"] .gbar-search input:focus { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
html[data-theme="dark"] .kpi.dark { background: #24262b; border-color: var(--line-strong); }
html[data-theme="dark"] .leader-banner:not(.soft), html[data-theme="dark"] .pod-1 { background: linear-gradient(90deg, #1d1f23, #2a2c31); border-color: var(--line-strong); }
html[data-theme="dark"] .auth-art { background: radial-gradient(1200px 600px at 100% 0%, #2b2d31 0%, #0a0a0b 55%); }
/* heat map cells: light ink on dark instead of dark ink on light */
html[data-theme="dark"] .hc { background: rgba(236, 236, 238, calc(.04 + var(--v) * .78)); color: var(--ink); }
html[data-theme="dark"] .hc.hi { color: #111214; }
html[data-theme="dark"] .draft-card { background: linear-gradient(180deg, var(--warn-bg), var(--surface) 60%); }
html[data-theme="dark"] img, html[data-theme="dark"] .viewer-body iframe { color-scheme: light; }
html[data-theme="dark"] .tchip-architectural { background: var(--info-bg); color: var(--ink-2); }

/* ---- theme switch in the top bar */
.theme-btn .ic-sun { display: none; }
html[data-theme="dark"] .theme-btn .ic-sun { display: block; }
html[data-theme="dark"] .theme-btn .ic-moon { display: none; }

html[data-theme="dark"] .menu-pop a.item.unread, html[data-theme="dark"] .msg.office .bubble { background: var(--soft); }
html[data-theme="dark"] .t tr.me-row td { background: var(--warn-bg); }
html[data-theme="dark"] .kpi:hover, html[data-theme="dark"] .btn:hover, html[data-theme="dark"] .upl:hover { border-color: var(--line-strong); }
html[data-theme="dark"] .upl { background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 80px 80px, var(--surface-2); }
html[data-theme="dark"] .nav-label { color: var(--muted); }
html[data-theme="dark"] .nav a .ic { color: var(--muted); }
.auth-theme { position: absolute; top: 20px; inset-inline-end: 70px; }
.theme-btn { cursor: pointer; }
html[data-theme="dark"] .upl-zone { background: rgba(23,24,27,.75); }
.flow-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-head form { margin-inline-start: auto; }

/* ---- chat: conversations on the side, messages and composer on the main pane */
.chat { display: grid; grid-template-columns: 300px 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  height: calc(100vh - var(--gbar) - 150px); min-height: 460px; overflow: hidden; }
.chat-side { border-inline-end: 1px solid var(--line); padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.chat-room { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; min-width: 0; }
.chat-room:hover { background: var(--hover); }
.chat-room.on { background: var(--active); }
.chat-room .count { margin-inline-start: auto; background: var(--accent); color: var(--on-accent); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
.chat-room .count[hidden], .nav a .count[hidden] { display: none; }
.chat-rt { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.chat-rt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-rt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-av { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.chat-av.sm { width: 30px; height: 30px; font-size: 12px; }
.chat-av.pub { background: var(--ok-bg); color: var(--ok); }
.chat-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .4px; margin: 14px 10px 4px; }
.chat-none { margin: 4px 10px; }
.chat-new { margin-top: auto; padding-top: 10px; }
.chat-new summary { list-style: none; }
.chat-new summary::-webkit-details-marker { display: none; }
.chat-new input { margin: 8px 0 6px; }
.chat-people { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-people a { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; min-width: 0; }
.chat-people a:hover { background: var(--hover); }
.chat-people a[hidden] { display: none; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 14.5px; }
.chat-head small { color: var(--muted); font-size: 12px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.chat-day { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2px 12px; margin: 12px 0 8px; }
.chat-empty { margin: auto; color: var(--muted); }
.chat-msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; margin-top: 10px; max-width: 78%; }
.chat-msg.join { margin-top: 2px; }
.chat-msg .chat-av { grid-row: span 2; align-self: start; }
.chat-msg.join .chat-bubble { grid-column: 2; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.chat-meta b { font-size: 12.5px; }
.chat-meta small { color: var(--muted); font-size: 11px; }
.chat-bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 8px 12px; justify-self: start; max-width: 100%; }
[dir=ltr] .chat-bubble { border-radius: 12px 4px 12px 12px; }
.chat-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.65; }
.chat-msg.mine { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 30px; }
.chat-msg.mine .chat-av { grid-column: 2; grid-row: 1 / span 2; }
.chat-msg.mine .chat-meta { grid-column: 1; grid-row: 1; justify-content: flex-end; }
.chat-msg.mine .chat-bubble { grid-column: 1; justify-self: end; background: var(--accent); color: var(--on-accent); border-color: var(--accent); border-radius: 12px 4px 12px 12px; }
.chat-msg.mine.join .chat-bubble { grid-column: 1; }
.chat-file { display: flex; align-items: center; gap: 8px; margin-top: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; }
.chat-file .fi { font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 2px 6px; }
.chat-msg.mine .chat-file .fi { background: var(--ink); }
.chat-fn { display: flex; flex-direction: column; min-width: 0; margin-inline-end: auto; }
.chat-fn b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-fn small { color: var(--muted); font-size: 11px; }
.chat-form { border-top: 1px solid var(--line); padding: 10px 14px; background: var(--surface); }
.chat-input { display: flex; align-items: flex-end; gap: 8px; }
.chat-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; line-height: 1.5; padding: 9px 12px; }
.chat-attach { cursor: pointer; flex: none; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
@media (max-width: 900px) {
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-side { border-inline-end: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .chat-main { height: 70vh; }
  .chat-msg { max-width: 92%; }
}

/* ---- archive: names by slot and revision */
.fn-orig { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-name { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 15px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 10px; overflow-x: auto; white-space: nowrap; }
.arc-name span { padding: 1px 4px; border-radius: 3px; }
.seg-a { background: var(--info-bg); } .seg-b { background: var(--warn-bg); color: var(--warn); }
.seg-c { background: var(--ok-bg); color: var(--ok); } .seg-d { background: var(--active); }
.arc-keys { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.arc-keys i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }
.arc-slot { border-top: 1px solid var(--line-2); padding: 14px 0; }
.arc-slot:first-of-type { border-top: 0; padding-top: 4px; }
.arc-slot-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.arc-rev { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 8px; }
.arc-rev.current { border-color: var(--ok-line); background: var(--ok-bg); }
.arc-rev.old { background: var(--surface-2); }
.arc-rev-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.arc-rn { font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 1px 8px; font-size: 12px; }
.arc-rev.old .arc-rn { background: var(--line-strong); color: var(--ink); }
.arc-old-list > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin: 2px 0 8px; }
.arc-rev .files { display: grid; gap: 6px; }

/* ---- phones: menus inside the screen, card titles first, chat list shorter */
@media (max-width: 560px) {
  .gbar .menu-pop { position: fixed; top: calc(var(--gbar) + 6px); inset-inline: 8px; width: auto; max-height: calc(100vh - var(--gbar) - 20px); overflow-y: auto; }
  .card-h { flex-wrap: wrap; row-gap: 4px; }
  .card-h h2 { flex: 1 1 auto; }
  .card-h .hint { flex-basis: 100%; }
  .chat-side { max-height: 170px; }
  .chat-main { height: calc(100vh - var(--gbar) - 300px); min-height: 380px; }
  .chat-msg { max-width: 96%; }
  .page-head .bar { flex-wrap: wrap; }
}

/* ---- phones: tables as stacked cards (labels set by ui.js) */
@media (max-width: 560px) {
  .table-card:has(> .scroll > table.t-cards), main.content > .scroll:has(> table.t-cards), .card .scroll:has(> table.t-cards) {
    background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .card.flush .scroll:has(> table.t-cards) { padding: 10px 10px 0; }
  table.t-cards { background: transparent; }
  table.t-cards thead { display: none; }
  table.t-cards, table.t-cards tbody { display: block; width: 100%; }
  table.t-cards tbody tr { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 8px 12px; margin-bottom: 10px; }
  table.t-cards tbody tr.click:active { border-color: var(--line-strong); }
  table.t-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0;
    border: 0 !important; background: none !important; text-align: end; min-width: 0; white-space: normal; }
  table.t-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; flex: none; max-width: 45%; text-align: start; }
  table.t-cards td:not([data-label])::before { display: none; }
  table.t-cards td:not([data-label]) { justify-content: flex-end; }
  table.t-cards td:empty { display: none; }
  table.t-cards td.t-title { order: -1; display: block; text-align: start; font-size: 14px; padding: 4px 0 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--line-2) !important; }
  table.t-cards td.t-title::before { display: none; }
  table.t-cards td.t-full { display: block; text-align: center; }
  table.t-cards td.t-full::before { display: none; }
  table.t-cards td input, table.t-cards td select { max-width: 60%; }
  table.t-cards + .table-foot, .table-card:has(table.t-cards) .table-foot { background: transparent; border: 0; padding: 4px 2px; }
}
@media (max-width: 560px) {
  /* label floats to the start, the value (one or several lines) sits at the end */
  table.t-cards td[data-label] { display: block; }
  table.t-cards td[data-label]::before { float: inline-start; margin-inline-end: 12px; line-height: 1.9; }
  table.t-cards td[data-label]::after { content: ""; display: block; clear: both; }
  table.t-cards td[data-label] .meter { justify-content: flex-end; }
  table.t-cards td[data-label] > input, table.t-cards td[data-label] > select { width: 60%; }
}
.code-input { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 28px; letter-spacing: 10px; text-align: center; height: 60px !important; }
.login-who { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 16px; background: var(--surface-2); }
.login-who b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* ---- company logo */
.gbar-logo { height: 28px; width: auto; display: block; }
.brand-mark { height: 30px; width: auto; display: block; flex: none; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 0 28px; }
.auth-logo img { width: 150px; height: auto; }
.auth-logo span { font-size: 12.5px; font-weight: 600; letter-spacing: .3px; color: var(--muted); }
.auth-logo .logo-dark { display: none; }
html[data-theme="dark"] .auth-logo .logo-light { display: none; }
html[data-theme="dark"] .auth-logo .logo-dark { display: block; }
.smtp-help { margin: 8px 0 14px; } .smtp-help ol { margin: 8px 0 10px; padding-inline-start: 20px; font-size: 13px; line-height: 1.8; }

/* ---- linked design / supervision records */
.linked-recs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.linked-rec { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none; background: var(--surface); }
.linked-rec:hover { border-color: var(--line-strong); }
.linked-rec.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.linked-card { border-color: var(--info-line); }
.linked-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--info); }

/* ---- layout: project tabs, sub-tabs, quick filters, home focus */
.p-head { padding: 14px 16px; }
.p-head-id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.p-head-id > .mono { font-weight: 700; }
.p-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.p-kpi { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; color: var(--ink); text-decoration: none; }
.p-kpi span { display: block; font-size: 12px; color: var(--muted); }
.p-kpi b { font-size: 22px; line-height: 1.2; }
.p-kpi.bad b { color: var(--bad); }
.p-kpi:hover { border-color: var(--line-strong); }
.ptabs, .subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.ptabs a, .subtabs a { padding: 10px 14px; color: var(--ink-3); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent;
  margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.ptabs a:hover, .subtabs a:hover { color: var(--ink); }
.ptabs a.on, .subtabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.ptabs .count, .subtabs .count { background: var(--active); color: var(--ink-2); border-radius: 10px; font-size: 11px; padding: 0 7px; }
.ptabs .ptab-link { margin-inline-start: auto; }
.dot-bad { background: var(--bad); color: #fff; border-radius: 50%; width: 16px; height: 16px; display: inline-grid; place-items: center; font-size: 11px; }
.ptab[hidden] { display: none; }
.quick-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.qchip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-weight: 500; }
.qchip b { background: var(--active); border-radius: 10px; padding: 0 7px; font-size: 12px; }
.qchip:hover { border-color: var(--line-strong); }
.qchip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qchip.on b { background: rgba(255,255,255,.2); color: inherit; }
.filters-more { margin-bottom: 12px; }
.filters-more > summary { cursor: pointer; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; list-style: none; }
.filters-more > summary::-webkit-details-marker { display: none; }
.focus { margin-bottom: 18px; }
@media (max-width: 560px) { .p-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.link-edit { margin-top: 12px; } .link-edit > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.link-edit > summary::-webkit-details-marker { display: none; }

/* ---------- services: one colour each, everywhere (architectural blue, safety orange, supervision green) */
:root { --svc-architectural: #2563eb; --svc-safety: #d97706; --svc-supervision: #15803d; }
html[data-theme="dark"] { --svc-architectural: #6b9bff; --svc-safety: #f0a43a; --svc-supervision: #4cc77f; }
.svc-tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 10px; font-size: 11px; font-weight: 700;
  color: var(--svc-c); background: color-mix(in srgb, var(--svc-c) 13%, transparent); }
.svc-architectural { --svc-c: var(--svc-architectural); }
.svc-safety { --svc-c: var(--svc-safety); }
.svc-supervision { --svc-c: var(--svc-supervision); }
.svc-all { --svc-c: var(--ink-3); }
table.t tr[class*="svc-"] > td:first-child { box-shadow: inset -3px 0 0 var(--svc-c); }
html[dir="ltr"] table.t tr[class*="svc-"] > td:first-child { box-shadow: inset 3px 0 0 var(--svc-c); }
.svc-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.svc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.svc-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--svc-c); }
.svc-chip b { font-weight: 700; color: var(--ink-3); font-size: 12px; }
.svc-chip:hover { border-color: var(--svc-c); }
.svc-chip.on { border-color: var(--svc-c); background: color-mix(in srgb, var(--svc-c) 12%, var(--surface)); color: var(--ink); }
.svc-chip.on b { color: var(--svc-c); }
/* monthly reports tracker */
.mr-kpis { margin-bottom: 14px; }
.mr-progress { margin-bottom: 14px; }
.mr-progress .qt-bar { height: 8px; margin-top: 8px; }
table.t tr.mr-missing > td:first-child { box-shadow: inset -3px 0 0 var(--bad); }

/* home: the to-do list is a short list beside the other card, cards keep their own height */
.grid.two.focus { align-items: start; }
.todo-rows li { position: relative; }
.todo-rows .svc-dot { width: 4px; align-self: stretch; border-radius: 2px; background: var(--svc-c); flex: none; }
.todo-rows .badge { flex: none; }
.more-link { display: block; margin-top: 10px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.more-link:hover { color: var(--ink); text-decoration: underline; }
