/* E-REP console — navy side rail, white work surfaces on a cool canvas, hairline borders, one brand blue.
   Structure: tokens → base → shell (rail, top bar) → page template (head, KPI tiles, cards, toolbars, filters) →
   controls → tables → charts → overlays → domain components (maps, documents, plan editor, users, chat) → phones. */
@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(../../app/fonts/plex-ar-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(../../app/fonts/plex-ar-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 600; font-display: swap; src: url(../../app/fonts/plex-ar-600.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(../../app/fonts/plex-ar-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(../../app/fonts/plex-la-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(../../app/fonts/plex-la-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 600; font-display: swap; src: url(../../app/fonts/plex-la-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(../../app/fonts/plex-la-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }

/* ---------- tokens ---------- */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #161b22; --muted: #58595b; --faint: #8a8d91;
  --line: #e3e7ee; --line-soft: #eef1f5; --row-hover: #f6f8fb; --head: #f8fafc;
  --brand: #034ea1; --brand-deep: #03367a; --brand-soft: #e6eef8; --brand-ink: #03407f; --link: #0a5bb8;
  --ok: #157a3b; --ok-soft: #e3f5ea; --warn: #b25e07; --warn-soft: #fff2dc; --bad: #c2321f; --bad-soft: #fdecea;
  --side-bg: #08264f; --side-ink: #d6e1f0; --side-muted: #8fa5c2; --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.06); --side-on: rgba(255,255,255,.1);
  --r: 8px; --r-lg: 12px; --side: 252px; --top: 56px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-md: 0 6px 20px rgba(16, 24, 40, .08);
  color-scheme: light;
}
:root[data-scheme="dark"] { --bg: #0b1017; --panel: #121a25; --ink: #e6eaf0; --muted: #98a3b3; --faint: #6b7686; --line: #243040; --line-soft: #1d2735; --row-hover: #18212d; --head: #151d28; --brand: #4a8fe0; --brand-deep: #3b80d1; --brand-soft: #14305a; --brand-ink: #a9c8f5; --link: #86b4f0; --ok: #4ade80; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #3a2a0c; --bad: #f87171; --bad-soft: #3d1a16; --side-bg: #06182f; --shadow: none; --shadow-md: 0 8px 24px rgba(0,0,0,.4); color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root[data-scheme="auto"] { --bg: #0b1017; --panel: #121a25; --ink: #e6eaf0; --muted: #98a3b3; --faint: #6b7686; --line: #243040; --line-soft: #1d2735; --row-hover: #18212d; --head: #151d28; --brand: #4a8fe0; --brand-deep: #3b80d1; --brand-soft: #14305a; --brand-ink: #a9c8f5; --link: #86b4f0; --ok: #4ade80; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #3a2a0c; --bad: #f87171; --bad-soft: #3d1a16; --side-bg: #06182f; --shadow: none; --shadow-md: 0 8px 24px rgba(0,0,0,.4); color-scheme: dark; } }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Plex, Tahoma, Arial, sans-serif; font-size: 13.5px; line-height: 1.5; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; }
.num, .money { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.money.neg { color: var(--bad); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .b { font-weight: 600; } .xs { font-size: 11.5px; }
.ltr { direction: ltr; text-align: left; }
.warn-t { color: var(--warn); } .bad-t { color: var(--bad); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -4px; }
.leaflet-container svg { width: auto; height: auto; vertical-align: baseline; }
.main { min-width: 0; overflow-x: clip; }
.stack > *, .grid > *, .panel, .card { min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; }

/* ---------- shell: navy side rail ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-ink); }
.sidehead { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; border-bottom: 1px solid var(--side-line); min-height: var(--top); }
.sidehead:hover { text-decoration: none; }
.sidehead .logo { width: 32px; height: 32px; flex-shrink: 0; }
.sidehead .brand { font-weight: 700; font-size: 15px; line-height: 1.2; display: flex; flex-direction: column; min-width: 0; }
.sidehead .brand small { font-weight: 400; font-size: 11.5px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav { flex: 1; overflow-y: auto; padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.navgroup { margin-top: 6px; } .navgroup:first-child { margin-top: 2px; }
.navgroup .gh { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; color: var(--side-muted); font-size: 11px; font-weight: 600; letter-spacing: .3px; padding: 8px 10px 4px; cursor: pointer; text-align: start; }
.navgroup .gh:hover { color: var(--side-ink); }
.navgroup .gh .chev { margin-inline-start: auto; width: 14px; height: 14px; opacity: .7; transition: transform .15s; }
.navgroup[data-open="false"] .gh .chev { transform: rotate(-90deg); }
.navgroup[data-open="false"] .gi { display: none; }
.navgroup .gi { display: flex; flex-direction: column; gap: 1px; }
.navitem { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 7px; color: var(--side-ink); font-weight: 500; font-size: 13.5px; position: relative; }
.navitem svg { width: 18px; height: 18px; opacity: .75; }
.navitem:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.navitem[aria-current="page"] { background: var(--side-on); color: #fff; font-weight: 600; } .navitem[aria-current="page"] svg { opacity: 1; }
.navitem[aria-current="page"]::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: -10px; width: 3px; border-radius: 2px; background: var(--brand); }
.navitem .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navitem .badge { background: var(--bad); }
.navitem .badge.soft { background: rgba(255,255,255,.14); color: #fff; }
.sidefoot { padding: 10px 12px; border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--side-muted); }
.sidefoot .st { background: rgba(255,255,255,.06); color: var(--side-ink); }
.sidefoot .st.ok::before { background: #4ade80; } .sidefoot .st.bad::before { background: #f87171; } .sidefoot .st.warn::before { background: #fbbf24; }
.sidefoot .ver { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.sidescrim { display: none; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; height: var(--top); padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar .menubtn { display: none; }
.topbar .spacer { flex: 1; }
.topbar .co { display: flex; align-items: center; gap: 10px; font-size: 13.5px; } .topbar .co b { font-weight: 600; }
.topbar .me { font-size: 13px; color: var(--muted); }
.gsearch { position: relative; width: min(380px, 100%); }
.gsearch .input { padding-inline-start: 34px; height: 36px; background: var(--bg); border-color: transparent; }
.gsearch .input:focus { background: var(--panel); border-color: var(--brand); }
.gsearch > svg { position: absolute; inset-inline-start: 10px; top: 9px; color: var(--faint); }
.gsearch .kbd { position: absolute; inset-inline-end: 8px; top: 8px; font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; line-height: 18px; background: var(--panel); pointer-events: none; }
.gsearch .hits { position: absolute; inset-inline: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 6px; display: none; max-height: 70vh; overflow: auto; z-index: 50; }
.gsearch .hits:not(:empty) { display: block; }
.gsearch .hits .sec { font-size: 11px; font-weight: 600; color: var(--faint); padding: 8px 10px 2px; letter-spacing: .3px; }
.gsearch .hit { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink); }
.gsearch .hit:hover, .gsearch .hit[aria-selected="true"] { background: var(--row-hover); text-decoration: none; }
.gsearch .hit svg { color: var(--faint); } .gsearch .hit .t { flex: 1; min-width: 0; } .gsearch .hit .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .gsearch .hit .t small { color: var(--muted); font-size: 12px; }
.gsearch .hit .go { font-size: 11.5px; color: var(--faint); }
.tbtn { position: relative; }
.tbtn .dotbadge { position: absolute; top: 3px; inset-inline-end: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--panel); box-sizing: content-box; }
.userbtn { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 3px 10px 3px 4px; cursor: pointer; }
.userbtn:hover { background: var(--row-hover); }
.userbtn .who { text-align: start; line-height: 1.2; } .userbtn .who b { display: block; font-size: 13px; font-weight: 600; } .userbtn .who small { color: var(--muted); font-size: 11px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.menuwrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 6px; z-index: 60; }
.menu .mh { padding: 8px 10px 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; } .menu .mh b { display: block; font-weight: 600; } .menu .mh small { color: var(--muted); }
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; text-align: start; color: var(--ink); font-size: 13.5px; }
.menu .mi:hover { background: var(--row-hover); text-decoration: none; } .menu .mi svg { color: var(--muted); } .menu .mi .r { margin-inline-start: auto; color: var(--faint); font-size: 12px; }
.menu .mi.danger { color: var(--bad); } .menu .mi.danger svg { color: var(--bad); }
.menu .sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.menu .mi .st { margin-inline-start: auto; }
.notif { width: 360px; max-width: 90vw; }
.notif .ni { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; cursor: pointer; color: inherit; }
.notif .ni:hover { background: var(--row-hover); text-decoration: none; }
.notif .ni .ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--head); color: var(--muted); flex-shrink: 0; }
.notif .ni .ic.warn { background: var(--warn-soft); color: var(--warn); } .notif .ni .ic.bad { background: var(--bad-soft); color: var(--bad); } .notif .ni .ic.brand { background: var(--brand-soft); color: var(--brand-ink); }
.notif .ni .t { flex: 1; min-width: 0; } .notif .ni .t b { display: block; font-weight: 600; font-size: 13px; } .notif .ni .t small { color: var(--muted); font-size: 12px; }
.notif .ni .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.notif .none { padding: 20px; text-align: center; color: var(--faint); font-size: 13px; }
.tabbar { display: none; }

/* ---------- page template ---------- */
.content { padding: 22px 28px 56px; max-width: 1440px; margin: 0 auto; width: 100%; }
.pagehead { display: flex; align-items: flex-end; gap: 14px; margin: 0 0 18px; flex-wrap: wrap; }
.pagehead .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); margin-bottom: 4px; }
.pagehead .crumbs a { color: var(--faint); } .pagehead .crumbs a:hover { color: var(--brand-ink); }
.pagehead .crumbs svg { width: 12px; height: 12px; }
.pagehead h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; line-height: 1.25; display: flex; align-items: center; gap: 10px; }
.pagehead .sub { color: var(--muted); font-size: 13px; margin-top: 3px; max-width: 70ch; }
.pagehead .acts { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; } .section h2 { font-size: 15px; font-weight: 700; } .section .acts { margin-inline-start: auto; display: flex; gap: 6px; }

/* KPI tiles (the `.summary .sum` names are the same component) */
.kpis, .summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi, .summary .sum { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 12px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; gap: 2px; position: relative; color: inherit; }
.kpi.click, .summary .sum.click { cursor: pointer; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.kpi.click:hover, .summary .sum.click:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); text-decoration: none; }
.kpi.on, .summary .sum.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.kpi small, .summary .sum small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi small svg, .summary .sum small svg { width: 15px; height: 15px; color: var(--faint); }
.kpi b, .summary .sum b { display: block; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.4px; margin-top: 4px; }
.kpi .sub, .summary .sum .sub { font-size: 12px; color: var(--faint); margin-top: 1px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi.ok b, .summary .sum.ok b { color: var(--ok); } .kpi.warn b, .summary .sum.warn b { color: var(--warn); } .kpi.bad b, .summary .sum.bad b { color: var(--bad); }
.kpi .trend { font-size: 11.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; line-height: 18px; } .trend.up { color: var(--ok); background: var(--ok-soft); } .trend.down { color: var(--bad); background: var(--bad-soft); } .trend.flat { color: var(--muted); background: var(--head); }
.kpi .vrow { display: block; } .kpi .vrow b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .kpi .spark { display: block; width: 100%; height: 22px; opacity: .8; margin-top: 6px; } .kpi .spark svg { width: 100%; height: 100%; }
.kpi .spark svg { width: 100%; height: 100%; }

/* cards (`.panel` is the same component) */
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; } .card.flush > .ch { margin: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; } .card.flush .scroll { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card > .ch, .card > h2, .card > h3, .panel > h2, .panel > h3 { margin: -14px -16px 14px; padding: 11px 16px; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; min-height: 46px; }
.card > .ch h2 { font-size: 14px; font-weight: 700; }
.card > .ch .cnt, .panel > h2 .cnt { font-weight: 600; font-size: 12px; color: var(--muted); background: var(--head); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.card > .ch .desc { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.card > .ch .acts, .card > h2 .acts, .card > h3 .acts, .panel > h2 .acts, .panel > h3 .acts { margin-inline-start: auto; display: flex; gap: 6px; font-weight: 400; align-items: center; flex-wrap: wrap; }
.card .cf { margin: 14px -16px -14px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--head); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 14px; } .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c21 { grid-template-columns: 2fr 1fr; } .grid.c12 { grid-template-columns: 1fr 2fr; } .grid.c32 { grid-template-columns: 3fr 2fr; }
.grid.start { align-items: start; }

/* list rows inside cards (attention list, team now) */
.rows { display: flex; flex-direction: column; margin: 0 -16px; }
.rows .ri { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--line-soft); color: inherit; }
.rows .ri:first-child { border-top: 0; }
.rows a.ri:hover, .rows .ri.click:hover { background: var(--row-hover); text-decoration: none; cursor: pointer; }
.rows .ri .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--head); color: var(--muted); flex-shrink: 0; }
.rows .ri .ic.warn { background: var(--warn-soft); color: var(--warn); } .rows .ri .ic.bad { background: var(--bad-soft); color: var(--bad); } .rows .ri .ic.ok { background: var(--ok-soft); color: var(--ok); } .rows .ri .ic.brand { background: var(--brand-soft); color: var(--brand-ink); }
.rows .ri .t { flex: 1; min-width: 0; } .rows .ri .t b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .rows .ri .t small { color: var(--muted); font-size: 12px; display: block; }
.rows .ri .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; } .rows .ri .v small { display: block; font-weight: 400; color: var(--faint); font-size: 11.5px; }
.rows .ri .chev { color: var(--faint); width: 14px; height: 14px; }
.rows.tight .ri { padding: 7px 16px; }

/* skeleton loading */
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.skel { background: var(--line-soft); border-radius: 6px; animation: pulse 1.4s ease-in-out infinite; }
.skel.t { height: 12px; width: 60%; } .skel.v { height: 24px; width: 40%; margin-top: 6px; } .skel.row { height: 38px; width: 100%; margin-bottom: 6px; border-radius: 8px; }
.skelrows { padding: 6px 0; }

/* empty states */
.empty { text-align: center; color: var(--muted); padding: 34px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .eic { width: 44px; height: 44px; border-radius: 12px; background: var(--head); display: grid; place-items: center; color: var(--faint); margin-bottom: 6px; } .empty .eic svg { width: 22px; height: 22px; }
.empty > svg { width: 26px; height: 26px; opacity: .45; margin-bottom: 4px; }
.empty b { color: var(--ink); font-weight: 600; } .empty p { margin: 0; font-size: 12.5px; max-width: 46ch; } .empty .btn { margin-top: 10px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 8px 14px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--ink); } .tabs button[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button .cnt { font-size: 11px; font-weight: 600; background: var(--head); color: var(--muted); border-radius: 999px; padding: 0 6px; line-height: 17px; } .tabs button[aria-selected="true"] .cnt { background: var(--brand-soft); color: var(--brand-ink); }
.tabs.pill { border: 0; gap: 4px; margin-bottom: 12px; } .tabs.pill button { border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; margin: 0; } .tabs.pill button[aria-selected="true"] { background: var(--brand-soft); border-color: transparent; }
/* vertical settings navigation */
.vtabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--top) + 20px); }
.vtabs button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; cursor: pointer; text-align: start; font-size: 13.5px; }
.vtabs button:hover { background: var(--row-hover); color: var(--ink); } .vtabs button[aria-selected="true"] { background: var(--panel); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow); border: 1px solid var(--line); }
.vtabs button svg { color: var(--faint); } .vtabs button[aria-selected="true"] svg { color: var(--brand); }
.settingswrap { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.setrow { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.4fr); gap: 8px 24px; padding: 14px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.setrow:first-of-type { border-top: 0; padding-top: 4px; }
.setrow .sl b { display: block; font-weight: 600; } .setrow .sl small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.5; }
.setrow .sv { display: flex; flex-direction: column; gap: 8px; }

