/* Web portal: tokens, the shell and the shared components. Pages add their own file and use these classes:
   layout   .page (set by the router) .cols (main + side) .side .sec .sec-line .panel .stack-sm .stack .row .grow .hair
   text     .muted (grey) .faint (lighter) .sm (12.5 px) .num (right, tabular) .strong .nowrap .ellipsis .warn-text .bad-text .ok-text
   maps     .mapbox (a map container: 360 px high, round corners) .mapbox-sm (220 px)
   tones    .t-ok .t-info .t-warn .t-leave .t-bad .t-slate .t-off .t-line .t-brand .t-none set --tc (the colour), --tt (text
            in that colour) and --ts (its soft background) for the components below: .st (status chip) .flag .fig (tile) .dot
   shell    a dark side menu (.sn, 232 px) left of the light page (#main); below 900 px a dark top bar (.tbar) and the menu
            slides in. Colour: tinted tiles, chips and initials; calm section headers; no gradients, no heavy shadows. */
:root {
  --bg: #FFFFFF; --bg-soft: #F6F8FB; --bg-hover: #F1F4F8; --line: #E9ECF1; --line-2: #DCE1E8;
  --text: #0F172A; --text-2: #475569; --text-3: #94A3B8;
  --brand: #2952CC; --brand-2: #2246B0; --brand-soft: #EEF2FD;
  --ok: #16A34A; --info: #2563EB; --warn: #D97706; --leave: #7C3AED; --bad: #DC2626; --off: #CBD5E1; --hol: #E3E7ED; --slate: #64748B;
  --ok-t: #15803D; --info-t: #1D4ED8; --warn-t: #B45309; --leave-t: #6D28D9; --bad-t: #C81E1E; --slate-t: #334155;
  --ok-soft: #EAF6EE; --info-soft: #EBF1FE; --warn-soft: #FEF4E6; --leave-soft: #F3EEFD; --bad-soft: #FDECEC; --off-soft: #F1F3F6; --slate-soft: #EEF1F5;
  /* the side menu */
  --nav: #0F172A; --nav-2: #1E293B; --nav-text: #CBD5E1; --nav-dim: #8A97AB; --nav-line: rgba(255, 255, 255, .08); --nav-brand: #3E6AE8;
  --side-w: 232px;
  --radius: 10px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html.dr-open body { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }

/* tones: every coloured component reads --tc (and --tt / --ts for text and soft backgrounds) */
.t-ok { --tc: var(--ok); --tt: var(--ok-t); --ts: var(--ok-soft); } .t-info { --tc: var(--info); --tt: var(--info-t); --ts: var(--info-soft); }
.t-warn { --tc: var(--warn); --tt: var(--warn-t); --ts: var(--warn-soft); } .t-leave { --tc: var(--leave); --tt: var(--leave-t); --ts: var(--leave-soft); }
.t-bad { --tc: var(--bad); --tt: var(--bad-t); --ts: var(--bad-soft); } .t-slate { --tc: var(--slate); --tt: var(--slate-t); --ts: var(--slate-soft); }
.t-off { --tc: var(--off); --tp: 38%; --tt: var(--text-2); --ts: var(--off-soft); } .t-line { --tc: var(--hol); --tp: 55%; --tt: var(--text-2); --ts: #F3F5F8; }
.t-brand { --tc: var(--brand); --tt: var(--brand); --ts: var(--brand-soft); }
.t-none { --tc: transparent; --tt: var(--text-2); --ts: transparent; }

/* utilities */
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .sm { font-size: 12.5px; } .strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; } .nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.warn-text { color: var(--warn-t); } .bad-text { color: var(--bad); } .ok-text { color: var(--ok-t); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; } .stack-sm > * + * { margin-top: 8px; }
.hair { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- shell: the dark side menu and the light page ---------- */
.brand-mark { display: inline-flex; color: var(--brand); width: 24px; height: 24px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.shell { min-height: 100vh; }
.sn { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: var(--side-w); display: flex; flex-direction: column; background: var(--nav); color: var(--nav-text); }
.sn-top { display: flex; align-items: center; gap: 6px; flex: none; height: 68px; padding: 0 10px 0 18px; }
.sn-brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; color: #fff; }
.sn-brand:hover { text-decoration: none; }
.sn-brand .brand-mark { width: 30px; height: 30px; color: var(--nav-brand); }
.sn-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sn-name b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.sn-name small { margin-top: 1px; font-size: 11.5px; color: var(--nav-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-x { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--nav-text); cursor: pointer; }
.sn-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sn-nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; scrollbar-width: thin; }
.nav-a { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--nav-text); font-weight: 500; font-size: 14px; white-space: nowrap; transition: background .12s, color .12s; }
.nav-a .ic { width: 19px; height: 19px; color: var(--nav-dim); transition: color .12s; }
.nav-a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-a:hover .ic { color: #CBD5E1; }
.nav-a.on { background: rgba(62, 106, 232, .24); color: #fff; }
.nav-a.on .ic { color: #93AEFF; }
.nav-a.on::before { content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #6B8DF2; }
.nav-a:focus-visible { outline-color: #93AEFF; outline-offset: -2px; }
.nav-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-n { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--nav-brand); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.nav-a.on .nav-n { background: #fff; color: var(--brand); }
.sn .bsearch { position: relative; display: flex; align-items: center; gap: 8px; flex: none; height: 36px; margin: 2px 14px 10px; padding: 0 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); transition: background .12s, border-color .12s, box-shadow .12s; }
.sn .bsearch.focus { background: rgba(255, 255, 255, .1); border-color: rgba(147, 174, 255, .55); box-shadow: 0 0 0 3px rgba(62, 106, 232, .25); }
.bs-ic { display: inline-flex; color: var(--nav-dim); }
.bs-ic .ic { width: 16px; height: 16px; }
.bsearch input { flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: 13.5px; }
.bsearch input::-webkit-search-cancel-button { display: none; }
.bsearch input::placeholder { color: var(--nav-dim); }
.bsearch kbd { padding: 0 5px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 4px; background: transparent; color: var(--nav-dim); font: 11px/16px var(--font); }
.bsearch.focus kbd { display: none; }
.sn-foot { flex: none; padding: 12px 14px 14px; border-top: 1px solid var(--nav-line); }
.sn-me { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 2px 12px; }
.sn-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sn-who b { color: #fff; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-who small { color: var(--nav-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-acts { display: flex; gap: 6px; }
.sn-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 8px; background: transparent; color: var(--nav-text); font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.sn-btn .ic { width: 15px; height: 15px; }
.sn-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sn-btn:focus-visible { outline-color: #93AEFF; }
.sn-ov, .tbar { display: none; }
#main { margin-left: var(--side-w); min-height: 100vh; background: var(--bg); }
/* below 900 px: a dark top bar; the menu button slides the side menu in over the page */
@media (max-width: 899px) {
  #main { margin-left: 0; min-height: calc(100vh - 56px); }
  .tbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 8px; background: var(--nav); color: #fff; }
  .tbar-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: #E2E8F0; cursor: pointer; }
  .tbar-btn .ic { width: 21px; height: 21px; }
  .tbar-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .tbar-btn:focus-visible { outline-color: #93AEFF; }
  .tbar-n { position: absolute; top: 2px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--nav-brand); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--nav); }
  .tbar-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 10px; color: #fff; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
  .tbar-brand:hover { text-decoration: none; }
  .tbar-brand .brand-mark { width: 26px; height: 26px; color: var(--nav-brand); }
  .tbar-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sn { z-index: 90; width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s; }
  .sn-open .sn { transform: none; visibility: visible; transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .sn-x { display: inline-flex; }
  .sn-ov { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(15, 23, 42, .42); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sn-open .sn-ov { opacity: 1; pointer-events: auto; }
  html.sn-lock body { overflow: hidden; }
}

/* ---------- page ---------- */
.page { max-width: 1228px; margin: 0 auto; padding: 32px 28px 96px; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.ph h1 { font-size: 23px; line-height: 1.3; letter-spacing: -0.02em; }
.ph-sub { margin-top: 4px; color: var(--text-2); font-size: 13.5px; }
.ph-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec { margin-top: 40px; }
.sec:first-child, .ph + .sec { margin-top: 0; }
.sec-line { border-top: 1px solid var(--line); padding-top: 28px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-h h2 { font-size: 15px; }
.sec-meta { margin-left: 8px; color: var(--text-3); font-weight: 400; }
.sec-n { display: inline-block; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--slate-soft); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; vertical-align: 1px; }
.sec-mark { display: inline-block; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%; background: var(--tc); vertical-align: 2px; }
.sec-r { display: flex; align-items: center; gap: 8px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 44px; align-items: start; }
.side > * + * { margin-top: 16px; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 16px; }
.panel-h { display: flex; align-items: center; gap: 10px; min-height: 28px; margin-bottom: 8px; font-weight: 600; font-size: 13.5px; }
.panel-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--ts); color: var(--tt); }
.panel-ic .ic { width: 16px; height: 16px; }
.panel-h a { display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.panel-h a .ic { width: 15px; height: 15px; color: var(--text-3); }
.panel-h a:hover { color: var(--brand); text-decoration: none; }
.panel-m { margin-left: auto; font-weight: 400; }
.panel .ql-row:hover { background: var(--bg-soft); }
.panel .ql-t, .panel .ql-s { white-space: normal; }
/* two columns only while the main column keeps a comfortable width beside the side menu */
@media (max-width: 1179px) { .cols { grid-template-columns: minmax(0, 1fr); gap: 40px; } }
@media (max-width: 639px) { .page { padding: 22px 16px 80px; } .ph { margin-bottom: 24px; } .ph h1 { font-size: 20px; } .sec { margin-top: 32px; } }

/* ---------- figures ---------- */
/* figure tiles: the tone tints the tile and colours the number; .fig-plain is a neutral tile */
.figs { display: flex; flex-wrap: wrap; gap: 12px; }
.fig { position: relative; flex: 1 1 150px; max-width: 264px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 13px 16px 14px; border: 1px solid color-mix(in srgb, var(--tc) 22%, #fff); border-radius: 12px; background: var(--ts); text-align: left; color: inherit; font: inherit; }
.fig-plain { --tc: #CBD5E1; --tt: var(--text); --ts: var(--bg-soft); border-color: var(--line); }
.fig-btn { cursor: pointer; transition: border-color .12s, background-color .12s; }
.fig-btn:hover { border-color: color-mix(in srgb, var(--tc) 55%, #fff); }
.fig-btn:hover .fig-l { color: var(--text); }
.fig-l { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-l::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); }
.fig-plain .fig-l::before { display: none; }
.fig-v { margin-top: 6px; font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; color: var(--tt); white-space: nowrap; }
.fig-zero .fig-v { color: color-mix(in srgb, var(--tt) 45%, #fff); }
.fig-plain.fig-zero .fig-v { color: var(--text-3); }
.fig-s { margin-top: 3px; max-width: 100%; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figs-sm { gap: 10px; }
.figs-sm .fig { flex-basis: 108px; padding: 10px 12px 11px; border-radius: 10px; }
.figs-sm .fig-v { margin-top: 4px; font-size: 21px; }
@media (max-width: 639px) { .figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .fig { max-width: none; padding: 11px 13px 12px; } .fig-v { font-size: 26px; } .figs-sm .fig-v { font-size: 20px; } }

/* stacked bar */
.sbar { margin-top: 22px; }
.sbar-t { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; }
.sbar-t span { background: var(--tc); min-width: 3px; }
.sbar-l { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.sbar-l span { display: inline-flex; align-items: center; gap: 7px; }
.sbar-l b { font-weight: 600; color: var(--text); }

/* status: a tinted chip (dot + words), the small flag, and initials tinted by person */
.st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 11px; background: var(--ts, var(--off-soft)); color: var(--tt, var(--text-2)); font-size: 12.5px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
.st .dot { width: 6px; height: 6px; }
.st.t-off .dot { background: #94A3B8; } .st.t-line .dot { background: #B4BDCA; }
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--off)); }
.dot.t-line { background: #D5DAE2; }
.dot.t-none { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.flag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1; color: var(--tt, var(--warn-t)); background: var(--ts, var(--warn-soft)); white-space: nowrap; vertical-align: middle; }
.av { --s: 32px; display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--s); height: var(--s); border-radius: 50%; background: var(--av-b, #EEF1F5); color: var(--av-f, var(--text-2)); font-size: calc(var(--s) * .36); font-weight: 600; letter-spacing: .02em; }
.av-0 { --av-b: #E3EAFD; --av-f: #2346B0; } .av-1 { --av-b: #DDF3E5; --av-f: #17703A; } .av-2 { --av-b: #EDE6FD; --av-f: #5B2DB8; }
.av-3 { --av-b: #FCEFD8; --av-f: #8F5406; } .av-4 { --av-b: #FCE5EB; --av-f: #A8244A; } .av-5 { --av-b: #D8F1EF; --av-f: #0F6B64; }
.av-6 { --av-b: #E4E6FB; --av-f: #3F37B8; } .av-7 { --av-b: #FDE7DA; --av-f: #A84A12; } .av-8 { --av-b: #DCEFF8; --av-f: #0E6384; }
.av-9 { --av-b: #E8EBF0; --av-f: #3F4C61; }

/* month strip */
.strip { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 10px; gap: 3px; vertical-align: middle; }
.strip i { width: 10px; height: 10px; border-radius: 2px; background: var(--tc); }
.strip i.t-line { background: var(--hol); }
.strip i.t-none { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.strip i.today { outline: 1.5px solid var(--text); outline-offset: 1px; }

/* month calendar */
.cal { max-width: 640px; }
.cal-h { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-t { min-width: 132px; text-align: center; font-weight: 600; font-size: 14.5px; }
.cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-w { padding: 0 2px 2px; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.cal-d { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; height: 66px; padding: 8px 9px; border: 0; border-radius: 8px; text-align: left; cursor: pointer; overflow: hidden;
  background: color-mix(in srgb, var(--tc) var(--tp, 13%), #fff); transition: box-shadow .1s; }
.cal-d.t-none { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.cal-d:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.cal-d:disabled { cursor: default; }
.cal-d.today { box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-d.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-d.sel::after { content: ''; position: absolute; top: 7px; right: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat; }
.cal-n { font-size: 13px; font-weight: 600; color: var(--text); }
.cal-s { max-width: 100%; font-size: 11.5px; color: color-mix(in srgb, var(--tc) 70%, #0F172A); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-d.t-off .cal-s, .cal-d.t-line .cal-s { color: var(--text-2); }
.cal-note { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); }
.cal-g.selecting .cal-d { cursor: copy; }
@media (max-width: 639px) { .cal-g { gap: 4px; } .cal-d { height: 46px; padding: 6px 7px; } .cal-s { display: none; } .cal-d::before { content: ''; position: absolute; left: 7px; bottom: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--tc); } .cal-d.t-none::before { display: none; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font-size: 13.5px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { text-decoration: none; }
.btn .ic { width: 16px; height: 16px; }
.btn-secondary { background: var(--bg); border-color: var(--line-2); color: var(--text); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: var(--bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, #fff); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 6%, #fff); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-link { height: auto; padding: 0; border: 0; background: none; color: var(--brand); }
.btn-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-block { width: 100%; height: 40px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; height: 42px; padding: 0 1px; border: 0; background: none; color: var(--text-2); font-weight: 500; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--brand); }
.tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tab-n { min-width: 20px; height: 18px; margin-left: 7px; padding: 0 6px; border-radius: 9px; background: var(--slate-soft); color: var(--text-2); font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center; }
.tab.on .tab-n { background: var(--brand-soft); color: var(--brand); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--bg-hover); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button .ic { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--bg); color: var(--brand); box-shadow: 0 0 0 1px var(--line-2); }
.sel { position: relative; display: inline-flex; align-items: center; }
.sel select { appearance: none; -webkit-appearance: none; width: 100%; height: 34px; padding: 0 32px 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); font-size: 13.5px; cursor: pointer; }
.sel select:hover { background: var(--bg-soft); }
.sel > .ic { position: absolute; right: 9px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.sel-block { display: flex; width: 100%; }
.sel-block select { height: 38px; }
.sbox { display: inline-flex; align-items: center; gap: 8px; width: 260px; max-width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text-3); }
.sbox .ic { width: 16px; height: 16px; }
.sbox input { flex: 1; min-width: 0; height: 32px; border: 0; outline: 0; padding: 0; background: transparent; color: var(--text); font-size: 13.5px; }
.sbox input::placeholder { color: var(--text-3); }
.sbox:focus-within, .inp:focus, .sel select:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41, 82, 204, .12); outline: 0; }
.fld { margin-bottom: 16px; }
.fld > label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.inp { display: block; width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); font-size: 14px; }
textarea.inp { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.inp.bad { border-color: var(--bad); }
.fld-err { margin-top: 5px; color: var(--bad); font-size: 12.5px; }
@media (max-width: 639px) { .sbox { width: 100%; } .ph-r { width: 100%; } .ph-r .sbox { flex: 1; } }

/* ---------- quiet lists ---------- */
.ql { list-style: none; margin: 0; padding: 0; }
.ql-row { display: flex; align-items: center; gap: 12px; width: calc(100% + 20px); min-height: 46px; margin: 0 -10px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--text); text-decoration: none; }
button.ql-row, a.ql-row { cursor: pointer; }
button.ql-row:hover, a.ql-row:hover { background: var(--bg-soft); text-decoration: none; }
.ql-dense .ql-row { min-height: 36px; padding: 4px 10px; }
.ql-lead { display: inline-flex; flex: none; }
.ql-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ql-t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-s { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-note { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-m { flex: none; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.ql-r { flex: none; font-size: 13.5px; white-space: nowrap; text-align: right; }
.qg-g + .qg-g { margin-top: 22px; }
.qg-h { margin-bottom: 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.qg-m { margin-left: 6px; font-weight: 400; color: var(--text-3); }
.qg-m::before { content: '· '; }

/* ---------- tables ---------- */
/* the header is a soft rounded band; rows are separated by hairlines */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tb { width: 100%; border-collapse: separate; border-spacing: 0; }
.tb th { height: 36px; padding: 0 10px; background: var(--bg-soft); text-align: left; white-space: nowrap; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #64748B; }
.tb th:first-child { border-radius: 8px 0 0 8px; }
.tb th:last-child { border-radius: 0 8px 8px 0; }
.tb td { height: 50px; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tb th:first-child, .tb td:first-child { padding-left: 12px; }
.tb th:last-child, .tb td:last-child { padding-right: 12px; }
.tb .num { text-align: right; white-space: nowrap; }
.tb tbody tr.click { cursor: pointer; }
.tb tbody tr.click:hover td { background: #F8FAFD; }
.tb tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tb tfoot td { height: 46px; font-weight: 600; border-bottom: 0; }
.tb tbody:has(+ tfoot) > tr:last-child > td { border-bottom-color: var(--line-2); }
.tb-empty td { height: auto; border-bottom: 0; }
.tb .cell-sub { display: block; font-size: 12.5px; color: var(--text-2); }
@media (max-width: 639px) { .tb th, .tb td { white-space: nowrap; } }

/* label → value */
.kv { margin: 0; }
.kv-r { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv-r:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; }
.kv-note { display: block; color: var(--text-3); font-size: 12.5px; }
.kv-2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; }
.kv-2 .kv-r:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
@media (max-width: 639px) { .kv-2 { grid-template-columns: 1fr; } .kv-2 .kv-r:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--line); } .kv-r { grid-template-columns: minmax(110px, 44%) 1fr; gap: 12px; } }

/* empty, loading, errors */
.empty { padding: 10px 0; color: var(--text-3); }
.sk span { display: block; height: 12px; margin: 16px 0; border-radius: 6px; background: linear-gradient(90deg, var(--bg-soft) 0%, #EEF0F4 50%, var(--bg-soft) 100%) 0 0 / 200% 100%; animation: sk 1.3s linear infinite; }
.sk span:first-child { height: 20px; width: 30% !important; margin-bottom: 28px; }
@keyframes sk { to { background-position: -200% 0; } }
.err-view { padding: 24px 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--text-2); }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-i { position: relative; display: grid; grid-template-columns: 64px 10px minmax(0, 1fr); gap: 14px; padding: 7px 0; }
.tl-i:not(:last-child)::after { content: ''; position: absolute; left: calc(64px + 14px + 4.5px); top: 24px; bottom: -8px; width: 1px; background: var(--line-2); }
.tl-time { text-align: right; color: var(--text-2); font-size: 13px; padding-top: 1px; white-space: nowrap; }
.tl-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--tc, var(--off)); }
.tl-b { display: flex; flex-direction: column; min-width: 0; }
.tl-t { font-weight: 500; }
.tl-s { font-size: 12.5px; color: var(--text-2); }

/* thumbnails */
.thumbs { --s: 72px; display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: var(--s); height: var(--s); padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-soft); cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-2); font-size: 11px; cursor: pointer; }
.thumb-file span { max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* maps */
.mapbox { height: 360px; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); position: relative; z-index: 0; }
.mapbox-sm { height: 220px; }
.leaflet-container { font: 12px/1.4 var(--font); background: var(--bg-soft); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .8) !important; }
.leaflet-bar { border: 1px solid var(--line-2) !important; box-shadow: none !important; border-radius: 8px !important; overflow: hidden; }
.leaflet-bar a { color: var(--text-2) !important; }
.pin { background: none; border: 0; }
.pin-d { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--tc, var(--brand)); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, .18); }
.pin-l { position: absolute; left: 17px; top: -4px; padding: 1px 6px; border-radius: 5px; background: #fff; border: 1px solid var(--line-2); color: var(--text); font-size: 11.5px; font-weight: 500; white-space: nowrap; }

/* ---------- drawers ---------- */
.drs { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.drs.on { pointer-events: auto; }
.dr-ov { position: absolute; inset: 0; background: rgba(15, 23, 42, .22); opacity: 0; transition: opacity .18s; }
.drs.on .dr-ov { opacity: 1; }
.dr { position: absolute; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100%; display: flex; flex-direction: column; background: var(--bg); box-shadow: -16px 0 48px rgba(15, 23, 42, .14); transform: translateX(104%); transition: transform .22s cubic-bezier(.2, .8, .2, 1), filter .2s; outline: 0; }
.dr.in { transform: none; }
.dr.in.under { transform: translateX(-32px); filter: brightness(.97); }
.dr-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 16px 16px 24px; border-bottom: 1px solid var(--line); }
.dr-tt { flex: 1; min-width: 0; padding-top: 3px; }
.dr-title { font-size: 17px; line-height: 1.35; }
.dr-sub { margin-top: 2px; color: var(--text-2); font-size: 13px; }
.dr-act { display: flex; align-items: center; gap: 4px; }
.dr-act:empty { display: none; }
.dr-b { flex: 1; overflow-y: auto; padding: 22px 24px 40px; overscroll-behavior: contain; }
.dr-f { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--bg); }
.dr-sec + .dr-sec { margin-top: 30px; }
.dr-sec > h3 { margin-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 639px) { .dr { width: 100%; box-shadow: none; } .dr.in.under { transform: none; } .dr-h { padding: 14px 10px 12px 16px; } .dr-b { padding: 18px 16px 32px; } .dr-f { padding: 10px 16px; } }

/* ---------- dialogs, menus, search, toasts, viewer ---------- */
.ov { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .3); animation: fade .14s ease-out; }
.dlg { width: 440px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px 18px; border-radius: 12px; background: var(--bg); box-shadow: 0 24px 60px rgba(15, 23, 42, .2); }
.dlg-lg { width: 640px; }
.dlg-t { font-size: 17px; margin-bottom: 8px; }
.dlg-text { margin-bottom: 14px; color: var(--text-2); }
.dlg-b .fld:last-child { margin-bottom: 0; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.menu-pop, .search-pop { z-index: 110; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); box-shadow: 0 12px 32px rgba(15, 23, 42, .12); animation: pop .12s ease-out; }
.menu-pop { position: absolute; min-width: 210px; }
.search-pop { position: fixed; }
.menu-head { padding: 8px 10px 6px; font-weight: 600; }
.menu-head small { display: block; font-weight: 400; color: var(--text-2); font-size: 12.5px; }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-i { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; }
.menu-i:hover, .menu-i:focus-visible { background: var(--bg-soft); text-decoration: none; outline: 0; }
.menu-i .ic { width: 16px; height: 16px; color: var(--text-2); }
.menu-i.danger { color: var(--bad); }
.menu-i:disabled { opacity: .45; cursor: default; }
.sp-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; }
.sp-row.on, .sp-row:hover { background: var(--bg-soft); }
.sp-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sp-t b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-t small { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-none { padding: 10px; color: var(--text-3); }
#toasts { position: fixed; left: 50%; bottom: 24px; z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
@media (min-width: 900px) { body:has(.shell) #toasts { left: calc(50% + var(--side-w) / 2); } }
.toast { position: relative; display: flex; align-items: center; gap: 16px; min-width: 240px; max-width: calc(100vw - 32px); padding: 11px 16px; overflow: hidden; border-radius: 10px; background: #0F172A; color: #fff; font-size: 13.5px; pointer-events: auto; animation: up .18s ease-out; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .16s, transform .16s; }
.toast-err { background: #991B1B; }
.toast-m { flex: 1; }
.toast-u { padding: 0; border: 0; background: none; color: #A9BCF5; font-weight: 600; cursor: pointer; }
.toast-u:hover { color: #fff; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: #6F8FE8; transform-origin: left; animation: shrink linear forwards; }
@keyframes shrink { to { transform: scaleX(0); } }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
@keyframes fade { from { opacity: 0; } }
.ov-dark { background: rgba(15, 23, 42, .84); }
.lb { display: flex; flex-direction: column; width: min(1040px, 100%); height: min(90vh, 920px); }
.lb-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; color: #fff; }
.lb-t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-a { display: flex; gap: 4px; }
.lb .btn-ghost { color: #E2E8F0; }
.lb .btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lb-b { flex: 1; min-height: 0; display: grid; place-items: center; }
.lb-b img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-b iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; background: #fff; }

/* ---------- log in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 10vh; background: var(--bg-soft); }
.auth-in { width: 384px; max-width: 100%; padding: 34px 32px 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.auth-top { text-align: center; margin-bottom: 28px; }
@media (max-width: 479px) { .auth { padding-top: 16px; } .auth-in { padding: 28px 20px 22px; } }
.auth-top .brand-mark { width: 40px; height: 40px; }
.auth-title { margin-top: 18px; font-size: 21px; }
.auth-sub { margin-top: 4px; color: var(--text-2); font-size: 13.5px; }
.auth-err { margin: -4px 0 14px; color: var(--bad); font-size: 13px; }
.auth-form .btn-block { margin-top: 6px; }
.auth-foot { margin-top: 22px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- shared views: the day drawer, the visit drawer, drawer forms ---------- */
.dd-date { display: flex; align-items: center; gap: 4px; margin: -6px 0 8px -8px; }
.dd-day { font-weight: 600; min-width: 136px; text-align: center; }
.dd-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; }
.dd-status .st { height: 26px; padding: 0 11px 0 10px; border-radius: 13px; font-size: 13.5px; }
.dd-status .st .dot { width: 7px; height: 7px; }
.dd-lock { margin-top: 6px; }
.dd-note { white-space: pre-wrap; margin-bottom: 4px; }
.dr-sec > .btn { margin-top: 10px; }
.dd-ul { margin: 0; padding-left: 18px; } .dd-ul li + li { margin-top: 4px; }
.dsf .fld + .fld { margin-top: 2px; }
.dsf-days { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; max-height: 188px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; }
.dsf-day { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); font-weight: 400; margin: 0; }
.dsf-bal { margin: -6px 0 12px; }
.dsf-count { margin-top: -8px; text-align: right; }
.dsf-err { margin-top: 4px; font-size: 13px; }
.dsf + .dr-sec { margin-top: 28px; }
.tline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 14px; }
.tline button { padding: 2px 0; border: 0; background: none; color: var(--text-2); cursor: pointer; font-weight: 500; }
.tline button:hover { color: var(--text); }
.tline button.on { color: var(--brand); }
.tline .tl-n { margin-left: 4px; color: var(--text-3); font-weight: 400; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .sn, .sn-ov, .tbar, .drs, #toasts { display: none !important; } #main { margin-left: 0; } .page { padding: 0; } }
