:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #17202a; --muted: #6b7785; --line: #e3e8ee; --hover: #f0f3f6;
  --primary: #2f6fe4; --primary-soft: #e9f0fd; --ok: #1f9d63; --ok-soft: #e4f5ed;
  --warn: #d98a00; --warn-soft: #fdf3e1; --bad: #d93a3a; --bad-soft: #fde8e8;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
[hidden] { display: none !important; }
/* Features outside pilot step 1 (server FEATURES): hidden unless the server turns them on */
body:not(.f-residents) [data-feature="residents"], body:not(.f-integrations) [data-feature="integrations"], body:not(.f-minut) [data-feature="minut"] { display: none !important; }
/* Portal staff (non-admin) don't see setup controls */
body.not-owner #newPropBtn,
body.staff .admin-only, body.staff #newPropBtn, body.staff #propList [data-act], body.staff .card [data-act="edit"], body.staff nav a[data-view="settings"] { display: none !important; }
#geoResults button { text-align: left; border-radius: 8px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: #111a24; color: #c9d3dd; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 16px; padding: 4px 10px 18px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; }
.brand .logo svg { stroke: #fff; width: 18px; height: 18px; }
nav.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-weight: 500; }
nav.side a:hover { background: rgba(255,255,255,.06); }
nav.side a.on { background: rgba(76,141,255,.18); color: #fff; }
nav.side a .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
nav.side .foot { margin-top: auto; font-size: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
nav.side .foot button { background: transparent; border: 1px solid rgba(255,255,255,.15); color: #c9d3dd; }

main { padding: 22px 28px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px; min-width: 104px; }
.kpi b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi.alarm { border-color: var(--bad); background: var(--bad-soft); }
.kpi.alarm b { color: var(--bad); }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  nav.side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav.side .brand { padding: 4px 10px; }
  /* Sign-out, language, sound and connection stay reachable on phones: a row under the links */
  nav.side .foot { margin-top: 4px; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px 0; border-top: 1px solid rgba(255,255,255,.08); }
  nav.side .foot .conn { flex: 1 1 100%; }
  main { padding: 16px; }
  .kpi { min-width: 0; flex: 1 1 40%; }
  #toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
}

/* ---------- common ---------- */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover { background: var(--hover); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { filter: brightness(1.07); background: var(--primary); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.sm { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .45; cursor: default; filter: none; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.invalid, input.invalid:focus, select.invalid:focus { border-color: var(--bad); outline-color: var(--bad-soft); }
textarea { resize: vertical; min-height: 80px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.section-row { justify-content: space-between; margin-bottom: 10px; }
.section-row .section-title { margin: 0; }
.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); border: 1px solid #f0d49a; color: #7a4d00; }
.banner a { color: inherit; font-weight: 600; }
.empty { color: var(--muted); padding: 28px; text-align: center; background: var(--panel); border-radius: var(--radius); border: 1px dashed var(--line); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); font-weight: 600; white-space: nowrap; }
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.red { background: var(--bad-soft); color: var(--bad); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.green { background: var(--ok-soft); color: var(--ok); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- live ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 1180px) { .live { grid-template-columns: 1fr; } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .2s, border-color .2s; }
.card.alarm { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(217,58,58,.12); }
.card.attention { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,228,.12); }
/* A guest is waiting for a call back: the most urgent thing on the board */
.card.calling { border-color: var(--primary); animation: calling 1.6s ease-in-out infinite; }
@keyframes calling { 50% { box-shadow: 0 0 0 6px rgba(47,111,228,.25); } }
@media (prefers-reduced-motion: reduce) { .card.calling { animation: none; box-shadow: 0 0 0 4px rgba(47,111,228,.25); } }
.card.offline .level, .card.offline canvas { opacity: .45; }
.card .head { display: flex; align-items: flex-start; gap: 8px; }
.card .name { font-weight: 650; font-size: 15px; }
.card .addr { color: var(--muted); font-size: 12px; }
.card .tags { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
/* Long tags ("Handling: …", "In a call with …") wrap and truncate instead of squeezing the name or overflowing */
.card .head > div:not(.tags) { flex: 1 1 120px; min-width: 0; }
.card .tags { flex: 0 1 auto; min-width: 0; max-width: 62%; }
.card .tags .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.level { display: flex; align-items: baseline; gap: 6px; }
.level b { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.level .lim { margin-left: auto; color: var(--muted); font-size: 12px; }
canvas.spark { width: 100%; height: 54px; display: block; }
.devs { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.devs .d { display: flex; align-items: center; gap: 6px; }
.devs .d .n { color: var(--ink); }
.devs .d .r { margin-left: auto; display: flex; gap: 10px; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Guest language on the iPad: a compact select styled like the small buttons */
.langsel { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel); }
.langsel select { border: 0; background: transparent; font: inherit; font-size: 12px; padding: 5px 2px; color: var(--ink); cursor: pointer; }

/* ---------- alerts ---------- */
.feed { display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 10px 12px; border-left: 4px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.alert .ic { grid-row: 1 / span 3; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.alert.t-noise .ic, .alert.t-offline .ic { background: var(--bad-soft); color: var(--bad); }
.alert.t-guest_call .ic { background: var(--primary-soft); color: var(--primary); }
.alert.t-resident_report .ic { background: var(--warn-soft); color: var(--warn); }
.alert.s-open.t-noise, .alert.s-open.t-offline { border-left-color: var(--bad); }
.alert.s-open.t-guest_call { border-left-color: var(--primary); }
.alert.s-open.t-resident_report { border-left-color: var(--warn); }
.alert.s-resolved { opacity: .6; }
.alert .title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert .body { color: var(--ink); }
.alert .meta { color: var(--muted); font-size: 12px; }
.stages { display: flex; gap: 4px; margin: 6px 0 2px; max-width: 520px; }
.stage { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage .bar { height: 5px; border-radius: 3px; background: var(--line); }
.stage.on.warn .bar { background: var(--warn); }
.stage.on.bad .bar { background: var(--bad); }
.stage.on.calm .bar { background: var(--primary); }
.stage.on.ok .bar { background: var(--ok); }
.stage .lbl { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage.now .lbl { color: var(--ink); font-weight: 600; }
.case-next { font-size: 12.5px; color: var(--muted); }
.card .precase { color: var(--muted); line-height: 1.5; }
.alert .acts { grid-column: 2; display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.alert > :not(.ic) { grid-column: 2; }
.alert.group { border-left-style: dashed; }
.alert.group .ic { grid-row: 1 / span 4; }
.alert .earlier { color: var(--muted); font-size: 12px; }
.quote { color: var(--muted); font-style: italic; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- properties ---------- */
.prop { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.prop + .prop { margin-top: 12px; }
.prop .head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.prop .head .grow { flex: 1; min-width: 200px; }
.prop .cfg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.prop .cfg b { color: var(--ink); font-weight: 600; }
.devtable td, .devtable th { padding: 8px 10px; }
.prop .table-wrap { margin: 0 -4px; }
@media (max-width: 600px) {
  /* one device per block: name, type, status, then the buttons, instead of a table wider than the phone */
  .devtable thead { display: none; }
  .devtable, .devtable tbody, .devtable tr, .devtable td { display: block; }
  .devtable tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .devtable tr:last-child { border-bottom: 0; }
  .devtable td { border: 0; padding: 2px 4px; }
  .devtable td:last-child { text-align: left !important; padding-top: 6px; }
  .prop .table-wrap { overflow: visible; }
}

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(15,23,32,.45); }
dialog form, dialog .content { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
dialog h3 { margin: 0; font-size: 17px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
dialog label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
dialog .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
dialog .err { color: var(--bad); font-size: 13px; }
.qr { display: grid; place-items: center; padding: 8px; }
.qr img { width: 260px; height: 260px; image-rendering: pixelated; }
code.link { font-size: 11px; word-break: break-all; background: var(--bg); padding: 6px 8px; border-radius: 6px; display: block; }

/* ---------- call ---------- */
#callView { position: fixed; inset: 0; background: rgba(10,14,20,.9); display: none; z-index: 50; align-items: center; justify-content: center; }
#callView.on { display: flex; }
.callbox { position: relative; width: min(1040px, 94vw); aspect-ratio: 16/9; background: #05080c; border-radius: 16px; overflow: hidden; }
.callbox video#remote { width: 100%; height: 100%; object-fit: cover; }
.callbox video#local { position: absolute; right: 14px; top: 14px; width: 21%; border-radius: 10px; border: 2px solid rgba(255,255,255,.25); transform: scaleX(-1); background: #111; }
.callbox .status { position: absolute; inset: 0; display: grid; place-items: center; color: #dfe6ee; text-align: center; pointer-events: none; }
.callbox .status .ring { width: 96px; height: 96px; border-radius: 50%; background: var(--primary); display: grid; place-items: center; margin: 0 auto 16px; animation: pulse 1.4s infinite; }
.callbox .status .ring svg { width: 40px; height: 40px; stroke: #fff; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,111,228,.6); } 100% { box-shadow: 0 0 0 36px rgba(47,111,228,0); } }
.callbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px; display: flex; gap: 10px; align-items: center; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; }
.callbar .who { margin-right: auto; font-weight: 600; }
.callbar .who small { display: block; font-weight: 400; color: #b8c2cc; }
.callbar button { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.callbar button.danger { background: var(--bad); }
.callbar button:disabled { opacity: .45; cursor: default; }
.callbox .micwarn { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(217,58,58,.92); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 28px); text-align: center; z-index: 2; }
#callView.presenting .callbox .micwarn { position: static; transform: none; border-radius: 0; max-width: none; }

/* ---------- document presenter (during a call) ---------- */
#callView.presenting { align-items: stretch; justify-content: stretch; gap: 14px; padding: 14px; background: #0a0e14; }
#callView.presenting .callbox { width: 340px; flex: none; align-self: flex-start; }
#callView.presenting .callbar { position: static; flex-wrap: wrap; background: #0d1319; }
#callView.presenting .callbox { aspect-ratio: auto; display: flex; flex-direction: column; }
#callView.presenting .callbox video#remote { aspect-ratio: 16/9; height: auto; }
#callView.presenting .callbox .status { bottom: auto; aspect-ratio: 16/9; }
#presenter { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #151b22; border-radius: 16px; overflow: hidden; color: #e6ecf2; border: 3px solid transparent; }
#presenter[hidden] { display: none; }
#presenter.on-air { border-color: var(--bad); }
#presenter .ptop, #presenter .ptools, #presenter .pfoot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
#presenter .ptop { border-bottom: 1px solid #222b35; }
#presenter .pfoot { border-top: 1px solid #222b35; justify-content: center; }
#presenter button { background: rgba(255,255,255,.1); border: 1px solid transparent; color: #fff; padding: 6px 12px; }
#presenter button.on { background: var(--primary); }
#presenter button.primary { background: var(--primary); }
#presenter button.danger { background: var(--bad); }
#presenter button:disabled { opacity: .4; cursor: default; }
#presenter .pname { flex: 1 1 120px; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9aa6b2; }
#presenter .plive { background: var(--bad); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: 99px; font-size: 12px; }
#presenter .pidle { background: rgba(255,255,255,.12); color: #e6ecf2; font-weight: 600; padding: 4px 10px; border-radius: 99px; font-size: 12px; }
#presenter .pidle.paused { background: var(--warn); color: #1d1300; }
#presenter button:focus-visible { outline: 2px solid #8fb4ff; outline-offset: 2px; }
#presenter .phelp { width: 100%; text-align: center; font-size: 12px; color: #8a99a8; }
#presenter .psep { width: 1px; height: 22px; background: #2a3440; margin: 0 4px; }
#presenter .pcolor { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid transparent; }
#presenter .pcolor.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); background: var(--c); }
#presenter .pstage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px; overflow: hidden; }
#presenter .pstage canvas { display: block; border-radius: 6px; touch-action: none; cursor: crosshair; background: #2b3138; }
#presenter .pstage canvas[data-tool=pan] { cursor: grab; }
#presenter .pstage canvas[data-tool=pointer] { cursor: none; }
#presenter .pempty { color: #9aa6b2; text-align: center; max-width: 420px; line-height: 1.6; }
#presenter .ppage, #presenter .pzoom { min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  #callView.presenting { flex-direction: column; overflow: auto; padding: 8px; gap: 8px; }
  #callView.presenting .callbox { width: 100%; order: -1; }
  #callView.presenting .callbox video#remote { max-height: 28vh; }
  #presenter { flex: none; min-height: 88vh; }
  #presenter .pstage { min-height: 52vh; }
  #presenter .ptop .pname { flex-basis: 100%; order: 10; }
  #presenter .phelp { display: none; }
}

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #111a24; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; display: flex; gap: 10px; align-items: flex-start; animation: slidein .2s ease-out; }
.toast.bad { border-left: 4px solid var(--bad); } .toast.warn { border-left: 4px solid var(--warn); } .toast.info { border-left: 4px solid var(--primary); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .box { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }

/* Language switch (JA / EN) */
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; font-size: 12px; }
.langsw button { font: inherit; border: 0; border-radius: 0; background: transparent; padding: 3px 10px; cursor: pointer; color: inherit; }
.langsw button.on { background: var(--ink); color: #fff; }
nav.side .langsw { align-self: flex-start; border-color: rgba(255,255,255,.15); }
nav.side .foot .langsw button { border: 0; color: #c9d3dd; }
nav.side .foot .langsw button.on { background: rgba(255,255,255,.18); color: #fff; }

/* Microphone calibration */
.audit-filter { margin: 0 0 10px; }
.audit-filter label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.audit-filter select { width: auto; }
td.calcell { min-width: 180px; }
.calnow { padding: 8px 0; }

/* Case panel */
.banner.bad { background: var(--bad-soft); border: 1px solid #f3b4b4; color: #8a1f1f; font-weight: 600; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.case-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.case-box .k { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.case-box .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.case-box .phone { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; user-select: all; }
.case-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.case-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px !important; background: var(--bg); }
.case-h { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 92px 14px 1fr; gap: 8px; font-size: 13px; padding-bottom: 8px; }
.timeline time { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.timeline .dot { position: relative; width: 14px; height: 100%; background: none; }
.timeline .dot::before { content: ""; position: absolute; left: 3px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline .dot::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: -9px; width: 2px; background: var(--line); }
.timeline li:last-child .dot::after { display: none; }
.timeline li.resident .dot::before { background: var(--warn); }
.timeline li.system .dot::before { background: var(--muted); }
.timeline li.onsite .dot::before, .timeline li.resolved .dot::before { width: 10px; height: 10px; left: 2px; top: 4px; }
.timeline details summary { cursor: pointer; list-style: none; }
.timeline details summary::-webkit-details-marker { display: none; }
.timeline details summary b { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.timeline.sub { margin-top: 8px; }
.timeline.sub li { grid-template-columns: 64px 14px 1fr; font-size: 12px; padding-bottom: 4px; }
.timeline li.onsite .dot::before { background: var(--bad); }
.timeline li.resolved .dot::before { background: var(--ok); }
.timeline .who { color: var(--muted); }
.timeline .note { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--bg); border-radius: 8px; padding: 4px 8px; margin-top: 3px; }
.stay-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.stay-row.now { border-color: var(--primary); }

/* Pilot metrics */
.metrics-period { gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 4px; }
.metrics-period label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
.metrics-h { font-size: 14px; margin: 20px 0 8px; }
table.metrics td, table.metrics th { white-space: nowrap; }
table.metrics td.num { font-variant-numeric: tabular-nums; }
table.metrics td.num b { font-size: 15px; }
table.metrics tfoot td { font-weight: 600; border-bottom: 0; }

/* To do (operator home) */
.todo { padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: center; border-left: 4px solid var(--line); }
.todo .ic { grid-row: 1 / span 2; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.todo.bad { border-left-color: var(--bad); } .todo.bad .ic { background: var(--bad-soft); color: var(--bad); }
.todo.warn { border-left-color: var(--warn); } .todo.warn .ic { background: var(--warn-soft); color: var(--warn); }
.todo .title { font-weight: 600; }
.todo .detail { color: var(--muted); font-size: 12px; grid-column: 2; }
.todo button { grid-column: 3; grid-row: 1 / span 2; }
.todo-empty { padding: 24px; text-align: center; color: var(--muted); }
@media (max-width: 600px) { .todo { grid-template-columns: auto 1fr; } .todo button { grid-column: 2; grid-row: auto; justify-self: start; margin-top: 6px; } }
/* Case history */
table.caselog tbody tr { cursor: pointer; }
table.caselog tbody tr:hover { background: var(--bg); }
table.caselog td { white-space: nowrap; }
table.caselog td.outcome { max-width: 280px; white-space: normal; }