/* hints, key-values, pills */
.hint { font-size: 13px; color: var(--muted); background: var(--head); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 9px 12px; line-height: 1.55; }
.hint.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; } .hint.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; } .hint.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13.5px; } .kv dt { color: var(--muted); white-space: nowrap; } .kv dd { margin: 0; }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); transition: background .12s, border-color .12s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--row-hover); border-color: #cfd6e0; text-decoration: none; } .btn:active { background: var(--head); } .btn:disabled { opacity: .5; cursor: default; }
:root[data-scheme="dark"] .btn:hover { border-color: #334155; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; } .btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); } .btn.danger.primary { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; } .btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 42px; font-size: 15px; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; } .btn.ghost:hover { background: var(--row-hover); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); box-shadow: none; font-weight: 600; } .btn.soft:hover { background: var(--brand-soft); filter: brightness(.97); }
.btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; font-weight: 600; }
.iconbtn { width: 34px; height: 34px; border: 1px solid transparent; border-radius: var(--r); background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.iconbtn:hover { background: var(--row-hover); color: var(--ink); } .iconbtn.sm { width: 26px; height: 26px; } .iconbtn.sm svg { width: 14px; height: 14px; } .iconbtn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.iconbtn.line { border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); }
.input, select.input, textarea.input { height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); width: 100%; font-size: 13.5px; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 76px; resize: vertical; }
.input:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder { color: var(--faint); }
.input.sm { height: 28px; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; }
.inwrap { position: relative; } .inwrap > svg { position: absolute; inset-inline-start: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 15px; height: 15px; } .inwrap .input { padding-inline-start: 30px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f > .input { color: var(--ink); font-weight: 400; }
.form { display: grid; gap: 12px; } .form.cols { grid-template-columns: 1fr 1fr; } .form .span { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; } .check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #cfd6e0; border: 0; cursor: pointer; flex-shrink: 0; transition: background .15s; }
:root[data-scheme="dark"] .switch { background: #334155; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch[aria-checked="true"] { background: var(--brand); } .switch[aria-checked="true"]::after { transform: translateX(-16px); }
/* filter bar: compact row of controls; changes apply at once */
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 14px; box-shadow: var(--shadow); }
.filters label.f { min-width: 130px; } .filters label.f.w { min-width: 240px; flex: 1; } .filters .input { width: auto; min-width: 130px; } .filters label.f.w .input { width: 100%; }
.filters .grow { flex: 1; } .filters .btn { height: 34px; } .filters .apply { margin-inline-start: auto; }
.filters .quick { display: flex; gap: 4px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); padding: 2px; gap: 2px; height: 34px; align-items: center; }
.seg button { border: 0; background: transparent; padding: 0 11px; height: 28px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 500; border-radius: 6px; white-space: nowrap; }
.seg button:hover { color: var(--ink); } .seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.range { display: inline-flex; align-items: center; gap: 4px; } .range input { height: 34px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 8px; background: var(--panel); width: 136px; font-size: 13px; color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; cursor: pointer; }
.chip[aria-pressed="true"], .chip.on { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; font-weight: 600; }
.chip.x::after { content: "×"; font-weight: 700; margin-inline-start: 2px; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--head); border: 1px solid var(--line-soft); white-space: nowrap; line-height: 19px; }
.tag.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; } .tag.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; } .tag.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; } .tag.brand { color: var(--brand-ink); background: var(--brand-soft); border-color: transparent; }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 22px; white-space: nowrap; background: var(--head); color: var(--muted); }
.st::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.st.ok { background: var(--ok-soft); color: var(--ok); } .st.ok::before { background: var(--ok); }
.st.warn { background: var(--warn-soft); color: var(--warn); } .st.warn::before { background: var(--warn); }
.st.bad { background: var(--bad-soft); color: var(--bad); } .st.bad::before { background: var(--bad); }
.st.brand { background: var(--brand-soft); color: var(--brand-ink); } .st.brand::before { background: var(--brand); }
.st.live::before { box-shadow: 0 0 0 3px var(--ok-soft); }
.st[style] { background: transparent; color: var(--ink); padding: 0; font-weight: 500; } .st[style]::before { background: var(--c, var(--faint)); width: 8px; height: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); } .dot.on { background: var(--ok); } .dot.warn { background: var(--warn); }
.flag { display: inline-block; font-size: 11.5px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 0 7px; margin-inline-end: 3px; line-height: 18px; font-weight: 600; }
.custlink { color: var(--link); cursor: pointer; font-weight: 500; } .custlink:hover { text-decoration: underline; }
.who { display: inline-flex; flex-direction: column; min-width: 0; } .who b { font-weight: 600; } .who .sub { display: block; font-size: 11.5px; color: var(--faint); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* ---------- tables ---------- */
.scroll { overflow: auto; max-height: 72vh; } .scroll.tall { max-height: none; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; font-size: 11.5px; color: var(--muted); padding: 9px 12px; background: var(--head); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; letter-spacing: .1px; }
.tbl th.sortable { cursor: pointer; user-select: none; } .tbl th.sortable:hover { color: var(--ink); }
.tbl th .sortmark { display: inline-block; width: 10px; margin-inline-start: 3px; color: var(--brand); font-size: 9px; }
.tbl th[aria-sort="ascending"] .sortmark::after { content: "▲"; } .tbl th[aria-sort="descending"] .sortmark::after { content: "▼"; }
.tbl th[aria-sort] { color: var(--ink); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; height: 42px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; } .tbl tbody tr:hover td { background: var(--row-hover); }
.tbl td:first-child { font-weight: 500; }
.tbl td.n, .tbl th.n { text-align: end; } .tbl td.n { font-variant-numeric: tabular-nums; }
.tbl .sub { display: block; font-size: 11.5px; color: var(--faint); font-weight: 400; }
.tbl tfoot td { font-weight: 700; background: var(--head); border-top: 1px solid var(--line); position: sticky; bottom: 0; }
.tbl tr.off td { color: var(--faint); }
.tbl tr.sel td { background: var(--brand-soft) !important; }
.tbl tr.sec td { background: var(--head); font-weight: 700; font-size: 12.5px; color: var(--muted); height: 34px; }
.tbl td.chk, .tbl th.chk { width: 36px; text-align: center; } .tbl input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.tbl.compact td { height: 36px; padding: 6px 12px; }
.tbl th.x, .tbl td.x { display: none; } .tbl.more th.x, .tbl.more td.x { display: table-cell; }
.tbl .rowacts { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .1s; } .tbl tr:hover .rowacts { opacity: 1; }
.bar { height: 6px; border-radius: 3px; background: var(--line-soft); min-width: 70px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.bar.ok i { background: var(--ok); } .bar.warn i { background: var(--warn); } .bar.bad i { background: var(--bad); }
.prog { display: flex; align-items: center; gap: 8px; } .prog .bar { flex: 1; } .prog .num { min-width: 42px; text-align: end; font-size: 12px; color: var(--muted); }

/* ---------- charts ---------- */
.chart { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut .slice { cursor: pointer; transition: opacity .12s; } .donut .slice:hover { opacity: .8; }
.donut .mid { font-size: 17px; font-weight: 700; fill: var(--ink); } .donut .mid2 { font-size: 11px; fill: var(--muted); }
.chartlegend { display: grid; gap: 4px; flex: 1; min-width: 220px; }
.chartlegend .li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.chartlegend .li:hover { background: var(--row-hover); } .chartlegend .sw { width: 12px; height: 12px; border-radius: 3px; }
.chartlegend .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .chartlegend .pc { color: var(--muted); } .chartlegend .v { font-weight: 600; }
.share { display: flex; align-items: center; gap: 8px; } .share .bar { flex: 1; min-width: 50px; } .share .num { min-width: 36px; text-align: end; }
.chartrow { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; align-items: start; }
.xy { width: 100%; display: block; overflow: visible; height: auto; }
.xy text { font-family: inherit; fill: var(--muted); font-size: 11px; } .xy .grid line { stroke: var(--line-soft); } .xy .axis line { stroke: var(--line); }
.xy .br { cursor: pointer; } .xy .br:hover { opacity: .8; } .xy .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .xy .area { opacity: .08; }
.xy .pt { fill: var(--panel); stroke-width: 2; }
.xy .tick { fill: var(--faint); } .xy .today text { fill: var(--brand-ink); font-weight: 600; }
.legend2 { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; } .legend2 .li { display: inline-flex; align-items: center; gap: 6px; } .legend2 .sw { width: 10px; height: 10px; border-radius: 3px; } .legend2 b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 8px; } .hbars .hb { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: 13px; } .hbars .hb .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .hbars .hb .bar { height: 8px; min-width: 0; } .hbars .hb .v { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 60px; text-align: end; }
.sparkline { width: 100%; height: 28px; } .sparkline path { fill: none; stroke: var(--brand); stroke-width: 1.5; }
@media (max-width: 900px) { .chartrow { grid-template-columns: 1fr; } .chart { justify-content: center; } }

/* ---------- modal, toast, lightbox ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 2000; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(700px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(16, 24, 40, .25); }
.modal.wide { width: min(1040px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; background: var(--panel); }
.modal header h3 { margin: 0; flex: 1; font-size: 15px; font-weight: 700; }
.modal .body { padding: 16px; } .modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 2100; max-width: 90vw; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2050; display: grid; place-items: center; cursor: zoom-out; } .lightbox img { max-width: 95vw; max-height: 92vh; border-radius: 6px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login .box { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 28px 24px; box-shadow: 0 10px 40px rgba(16, 24, 40, .08); text-align: center; }
.login .logo svg { width: 170px; height: auto; margin: 0 auto 6px; display: block; }
.login .mark { display: none; }
.login h1 { margin: 0 0 2px; font-size: 18px; } .login p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login .form { text-align: start; }
.login .err { color: var(--bad); font-size: 12.5px; min-height: 18px; }

/* ---------- maps ---------- */
.map { height: 440px; border: 1px solid var(--line); border-radius: var(--r); background: var(--head); overflow: hidden; }
.map.tall { height: calc(100vh - 240px); min-height: 400px; }
.leaflet-container { font: inherit; }
.pinlabel { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow); }
.repdot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); }
.repdot.stale { background: var(--faint); box-shadow: 0 0 0 1px var(--faint); } .repdot.visit { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.stopnum { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 11.5px; display: grid; place-items: center; border: 2px solid #fff; }
.map.drawing { cursor: crosshair; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; margin-top: 8px; color: var(--muted); } .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-inline-end: 5px; vertical-align: -1px; }
.mapstage { position: relative; margin-bottom: 14px; }
.mapstage .map { height: calc(100vh - 300px); min-height: 420px; }
.maplegend { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 500; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; box-shadow: var(--shadow-md); max-width: 300px; max-height: calc(100% - 24px); overflow: auto; font-size: 12.5px; }
.maplegend .ttl { font-weight: 700; margin-bottom: 6px; display: flex; flex-direction: column; gap: 1px; }
.maplegend .li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.maplegend .li:hover { background: var(--row-hover); } .maplegend .li.off { opacity: .4; text-decoration: line-through; }
.maplegend .sw { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); } .maplegend .sw.none { background: #b8c0cc; }
.maplegend .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; } .maplegend .n { color: var(--muted); } .maplegend .v { font-weight: 600; }
.leaflet-tooltip { font-family: inherit; font-size: 12.5px; border-radius: 8px; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(16,24,40,.12); direction: rtl; text-align: right; }
/* live map: rep list beside the map */
.livewrap { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.livewrap .map { height: calc(100vh - 230px); min-height: 460px; }

/* ---------- documents, approvals, photos ---------- */
.doccard { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.doccard .lines { margin-top: 8px; font-size: 13px; } .doccard .lines div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.doccard .why { font-size: 12.5px; color: var(--warn); font-weight: 600; }
.doccard .acts { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; } .photos img { width: 104px; height: 104px; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }
.photos img.sigimg { object-fit: contain; background: #fff; }

/* ---------- plan editor ---------- */
.planwrap { display: grid; grid-template-columns: 420px 1fr; gap: 14px; }
.weekdays { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.weekdays button { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 4px 4px; cursor: pointer; color: var(--muted); display: flex; flex-direction: column; align-items: center; min-width: 48px; flex: 1; font-size: 12.5px; font-weight: 500; }
.weekdays button small { font-size: 10.5px; opacity: .8; } .weekdays button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.weekdays.month button { min-width: 38px; padding: 2px 4px; } .weekdays button.today { border-color: var(--ok); }
.stops { display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.stop { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); cursor: grab; }
.stop .stoprow { display: flex; align-items: center; gap: 8px; } .stop .stopmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-inline-start: 30px; }
.stop .purpose { display: flex; gap: 6px; flex-wrap: wrap; } .stop .pp { display: inline-flex; align-items: center; gap: 4px; }
.stop .pp .chip { padding: 1px 8px; font-size: 12px; } .stop .pp .tgt { width: 96px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; direction: ltr; text-align: end; }
.stop .stopmeta input:not(.tgt) { flex: 1; min-width: 120px; }
.stop.drag { opacity: .4; } .stop.over { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.stop .nm { flex: 1; min-width: 0; } .stop .nm b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; } .stop .nm input { border: 0; background: transparent; font-size: 12px; width: 100%; color: var(--muted); outline: 0; }
.stop .iconbtn { width: 26px; height: 26px; }
.pick { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.pick button { display: flex; width: 100%; text-align: start; gap: 6px; align-items: center; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.pick button:last-child { border-bottom: 0; } .pick button:hover { background: var(--row-hover); } .pick button:disabled { opacity: .45; cursor: default; }
.pick button small { margin-inline-start: auto; color: var(--faint); }

/* ---------- users / roles / settings ---------- */
.matrix td:first-child { font-weight: 500; } .matrix td.c { text-align: center; } .matrix th.c { text-align: center; }
.matrix td.c.over { background: var(--warn-soft); }
.matrix th.rolehead { vertical-align: top; } .matrix th.rolehead .nm { font-weight: 700; } .matrix th.rolehead .nm .sub { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.matrix th.rolehead .acts { display: flex; justify-content: center; gap: 2px; margin-top: 4px; }
.rule { display: grid; grid-template-columns: 40px 1fr 1fr 1fr 110px auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.rule .types { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 2 / -1; }
.rule .types label { font-size: 12.5px; display: inline-flex; gap: 4px; align-items: center; }
.rule .rl .onlymobile { display: none; } .rule .slot-off { visibility: hidden; }
.onlymobile { display: none; }
.chip.pick { border: 1.5px solid var(--line); background: var(--panel); color: var(--muted); padding-inline-start: 8px; }
.chip.pick .tick { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line); font-size: 9px; line-height: 11px; text-align: center; color: transparent; }
.chip.pick[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip.pick[aria-pressed="true"] .tick { background: #fff; border-color: #fff; color: var(--brand); }
.chip.pick:hover { border-color: var(--brand); }
.pills.prices { gap: 6px 14px; } .pricerow { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line-soft); border-radius: 8px; } .pricerow .small { gap: 3px; }
.custhits { border: 1px solid var(--line); border-radius: var(--r-lg); max-height: 220px; overflow: auto; margin-top: 4px; background: var(--panel); }
.custhits button { display: block; width: 100%; text-align: start; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.custhits button:hover { background: var(--row-hover); }
.chip .chipx { border: 0; background: transparent; color: inherit; font-weight: 700; cursor: pointer; padding: 0 2px; line-height: 1; }

/* ---------- distribution: basket + zone members ---------- */
.assignwrap { display: grid; grid-template-columns: 1fr 460px; gap: 14px; }
.basket .assignbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.basket .assignbar .f { min-width: 200px; }
.cpick .search { position: relative; margin-bottom: 8px; }
.cpick .hits { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 4px; display: none; }
.cpick .hits:not(:empty) { display: block; }
.cpick .hit { display: grid; grid-template-columns: 1fr auto 22px; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.cpick .hit:hover { background: var(--row-hover); }
.cpick .hit .nm { font-weight: 600; display: flex; flex-direction: column; min-width: 0; } .cpick .hit .nm .sub { font-weight: 400; }
.cpick .hit .plus { color: var(--brand); font-weight: 700; text-align: center; }
.cpick .hits .btn { margin: 4px; }
.cpick .list { max-height: 320px; overflow: auto; border-top: 1px solid var(--line-soft); }
.cpick .row { display: grid; grid-template-columns: 1fr auto 28px; gap: 8px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line-soft); }
.cpick .row a { font-weight: 600; } .cpick .row .sub { display: block; }
.cpick .x { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 14px; width: 28px; height: 28px; border-radius: 50%; }
.cpick .x:hover { background: var(--bad-soft); color: var(--bad); }
.cpick .hint { margin-top: 6px; }

/* ---------- product map ---------- */
.heatcanvas { mix-blend-mode: multiply; }
:root[data-scheme="dark"] .heatcanvas { mix-blend-mode: screen; opacity: .85; }
.heatpopup .leaflet-popup-content-wrapper { border-radius: 12px; font-family: inherit; direction: rtl; text-align: right; }
.heatpopup .leaflet-popup-content { margin: 10px 12px; font-size: 12.5px; }
.heatpop .ttl { font-weight: 700; margin-bottom: 4px; }
.heatpop .li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 4px 2px; cursor: pointer; border-radius: 6px; }
.heatpop .li:hover { background: var(--row-hover); }
.heatpop .sw { width: 10px; height: 10px; border-radius: 50%; }
.heatpop .nm { font-weight: 600; min-width: 0; display: flex; flex-direction: column; } .heatpop .nm .sub { font-weight: 400; }
.heatpop .v { font-weight: 600; }

/* ---------- chatter (activity log) & chat ---------- */
.chatter { display: flex; flex-direction: column; gap: 10px; }
.chatter .entry { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.chatter .entry .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.chatter .entry .hd { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; } .chatter .entry .hd b { font-weight: 600; } .chatter .entry .hd time { color: var(--faint); font-size: 11.5px; }
.chatter .entry .txt { font-size: 13px; color: var(--ink); } .chatter .entry .note { background: var(--head); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 7px 10px; margin-top: 3px; white-space: pre-wrap; }
.chatter .entry .diff { margin: 3px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); } .chatter .entry .diff li { display: flex; gap: 6px; flex-wrap: wrap; } .chatter .entry .diff b { font-weight: 500; color: var(--ink); }
.chatter .entry .diff .old { text-decoration: line-through; color: var(--faint); }
.chatter.compose, .chatter .compose { display: flex; flex-direction: row; gap: 8px; align-items: flex-end; } .compose textarea.input { min-height: 40px; }
.timeline { display: flex; flex-direction: column; } .timeline .day { font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 12px 0 6px; letter-spacing: .3px; }
.chatwrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; height: calc(100vh - 150px); min-height: 480px; }
.threads { overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.thread { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r); cursor: pointer; }
.thread:hover { background: var(--row-hover); } .thread[aria-current="true"] { background: var(--brand-soft); }
.thread .t { flex: 1; min-width: 0; } .thread .t b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .thread .t small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .when { font-size: 11px; color: var(--faint); }
.chatpane { display: flex; flex-direction: column; min-height: 0; }
.chatpane .head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); } .chatpane .head .backbtn { display: none; }
.msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.msg { max-width: min(78%, 560px); padding: 8px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.msg.mine { align-self: flex-end; background: var(--brand); color: #fff; border-color: var(--brand); }
.msg .from { display: block; font-size: 11.5px; font-weight: 600; color: var(--brand-ink); margin-bottom: 2px; } .msg.mine .from { display: none; }
.msg .meta { display: block; font-size: 10.5px; color: var(--faint); text-align: end; margin-top: 2px; } .msg.mine .meta { color: rgba(255,255,255,.75); }
.msg.day { align-self: center; background: transparent; border: 0; color: var(--faint); font-size: 11.5px; padding: 2px 8px; }
.composer { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); } .composer .input { flex: 1; }

@media print { .side, .topbar, .tabbar, .sidescrim, .pagehead .acts, .filters { display: none !important; } .app { display: block; } .content { padding: 0; } .panel, .card { border: 0; box-shadow: none; } }

/* ---------- tablets ---------- */
@media (max-width: 1100px) { :root { --side: 216px; } .planwrap, .assignwrap, .chatwrap, .livewrap, .settingswrap { grid-template-columns: 1fr; } .chatwrap { height: auto; } .livewrap .map { height: 60vh; } .grid.c3 { grid-template-columns: 1fr 1fr; } .grid.c21, .grid.c12, .grid.c32 { grid-template-columns: 1fr; } .content { padding: 16px 16px 48px; } .topbar { padding: 0 16px; } .gsearch { width: min(260px, 100%); } .vtabs { position: static; flex-direction: row; overflow-x: auto; } }

/* ---------- phones: drawer navigation + bottom tab bar ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(290px, 84vw); z-index: 1200; transform: translateX(100%); transition: transform .2s ease; box-shadow: none; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .sidescrim { display: block; position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 1100; opacity: 0; pointer-events: none; transition: opacity .2s; } .sidescrim.on { opacity: 1; pointer-events: auto; }
  .topbar { height: 52px; padding: 0 8px; gap: 4px; } .topbar .menubtn { display: inline-grid; } .topbar .co, .topbar .spacer, .topbar > .tag { display: none; } .userbtn .who { display: none; } .userbtn > svg { display: none; } .gsearch { width: auto; flex: 1 1 auto; min-width: 0; } .gsearch .input { height: 36px; } .gsearch .kbd { display: none; } .topbar .me { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; inset-inline: 0; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); z-index: 1000; }
  .tabbar .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--muted); border: 0; background: transparent; cursor: pointer; position: relative; font-weight: 500; }
  .tabbar .tab svg { width: 21px; height: 21px; } .tabbar .tab[aria-current="page"] { color: var(--brand-ink); font-weight: 600; }
  .tabbar .tab .badge { position: absolute; top: 6px; inset-inline-end: calc(50% - 20px); }
  .tabbar .tab:hover { text-decoration: none; }
  .content { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
  .pagehead { margin-bottom: 12px; } .pagehead h1 { font-size: 19px; } .pagehead .acts { margin-inline-start: 0; width: 100%; } .pagehead .crumbs { display: none; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr 1fr; } .form.cols { grid-template-columns: 1fr; }
  .kpis, .summary { grid-template-columns: 1fr 1fr; gap: 8px; } .kpi, .summary .sum { padding: 10px 12px; } .kpi b, .summary .sum b { font-size: 19px; } .kpi .spark { display: none; }
  .filters { padding: 10px; gap: 8px; } .filters label.f, .filters .input { min-width: 0; width: 100%; } .filters label.f { flex: 1 1 45%; } .filters .btn { flex: 1 1 100%; } .filters .btn.sm { flex: 1 1 auto; } .filters .apply { margin: 0; }
  .map { height: 300px; } .map.tall { height: 55vh; min-height: 280px; }
  .scroll { max-height: none; }
  .modal { width: 100%; max-height: 100%; height: 100%; border-radius: 0; border: 0; } .scrim { padding: 0; } .modal .body { padding: 12px; }
  .doccard { grid-template-columns: 1fr; } .doccard .acts { flex-direction: row; flex-wrap: wrap; } .doccard .acts .btn { flex: 1; }
  .rule { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
  .rule.head { display: none; } .rule .rl .onlymobile { display: block; } .rule .slot-off { display: none; }
  .weekdays button { min-width: 0; flex: 1; padding: 3px 2px; font-size: 12px; } .weekdays.month button { flex: 0 0 calc(100% / 7 - 4px); }
  .onlymobile { display: block; }
  .matrix.cards td.c.hide, .matrix.cards th.hide { display: none !important; } .matrix.cards td.c::before { display: none; }
  .msg { max-width: 88%; }
  .setrow { grid-template-columns: 1fr; } .settingswrap { gap: 10px; }
  .chatwrap { height: calc(100vh - 190px); min-height: 420px; } .chatwrap > .panel:first-child, .chatwrap > .card:first-child { display: flex; } .chatwrap .chatpane { display: none; }
  .chatwrap.open > .panel:first-child, .chatwrap.open > .card:first-child { display: none; } .chatwrap.open .chatpane { display: flex; }
  .chatpane .head .backbtn { display: inline-grid; }
  .filters label.f.range-f { flex-basis: 100%; } .filters .seg { flex-wrap: wrap; height: auto; } .filters .range { flex-wrap: wrap; } .filters .range input { flex: 1; min-width: 120px; }
  .tbl.cards tr.sec { border: 0; background: transparent; padding: 10px 4px 2px; margin: 0; } .tbl.cards tr.sec td { background: transparent; border: 0; padding: 0; font-weight: 700; color: var(--muted); }
  /* tables become stacked records; each cell shows its column name */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td, .tbl.cards tfoot { display: block; height: auto; }
  .tbl.cards tbody tr { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; margin-bottom: 8px; background: var(--panel); }
  .tbl.cards tbody tr:last-child td { border-bottom: 0; }
  .tbl.cards td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; border: 0; text-align: start; }
  .tbl.cards td.n { text-align: end; } .tbl.cards td:empty { display: none; } .tbl.cards td.x { display: none; } .tbl.cards.more td.x { display: flex; }
  .tbl.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; flex-shrink: 0; }
  .tbl.cards td:first-child { display: block; font-weight: 600; border-bottom: 1px solid var(--line-soft); padding-bottom: 5px; margin-bottom: 4px; }
  .tbl.cards td:first-child::before { display: none; }
  .tbl.cards td.chk { display: inline-flex; width: auto; float: inline-start; margin-inline-end: 6px; }
  .tbl.cards tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; border-radius: var(--r); } .tbl.cards tfoot td { padding: 0; position: static; } .tbl.cards tfoot td:empty { display: none; }
  .tbl .rowacts { opacity: 1; }
  .kv { grid-template-columns: 1fr; gap: 1px 0; } .kv dt { font-size: 11.5px; margin-top: 6px; }
  .photos img { width: calc(33.33% - 6px); height: auto; aspect-ratio: 1; }
  .maplegend { position: static; max-width: none; margin-top: 8px; box-shadow: none; } .mapstage .map { height: 55vh; min-height: 300px; }
  .rows { margin: 0 -12px; } .rows .ri { padding: 9px 12px; }
}

/* ---- page: live ---- */
.livewrap.live-wrap { grid-template-columns: 320px 1fr; }
.livewrap.live-wrap .map { height: calc(100vh - 360px); min-height: 420px; }
.live-list .rows { max-height: calc(100vh - 360px); min-height: 420px; overflow: auto; }
.live-list .ri .avatar { width: 34px; height: 34px; }
.live-list .ri .t small { overflow: hidden; }
.live-list .ri .t small .st { max-width: 100%; font-weight: 500; }
.live-list .ri .t small .st .live-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-list .ri .v { font-weight: 400; }
@media (max-width: 1100px) {
  .livewrap.live-wrap { grid-template-columns: 1fr; }
  .livewrap.live-wrap > .live-map { order: -1; }
  .livewrap.live-wrap .map { height: 60vh; min-height: 320px; }
  .live-list .rows { max-height: none; min-height: 0; }
}

/* ---- page: assign ---- */
.assign-tools { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.assign-side > .cb > .tabs { margin: -14px -16px 14px; padding: 0 8px; }
.assign-zacts { display: inline-flex; gap: 2px; align-items: center; }
.assign-pane .scroll { max-height: 60vh; }
.assign-map .map.tall { height: calc(100vh - 330px); min-height: 460px; }
@media (max-width: 760px) {
  .assign-map .map.tall { height: 55vh; min-height: 300px; }
  .assign-pane .scroll { max-height: none; }
  .assign-side > .cb > .tabs button { padding: 8px 10px; }
}

/* ---- page: pmap ---- */
.pmap-map .mapstage { margin-bottom: 0; }

/* ---- page: approvals ---- */
.approvals-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.approvals-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex-shrink: 0; }
.approvals-ic svg { width: 18px; height: 18px; }
.approvals-head .who { flex: 1; min-width: 220px; }
.approvals-head .who .sub { max-width: none; white-space: normal; font-size: 12.5px; color: var(--muted); }
.approvals-ttl { font-size: 15px; } .approvals-ttl .money { font-weight: 700; margin-inline-start: 6px; }
.approvals-why { display: flex; flex-direction: column; align-items: flex-end; text-align: end; margin-inline-start: auto; }
.approvals-flags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.approvals-lf { margin-inline-start: 6px; }
.approvals-note { margin-top: 8px; }
@media (max-width: 760px) { .approvals-why { flex-basis: 100%; align-items: flex-start; text-align: start; margin-inline-start: 0; } }

/* ---- page: activity ---- */
.activity-day + .activity-day { border-top: 1px solid var(--line-soft); margin-top: 10px; }
.activity-day .day { display: flex; align-items: center; gap: 8px; }
.activity-day .day .cnt { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--head); border-radius: 999px; padding: 0 7px; line-height: 18px; }

/* ---- page: lines ---- */
.lines-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.lines-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--line); flex-shrink: 0; }
.lines-item.input { max-width: 260px; }
/* ranking in a narrow card: name and value on one line, the bar underneath at full width */
.lines-rank .hbars { gap: 10px; } .lines-rank .hbars .hb { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
.lines-rank .hbars .hb .nm { grid-area: 1 / 1; } .lines-rank .hbars .hb .v { grid-area: 1 / 2; min-width: 0; } .lines-rank .hbars .hb .bar { grid-area: 2 / 1 / 3 / 3; }
.lines-drillhead { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.lines-drillhead .who b { font-size: 16px; } .lines-drillhead .who .sub { max-width: none; }

/* ---- page: results ---- */
.results-legend.legend { margin: 0; gap: 10px; }
.results-sel.input { width: auto; min-width: 150px; max-width: 240px; }
@media (max-width: 760px) { .results-legend { display: none; } }

/* ---- page: plans ---- */
.plans-rep.input { width: auto; min-width: 190px; }
.planwrap.plans-v2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.plans-dayhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 8px; }
.plans-v2 .weekdays { margin-bottom: 10px; }
.plans-v2 .stop .iconbtn svg { width: 15px; height: 15px; }
.plans-up svg { transform: rotate(180deg); }
.plans-search { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.plans-pick.pick { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); max-height: 340px; }
.plans-pick button svg { width: 14px; height: 14px; color: var(--brand); } .plans-pick button:disabled svg { color: var(--ok); }
.plans-pick .tag { margin-inline-start: 2px; } .plans-pick .empty { padding: 22px 12px; }
@media (max-width: 1100px) { .planwrap.plans-v2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .plans-rep.input { flex: 1; min-width: 0; } }

/* ---- page: rep ---- */
.rep-pills.tabs { margin: 0; }
.rep-trail .acts .input { width: auto; min-width: 140px; }
.rep-dayrow { gap: 6px; flex-wrap: nowrap; }
.rep-legend { gap: 14px; flex: 1; } .rep-legend .legend { margin: 0; margin-inline-start: auto; }
.rep-kvgrid { gap: 6px 24px; }
.rep-sect { margin-bottom: 6px; }
.rep-visitmap { height: 260px; }
.modal .kv .flag, .modal .kv .st { margin-inline-start: 6px; }
@media (max-width: 760px) { .grid.rep-kvgrid { grid-template-columns: 1fr; } .rep-legend .legend { margin-inline-start: 0; } .rep-visitmap { height: 220px; } .rep-plan > .ch { flex-wrap: wrap; } .rep-plan > .ch .desc { display: none; } .rep-plan > .ch .acts { width: 100%; margin-inline-start: 0; } .rep-plan .rep-pills { flex: 1 1 100%; } }

/* ---- page: chat ---- */
.chat-threads { flex-direction: column; min-height: 0; }
.chat-threads > .cb { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-threads .threads { flex: 1; min-height: 0; }
@media (min-width: 761px) { .chat-threads { display: flex; } }
.chat-search { width: 180px; } .chat-search .input { padding-inline-start: 28px; }
.chat-sec { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .3px; padding: 12px 10px 4px; }
.chatpane .head:empty { display: none; }
.chatpane .head .who .sub { font-size: 12px; color: var(--muted); max-width: none; }
.chatpane .msgs .empty { margin: auto; }
@media (max-width: 760px) { .chat-search { width: 140px; } .chat-threads > .ch { flex-wrap: wrap; } }

/* ---- page: customer (the customer card modal) ---- */
.customer-title { gap: 8px; }
.customer-meta { gap: 6px 18px; margin-bottom: 12px; } .customer-meta svg { width: 14px; height: 14px; color: var(--faint); } .customer-meta > .row, .customer-meta > a.row { gap: 5px; flex-wrap: nowrap; color: inherit; }
.customer-map { height: 320px; } .customer-mapnote { margin-top: 6px; direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
.customer-stbar { gap: 8px 12px; align-items: flex-end; margin-bottom: 10px; } .customer-stbar label.f .input { width: auto; } .customer-stacts { gap: 6px; align-self: flex-end; }
.customer-opening { margin: 0 0 8px; gap: 6px; }
.modal .kpis { margin-bottom: 14px; }
@media (max-width: 760px) { .customer-map { height: 260px; } .customer-stbar label.f { flex: 1 1 40%; } .customer-stbar label.f .input { width: 100%; } .customer-stacts { width: 100%; } }

/* ---- page: login ---- */
.login .login-go { width: 100%; }
.login .login-hint { margin: 14px 0 0; }
.login .login-forgot { display: block; margin: 12px auto 0; background: none; border: 0; padding: 6px 10px; color: var(--brand-2, var(--brand)); font: inherit; font-size: 13px; cursor: pointer; border-radius: 8px; }
.login .login-forgot:hover { text-decoration: underline; } .login .login-forgot:disabled { opacity: .6; cursor: default; }
.login .login-note { margin: 4px 0 12px; text-align: start; }
.login .login-ver { margin-top: 14px; }

/* ---- page: debts / customers (nine-digit totals in six tiles) ---- */
.debts-sum .kpi .vrow b, .customers-sum .kpi .vrow b { font-size: 21px; letter-spacing: -.5px; }

/* ---- page: settings ---- */
.settings-sec { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 18px 0 6px; margin-top: 4px; border-top: 1px solid var(--line); }
.settings-sec svg { width: 15px; height: 15px; color: var(--faint); }
.cb > .settings-sec:first-child { border-top: 0; padding-top: 2px; margin-top: 0; }
.settings-sec + .setrow { border-top: 0; }
.settings-num { max-width: 160px; }
.setrow.settings-wide { grid-template-columns: 1fr; gap: 10px; }
.settings-sql { min-height: 96px; direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.settings-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings-rulehead { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.settings-racts { display: flex; gap: 2px; }
.settings-tiers { gap: 8px; }
.settings-tier { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.settings-days { width: 110px; } .settings-pct { width: 90px; }
.settings-diagtbl { max-height: 420px; border: 1px solid var(--line-soft); border-radius: var(--r); margin: 4px 0 8px; }
.settings-diagtbl .tbl th, .settings-diagtbl .tbl td { white-space: nowrap; direction: ltr; text-align: left; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.settings-diagtbl .tbl td { height: 32px; }
.settings-vtabs button { white-space: nowrap; }
@media (max-width: 760px) { .settings-tier { font-size: 12.5px; } .settings-num { max-width: none; } }

/* ---- page: users ---- */
.users-name { gap: 10px; flex-wrap: nowrap; padding-inline-start: calc(var(--d, 0) * 22px); }
.users-tree { margin-inline-end: -4px; }
.users-avatar { width: 28px; height: 28px; font-size: 11px; }
.users-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.users-acts { width: 1%; white-space: nowrap; text-align: end; }
select.input.users-rolesel { width: auto; min-width: 130px; }
.users-stack { gap: 8px; } .users-sub { margin-bottom: 4px; }
.users-perms { gap: 6px; }
.users-reqs { padding: 12px 14px; margin-bottom: 14px; border-color: var(--warn-soft); }
.users-reqs-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; } .users-reqs-h svg { width: 18px; height: 18px; color: var(--warn); }
.users-req { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.users-req-acts { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.users-newpin { font-size: 34px; font-weight: 700; letter-spacing: 6px; text-align: center; padding: 10px 0; }
.users-permq { position: sticky; top: 0; z-index: 2; margin-bottom: 4px; }
.users-perm[hidden], .users-permsec[hidden] { display: none; }
input.input.roles-q { margin: 10px 12px 0; width: calc(100% - 24px); max-width: 420px; display: block; }
.users-permsec { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.users-perm { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.users-permname { flex: 1; min-width: 200px; }
select.input.users-permsel { width: 130px; flex: 0 0 auto; }
.users-perm .pills[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.users-h3 { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.users-h3 svg { width: 15px; height: 15px; color: var(--faint); }
.users-pick { max-height: 320px; }
.users-pickrow { display: flex; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.users-pickrow small { margin-inline-start: auto; }
@media (max-width: 760px) { .users-name { padding-inline-start: 0; } .users-tree { display: none; } .users-acts { justify-content: flex-end; } }

/* ---- page: roles ---- */
.roles-card > .cf { margin: 0; }
.roles-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.roles-note { flex: 1 1 320px; }
select.input.roles-mobilesel { margin: 10px 12px; width: calc(100% - 24px); }
.roles-opts { justify-content: center; } .roles-opts .check { font-size: 12px; }
.roles-matrix th:first-child, .roles-matrix td:first-child { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--panel); }
.roles-matrix thead th:first-child { z-index: 3; background: var(--head); }
.roles-matrix tbody tr:hover td:first-child { background: var(--row-hover); }
.roles-matrix th.rolehead { min-width: 112px; } .roles-matrix td:first-child { min-width: 190px; }
@media (max-width: 760px) { .roles-matrix th:first-child, .roles-matrix td:first-child { position: static; min-width: 0; } .roles-card > .ch .desc { display: none; } .roles-scroll { padding: 0 10px; } }

/* ---- page: forms (visit form builder) ---- */
.formedit .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.formedit .formhits { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.formedit .formhits:empty { display: none; }
.formedit .formhits .row { display: flex; justify-content: space-between; width: 100%; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; font: inherit; text-align: start; cursor: pointer; color: var(--ink); }
.formedit .formhits .row:hover { background: var(--brand-soft); }
.formedit .qlist { display: grid; gap: 6px; }
.formedit .qrow { display: grid; grid-template-columns: 20px minmax(110px, 1.5fr) 88px 118px 96px auto auto; gap: 6px; min-width: 0; align-items: center; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--bg); }
.formedit .qrow .qic { color: var(--muted); display: grid; place-items: center; } .formedit .qrow .qic svg { width: 16px; height: 16px; }
.formedit .qrow .qacts { display: flex; gap: 2px; } .formedit .qrow .input, .formedit .qrow select { min-width: 0; width: 100%; } .formedit .qrow .check { white-space: nowrap; font-size: 12.5px; }
.formedit .qrow .span { grid-column: 2 / -1; }
.formedit .badge.soft { background: var(--brand-soft); color: var(--brand-ink); margin-inline-start: 4px; }
@media (max-width: 760px) { .formedit .qrow { grid-template-columns: 22px 1fr 1fr; } .formedit .qrow .qacts { grid-column: 2 / -1; justify-content: flex-end; } }

/* ---- page: shelf (photo gallery) ---- */
.photos.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photos.gallery .ph { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 0; overflow: hidden; cursor: zoom-in; text-align: start; display: block; }
.photos.gallery .ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 0; border-radius: 0; display: block; }
.photos.gallery .ph .cap { display: block; padding: 6px 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .photos.gallery .ph .cap small { display: block; color: var(--muted); font-weight: 400; }

/* page: deliveries */
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--r); background: var(--brand-soft); border: 1px solid var(--line); }
.bulkbar[hidden] { display: none; }
.bulkbar .b { margin-inline-end: auto; font-weight: 700; }
.tbl tr.bad-row td { background: var(--bad-soft); }
.photos.gallery .ph img.sig { object-fit: contain; background: #fff; }
.tbl td input[type=checkbox], .tbl th input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }

/* settings: company logo */
.settings-logobox { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.settings-logo { max-width: 220px; max-height: 110px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 6px; }
.settings-logo[hidden] { display: none; }

/* a line that mixes Arabic words and numbers reads right to left; only bare numbers are LTR runs (.num) */
.mixed { direction: rtl; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* language switch on the sign-in screen (i18n.js) */
.login-lang { text-align: center; margin-top: 14px; }
.langswitch { background: none; border: 1px solid var(--line, #d6dae3); color: inherit; border-radius: 999px; padding: 6px 16px; font: inherit; font-size: 13px; cursor: pointer; }

/* English (left to right): arrows that point "back" or "forward" turn round; Arabic names from Bayan keep their own
   direction inside left-to-right rows (otherwise their start is cut by the ellipsis) */
[dir="ltr"] svg[data-i="back"], [dir="ltr"] svg[data-i="arrow"], [dir="ltr"] svg[data-i="chevleft"] { transform: scaleX(-1); }
[dir="ltr"] .title, [dir="ltr"] .name, [dir="ltr"] .custhero h1, [dir="ltr"] .row .main b, [dir="ltr"] td a, [dir="ltr"] .who b { unicode-bidi: plaintext; }

/* =====================================================================
   Design C2 «Signal» (2026-11-09): a navy header carrying the sections (groups), the open section's pages and the
   page's own title, then light panels with 22px corners; Tajawal like the phone; amber only for the page's main action.
   ===================================================================== */
@font-face { font-family: Readex; font-weight: 400; font-display: swap; src: url(../../app/fonts/readex-ar-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Readex; font-weight: 500; font-display: swap; src: url(../../app/fonts/readex-ar-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Readex; font-weight: 700; font-display: swap; src: url(../../app/fonts/readex-ar-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Readex; font-weight: 400; font-display: swap; src: url(../../app/fonts/readex-la-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2116; }
@font-face { font-family: Readex; font-weight: 500; font-display: swap; src: url(../../app/fonts/readex-la-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2116; }
@font-face { font-family: Readex; font-weight: 700; font-display: swap; src: url(../../app/fonts/readex-la-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2116; }
:root { --bg: #F2F3F7; --navy: #0B2E63; --brand: #12408A; --brand-deep: #0B2E63; --brand-soft: #E8EEF8; --brand-ink: #12408A; --link: #12408A; --ink: #0F1B33; --muted: #5C6779;
  --act: #FFB020; --act-ink: #2B1A00; --onnavy: #B9C6DE; --r: 10px; --r-lg: 22px; --lip: 22px;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 6px 18px rgba(15, 27, 51, .05); }
:root[data-scheme="dark"] { --navy: #08214a; }
@media (prefers-color-scheme: dark) { :root[data-scheme="auto"] { --navy: #08214a; } }
body { font-family: Readex, Plex, Tahoma, Arial, sans-serif; font-size: 14px; }

/* shell: no side rail on a computer (it stays as the phone's drawer) */
@media (min-width: 761px) { .app { grid-template-columns: 1fr; } .app > .side, .sidescrim { display: none; } }
.navyhead { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.navyhead .topbar { position: static; height: 64px; padding: 0 32px; background: transparent; border: 0; gap: 14px; color: #fff; }
.tbrand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 15px; white-space: nowrap; flex-shrink: 0; }
.tbrand:hover { text-decoration: none; }
.tbrand .logo { width: 32px; height: 32px; }
.topgroups { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topgroups .tg { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 18px; color: #DCE4F2; font-size: 15px; white-space: nowrap; }
.topgroups .tg:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.topgroups .tg[aria-current="page"] { background: #fff; color: var(--navy); font-weight: 800; }
.topgroups .badge, .subnav .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--act); color: var(--act-ink); font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }
.navyhead .gsearch .input { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; border-radius: 20px; }
.navyhead .gsearch .input::placeholder { color: var(--onnavy); }
.navyhead .iconbtn, .navyhead .userbtn { color: #fff; }
.navyhead .iconbtn:hover, .navyhead .userbtn:hover { background: rgba(255, 255, 255, .1); }
.navyhead .userbtn .who small { color: var(--onnavy); }
.navyhead .userbtn .avatar { background: var(--brand-soft); color: var(--navy); }
.navyhead .gsearch .kbd { background: rgba(255, 255, 255, .12); color: var(--onnavy); border-color: transparent; }
.navyhead .st { background: rgba(255, 255, 255, .1); color: #fff; }
.navyhead .tag.brand { background: rgba(255, 255, 255, .12); color: #fff; }
.subnav { display: flex; gap: 4px; padding: 0 32px 10px; overflow-x: auto; scrollbar-width: none; }
.subnav[hidden] { display: none; }
.subnav .sn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; color: var(--onnavy); font-size: 14px; white-space: nowrap; }
.subnav .sn svg { width: 16px; height: 16px; opacity: .8; }
.subnav .sn:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.subnav .sn[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .14); font-weight: 700; }

/* the page's title stays on navy, the page itself starts as a light sheet with a rounded lip */
.content { padding-top: 0; }
.content > div > .pagehead:first-child { position: relative; margin: 0 -28px 22px; padding: 12px 28px calc(22px + var(--lip)); background: var(--navy); color: #fff;
  box-shadow: 0 0 0 100vmax var(--navy); clip-path: inset(0 -100vmax); }
.content > div > .pagehead:first-child::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: var(--lip); background: var(--bg); border-radius: 28px 28px 0 0; }
.content > div > .pagehead:first-child .crumbs { display: none; }
.content > div > .pagehead:first-child h1 { font-size: 32px; font-weight: 900; letter-spacing: -.5px; color: #fff; }
.content > div > .pagehead:first-child .sub { color: var(--onnavy); font-size: 15px; }
.content > div > .pagehead:first-child .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); color: #fff; box-shadow: none; }
.content > div > .pagehead:first-child .btn:hover { background: rgba(255, 255, 255, .14); }
.content > div > .pagehead:first-child .btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); font-weight: 800; }
.content > div > .pagehead:first-child .input, .content > div > .pagehead:first-child select { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .24); color: #fff; }
/* a dropdown's list is drawn by Windows from the options' own colours: they must not inherit the white text of a select
   on the navy header (white names on a white list) — the list follows the light or dark scheme instead */
select option, select optgroup { color: var(--ink); background-color: var(--panel); }

/* panels, numbers, buttons */
.card, .panel { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 20px; }
.card > .ch, .card > h2, .card > h3, .panel > h2, .panel > h3 { margin: -16px -20px 14px; padding: 14px 20px 10px; border-bottom: 1px solid var(--line-soft); font-size: 17px; font-weight: 800; }
.card > .ch h2 { font-size: 17px; font-weight: 800; }
.card .cf { margin: 14px -20px -16px; padding: 12px 20px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.flush > .ch { margin: 0; }
.kpi, .summary .sum { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 18px 14px; }
.kpi b, .summary .sum b { font-size: 30px; font-weight: 900; letter-spacing: -.5px; }
.kpi small, .summary .sum small { font-size: 13.5px; }
.kpi.on, .summary .sum.on { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.btn { border-radius: 999px; height: 36px; padding: 0 16px; font-weight: 600; }
.btn.sm { border-radius: 999px; height: 30px; }
.btn.lg { height: 46px; padding: 0 24px; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--navy); border-color: var(--navy); }
.input, select.input { border-radius: 12px; }
table th { font-weight: 600; }

@media (max-width: 1100px) { .navyhead .topbar, .subnav { padding-inline: 16px; } .content > div > .pagehead:first-child { margin-inline: -16px; padding-inline: 16px; } .tbrand span { display: none; } }
@media (max-width: 760px) {
  .topgroups, .subnav, .tbrand { display: none; }
  .navyhead .topbar { height: 56px; padding: 0 8px; }
  .content > div > .pagehead:first-child h1 { font-size: 24px; }
}
.navyhead .gsearch { width: min(280px, 100%); }
.navyhead .gsearch .input:focus { background: #fff; color: var(--ink); }
.navyhead .gsearch > svg { color: var(--onnavy); }

.topgroups { flex-shrink: 0; }
.navyhead .topbar > .spacer { flex: 1 1 0; min-width: 0; }
.navyhead .gsearch { flex: 0 1 260px; min-width: 140px; width: auto; }
@media (max-width: 1500px) { .navyhead .co, .navyhead .topbar > .tag, .navyhead .userbtn .who, .navyhead .userbtn > svg { display: none; } }

/* documents waiting for a decision: no side stripe; approving is the page's action (amber) */
.doccard { border: 0; border-inline-start: 0; box-shadow: var(--shadow); padding: 18px 20px; }
.doccard .btn.ok { background: var(--act); border-color: var(--act); color: var(--act-ink); font-weight: 800; }

/* =====================================================================
   Design D «Route» (2026-11-10): the phone's world on the computer — the header is the logo's blue-to-navy with the
   road drawn faintly across it, the page title sits in it, work surfaces are white with soft blue-tinted depth,
   icons on glossy tiles, amber for the page's main action. Readex Pro like the phone.
   ===================================================================== */
:root { --bg: #EEF2F8; --navy: #0B2E63; --brand: #034EA1; --brand-2: #2F7BE5; --brand-deep: #0B2E63; --brand-soft: #E6EEFA; --brand-ink: #034EA1; --link: #034EA1; --ink: #0B1B3A; --muted: #56637D;
  --line: #E3E9F2; --line-soft: #EDF1F7; --head: #F6F8FC; --row-hover: #F3F7FD;
  --act: #FFB020; --act-ink: #2B1A00; --onnavy: #C9D7F0; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(11, 46, 99, .06), 0 4px 14px rgba(11, 46, 99, .06); --shadow-md: 0 2px 6px rgba(11, 46, 99, .07), 0 14px 32px rgba(11, 46, 99, .13);
  --grad-hero: radial-gradient(70% 140% at 90% -30%, rgba(73, 145, 245, .7) 0%, rgba(73, 145, 245, 0) 55%), linear-gradient(160deg, #0858B8 0%, #034EA1 30%, #0B2E63 80%, #082552 100%);
  --roadmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -60 400 300'%3E%3Cdefs%3E%3ClinearGradient id='f'%3E%3Cstop offset='0' stop-color='%23fff' stop-opacity='0'/%3E%3Cstop offset='.2' stop-color='%23fff'/%3E%3Cstop offset='.8' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/linearGradient%3E%3Cmask id='m'%3E%3Crect x='0' y='-60' width='400' height='300' fill='url(%23f)'/%3E%3C/mask%3E%3C/defs%3E%3Cg mask='url(%23m)'%3E%3Cpath d='M-20 190 C 90 190 120 70 220 70 S 330 20 420 30' fill='none' stroke='%23fff' stroke-opacity='.08' stroke-width='34' stroke-linecap='round'/%3E%3Cpath d='M-20 190 C 90 190 120 70 220 70 S 330 20 420 30' fill='none' stroke='%23fff' stroke-opacity='.24' stroke-width='2.5' stroke-dasharray='10 11' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E"); }
:root[data-scheme="dark"] { --bg: #070D1C; --panel: #111A2E; --line: #212C45; --line-soft: #1A2440; --head: #141E34; --row-hover: #16223A; --ink: #E8EDF8; --muted: #9DAAC4; --brand-soft: rgba(47, 123, 229, .18); --brand-ink: #7FB0F5; --link: #7FB0F5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .35); }
@media (prefers-color-scheme: dark) { :root[data-scheme="auto"] { --bg: #070D1C; --panel: #111A2E; --line: #212C45; --line-soft: #1A2440; --head: #141E34; --row-hover: #16223A; --ink: #E8EDF8; --muted: #9DAAC4; --brand-soft: rgba(47, 123, 229, .18); --brand-ink: #7FB0F5; --link: #7FB0F5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .35); } }
::selection { background: rgba(47, 123, 229, .25); }

/* the header and the page's title: one hero band */
.navyhead { background: radial-gradient(60% 260% at 85% -80%, rgba(73, 145, 245, .55), rgba(73, 145, 245, 0) 60%), linear-gradient(180deg, #0855AE, #0A4A9C); }
/* the title band runs the full width of the window, whatever the page's own width: drawn by ::before */
.content > div > .pagehead:first-child { background: none; box-shadow: none; clip-path: none; isolation: isolate; padding-bottom: calc(26px + var(--lip)); }
.content > div > .pagehead:first-child::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: calc(50% - 50vw); right: calc(50% - 50vw);
  background: radial-gradient(50% 120% at 10% 0%, rgba(73, 145, 245, .22), rgba(73, 145, 245, 0) 70%), linear-gradient(180deg, #0A4A9C 0%, #0B3A7E 55%, #0B2E63 100%); }
.content > div > .pagehead:first-child::after { left: calc(50% - 50vw); right: calc(50% - 50vw); border-radius: 32px 32px 0 0; bottom: -1px; }
.content > div > .pagehead:first-child h1 { font-weight: 700; font-size: 32px; letter-spacing: -.02em; }
.content > div > .pagehead:first-child .btn.primary { background: linear-gradient(170deg, #FFC54D, #FFB020 45%, #F09A0A); border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 18px -8px rgba(229, 138, 0, .8); }
.tbrand { font-weight: 700; }
.tbrand .logo { width: 34px; height: 34px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .3)); }
.topgroups .tg { font-weight: 500; }
.topgroups .tg[aria-current="page"] { font-weight: 700; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .4); }
.subnav .sn[aria-current="page"] { font-weight: 700; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

/* surfaces */
.card, .panel, .kpi, .summary .sum { box-shadow: var(--shadow); }
.card > .ch, .card > h2, .card > h3, .panel > h2, .panel > h3, .card > .ch h2 { font-weight: 700; }
.kpi b, .summary .sum b { font-weight: 700; letter-spacing: -.02em; }
.kpi small svg, .summary .sum small svg { box-sizing: content-box; width: 15px; height: 15px; padding: 6px; border-radius: 9px; color: #fff; background: linear-gradient(150deg, #3B8BF0, #034EA1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.kpi.on, .summary .sum.on { background: linear-gradient(160deg, #F2F7FF, #E6EEFA); box-shadow: inset 0 0 0 2px var(--brand-2), var(--shadow); }
.rows .ri .ic, .notif .ni .ic { border-radius: 11px; }
.btn.primary { background: linear-gradient(160deg, #2F7BE5, #034EA1 60%, #0A3F87); border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 14px -8px rgba(3, 78, 161, .8); color: #fff; }
.btn.primary:hover { background: linear-gradient(160deg, #3B8BF0, #0858B8 60%, #0B2E63); }
.doccard .btn.ok { background: linear-gradient(170deg, #FFC54D, #FFB020 45%, #F09A0A); border: 0; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 16px -8px rgba(229, 138, 0, .8); }
table thead th { background: var(--head); color: var(--muted); font-weight: 500; }

/* ---------- roles: the roles on the side, the chosen role's permissions beside them ---------- */
.rl { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.rl-list { position: sticky; top: 120px; display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); max-height: calc(100vh - 140px); overflow-y: auto; }
.rl-sec { padding: 10px 10px 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.rl-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 16px; background: none; cursor: pointer; text-align: start; color: var(--ink); font: inherit; }
.rl-item:hover { background: var(--row-hover); }
.rl-item.on { background: linear-gradient(160deg, #F2F7FF, #E6EEFA); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand-2) 45%, transparent); }
:root[data-scheme="dark"] .rl-item.on { background: var(--brand-soft); }
.rl-ic { width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #fff; --t1: #3B8BF0; --t2: #034EA1;
  background: linear-gradient(150deg, var(--t1), var(--t2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 6px 14px -5px color-mix(in srgb, var(--t2) 65%, transparent); }
.rl-ic svg { width: 20px; height: 20px; stroke-width: 2; }
.rl-ic.big { width: 56px; height: 56px; border-radius: 18px; } .rl-ic.big svg { width: 28px; height: 28px; }
.t-teal { --t1: #2CC6B0; --t2: #0A8577; } .t-amber { --t1: #FFC54D; --t2: #E58A00; } .t-violet { --t1: #8E7CFF; --t2: #5B3FD9; } .t-coral { --t1: #FF8A73; --t2: #D9452E; } .t-green { --t1: #3DD68C; --t2: #12945A; } .t-slate { --t1: #7D8CA8; --t2: #45536F; }
.rl-t { flex: 1; min-width: 0; display: grid; line-height: 1.35; }
.rl-t b { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.rl-t small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--act); box-shadow: 0 0 0 3px rgba(255, 176, 32, .25); }
.rl-meta { display: grid; justify-items: end; line-height: 1.2; flex: none; }
.rl-meta .num { font-weight: 700; font-size: 15px; }
.rl-meta small { font-size: 11px; color: var(--muted); }
.rl-meta em { margin-top: 3px; font-style: normal; font-size: 11px; font-weight: 500; color: #8A5300; background: #FFF3DA; border-radius: 6px; padding: 0 6px; }
.rl-new { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; min-height: 46px; border: 1.5px dashed color-mix(in srgb, var(--brand-2) 45%, transparent); border-radius: 16px; background: none; color: var(--brand-ink); font: inherit; font-weight: 500; cursor: pointer; }
.rl-new:hover { background: var(--row-hover); }
.rl-role { display: grid; gap: 14px; min-width: 0; }
.rl-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); }
.rl-ht { flex: 1; min-width: 0; }
.rl-ht h2 { font-size: 22px; font-weight: 700; }
.rl-ht .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.rl-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rl-acts .btn.danger { color: var(--bad); }
.rl-note { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.rl-tools { position: sticky; top: 112px; z-index: 5; padding: 6px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.rl-q { height: 46px; border-radius: 16px; border: 0; padding: 0 16px; background: var(--panel); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); width: 100%; font-size: 14px; }
.rl-q:focus { outline: 0; box-shadow: var(--shadow), inset 0 0 0 2px var(--brand-2); }
.rl-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.rl-where { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.rl-where svg { color: var(--brand-ink); }
.rl-card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 6px 0; }
.rl-ch { display: flex; align-items: center; gap: 10px; padding: 10px 18px 8px; }
.rl-ch b { flex: 1; font-weight: 700; font-size: 15px; }
.rl-ch small { color: var(--muted); font-size: 12px; background: var(--head); border-radius: 8px; padding: 1px 8px; }
.rl-cic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.rl-cic svg { width: 17px; height: 17px; }
.rl-row { display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-top: 1px solid var(--line-soft); }
.rl-row.list { flex-direction: column; align-items: stretch; gap: 8px; }
.rl-name { flex: 1; min-width: 0; display: grid; line-height: 1.45; font-size: 14px; }
.rl-name small { font-size: 11.5px; color: #8A5300; }
.rl-row.over { background: linear-gradient(90deg, transparent, rgba(255, 176, 32, .07)); }
.rl-switch { position: relative; flex: none; display: inline-flex; cursor: pointer; }
.rl-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rl-switch span { width: 46px; height: 28px; border-radius: 14px; background: #D3DBE8; position: relative; transition: background-color .2s; }
.rl-switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(11, 27, 58, .25); transition: inset-inline-start .2s cubic-bezier(.16, 1, .3, 1); }
.rl-switch input:checked + span { background: linear-gradient(160deg, #2F7BE5, #034EA1); }
.rl-switch input:checked + span::after { inset-inline-start: 21px; }
.rl-switch input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.rl-switch input:disabled + span { opacity: .5; }
.rl-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--head); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.rl-chip svg { width: 14px; height: 14px; stroke-width: 2.6; }
.rl-chip.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand-2) 55%, transparent); }
.rl-chip:disabled { opacity: .6; cursor: default; }
.rl-bar { position: sticky; bottom: 18px; z-index: 20; display: flex; align-items: center; gap: 10px; width: max-content; max-width: 100%; margin: 18px auto 0; padding: 10px 10px 10px 18px;
  background: #0B2E63; color: #fff; border-radius: 18px; box-shadow: 0 18px 40px -10px rgba(6, 20, 50, .55); transform: translateY(140%); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.16, 1, .3, 1), opacity .2s; }
.rl-bar.show { transform: none; opacity: 1; pointer-events: auto; }
.rl-bt { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-inline-end: 8px; }
.rl-bar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .25); background: transparent; }
.rl-bar .btn.primary { background: linear-gradient(170deg, #FFC54D, #FFB020 45%, #F09A0A); color: var(--act-ink); font-weight: 700; }
@media (max-width: 1100px) { .rl { grid-template-columns: 1fr; } .rl-list { position: static; max-height: none; } .rl-secs { grid-template-columns: 1fr; } }

/* sign-in: the hero with the road, the form on a white card */
.login { background: var(--roadmark) left -300px top 40% / 2200px auto no-repeat, radial-gradient(60% 80% at 85% 0%, rgba(73, 145, 245, .55), rgba(73, 145, 245, 0) 60%), linear-gradient(165deg, #0858B8, #034EA1 30%, #0B2E63 80%, #082552); }
.login .box { border: 0; border-radius: 28px; padding: 32px 32px 26px; box-shadow: 0 30px 80px -20px rgba(0, 10, 40, .6); }
.login .input { height: 46px; border-radius: 14px; background: var(--bg); border-color: transparent; }
.login .input:focus { background: var(--panel); border-color: var(--brand-2); }
.login .btn.primary { height: 48px; border-radius: 14px; font-size: 15px; }
.login h1 { font-size: 20px; font-weight: 700; }
.photos.customer-photos { margin: 10px 0 4px; }

/* a user's «صلاحيات خاصة»: the roles page's sections inside the user form */
.users-perms .rl-tools.users-permtools { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.users-perms .rl-tools .rl-q { flex: 1; min-width: 220px; }
.users-perms .rl-secs { grid-template-columns: 1fr; }
.users-perms .rl-name small { color: var(--muted); }
.users-perms .rl-row.over .rl-name small { color: #8A5300; }
.rl-chip.ghostchip { background: transparent; }
.seg3 { flex: none; display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--head); box-shadow: inset 0 0 0 1px var(--line); }
.seg3 button { min-height: 30px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; transition: background-color .15s, color .15s; }
.seg3 button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(11, 27, 58, .14); }
.seg3 button.on.yes { background: linear-gradient(160deg, #2F7BE5, #034EA1); color: #fff; }
.seg3 button.on.no { background: color-mix(in srgb, var(--bad, #C23A2B) 14%, var(--panel)); color: var(--bad, #C23A2B); }
.seg3 button:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
@media (max-width: 640px) { .users-perms .rl-row { flex-wrap: wrap; } }
/* «؟» next to a permission: what it does */
.rl-nt { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rl-qm { flex: none; width: 26px; height: 26px; margin: -4px 0; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer; padding: 0; }
.rl-qm svg { width: 17px; height: 17px; }
.rl-qm:hover, .rl-qm[aria-expanded="true"] { color: var(--brand-ink); background: var(--brand-soft); }
.rl-qm:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.rl-help { margin: 6px 0 2px; padding: 8px 12px; border-radius: 10px; background: var(--head); color: var(--ink); font-size: 12.5px; line-height: 1.7; box-shadow: inset 0 0 0 1px var(--line); }
.rl-help[hidden] { display: none; }
.rule .types[hidden] { display: none; }

/* licence: the strip before the end, the stop screen after it */
.licbar { display: flex; gap: 10px; align-items: center; padding: 10px 18px; font-size: 13.5px; font-weight: 600; border-bottom: 1px solid var(--line); }
.licbar[hidden] { display: none; }   /* no warning: no empty strip between the top bar and the page */
.licbar.warn { background: var(--warn-soft); color: var(--warn); } .licbar.bad { background: var(--bad-soft); color: var(--bad); }
.licbar svg { width: 18px; height: 18px; flex: none; }
.licblock { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
.licblock .box { max-width: 460px; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-md); text-align: center; }
.licblock .box > svg { width: 48px; height: 48px; }
.licblock h1 { font-size: 20px; margin: 14px 0 8px; } .licblock p { margin: 0 0 10px; line-height: 1.7; }
.licblock .row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.lic-panel .meter { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; margin-top: 6px; }
.lic-panel .meter i { display: block; height: 100%; background: var(--brand); }
.lic-panel .meter i.full { background: var(--bad); }
