/* Ambulance Priority - light theme */
:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --line: #e3e8ef;
  --text: #0f1b2d;
  --text-2: #5b6b80;
  --navy: #0b3b66;
  --accent: #2563eb;
  --red: #e11d48;
  --red-2: #be123c;
  --amber: #f59e0b;
  --green: #16a34a;
  --off: #c3ccd8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 14px rgba(16,24,40,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--text-2); font-weight: 400; }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.pad { padding: 30px 0; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text); letter-spacing: -.005em; }
h2 .muted { font-size: 13px; }
a { color: var(--accent); }
svg { fill: currentColor; }

/* ---------- hero header ---------- */
.hero { position: relative; color: #fff; padding: 0 0 34px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background:
  linear-gradient(100deg, rgba(8,32,60,.94) 0%, rgba(11,59,102,.82) 45%, rgba(11,59,102,.35) 100%),
  url("hospital.jpg") center 40% / cover no-repeat, var(--navy); }
.hero > .topbar, .hero > .hero-text { position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; flex-wrap: wrap; max-width: 1400px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.brand.big { font-size: 22px; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(225,29,72,.35); }
.logo svg { width: 18px; height: 18px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user { font-size: 13px; color: rgba(255,255,255,.8); }
.user b { color: #fff; font-weight: 600; }
.role { display: inline-block; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.16); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-left: 6px; }
.hero-text { max-width: 1400px; margin: 0 auto; padding: 22px 24px 0; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fda4af; }
.hero h1 { margin: 6px 0 6px; font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.hero-sub { margin: 0; color: rgba(255,255,255,.85); font-size: 14.5px; }
.credit { position: absolute; right: 10px; bottom: 6px; font-size: 10px; color: rgba(255,255,255,.6); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text); }
.hero .pill { background: rgba(255,255,255,.95); border-color: transparent; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.pill.online .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.pill.offline .dot { background: var(--red); }
.pill.demo .dot { background: var(--amber); }
.pill.mode.m0 { color: var(--green); background: #ecfdf3; border-color: #bbf7d0; }
.pill.mode.m1 { color: #fff; background: var(--red); border-color: var(--red); }
.pill.mode.m2 { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.chip.ok { background: #ecfdf3; color: var(--green); }
.chip.gov { background: #eff6ff; color: var(--navy); text-transform: none; letter-spacing: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; max-width: 1400px; margin: -24px auto 0; padding: 6px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); position: sticky; top: 8px; z-index: 900; overflow-x: auto; width: calc(100% - 48px); }
.tab { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text-2); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; flex: 1; justify-content: center; transition: background .15s, color .15s; }
.tab svg { width: 18px; height: 18px; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--navy); color: #fff; }
.tab-badge { background: var(--red); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 7px; min-width: 18px; }

/* ---------- layout ---------- */
.panel { max-width: 1400px; margin: 0 auto; padding: 18px 24px 28px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.control { grid-column: span 4; }
.inter   { grid-column: span 5; }
.status  { grid-column: span 3; }
.kpis    { grid-column: span 12; }
.chart   { grid-column: span 6; }
.queue   { grid-column: span 5; }
.log     { grid-column: span 7; }
@media (max-width: 1050px) {
  .control, .inter { grid-column: span 6; }
  .status, .queue, .log { grid-column: span 12; }
}
@media (max-width: 720px) {
  .panel { padding: 14px 12px 24px; }
  .grid { gap: 12px; }
  .control, .inter, .chart { grid-column: span 12; }
  .topbar, .hero-text { padding-left: 14px; padding-right: 14px; }
  .tabs { width: calc(100% - 24px); }
  .tab { padding: 9px 10px; font-size: 13px; gap: 5px; }
  .tab svg { display: none; }
  .user { display: none; }
}

/* ---------- control ---------- */
.emg-btn { width: 100%; border: 0; background: linear-gradient(180deg, #fff1f2, #ffe4e6); color: var(--red-2); border-radius: 18px; padding: 24px 10px; cursor: pointer; display: grid; gap: 4px; font: inherit; box-shadow: inset 0 0 0 2px #fecdd3; transition: transform .05s, background .2s; }
.emg-btn:active { transform: scale(.98); }
.emg-btn .emg-label { font-size: 28px; font-weight: 800; letter-spacing: .08em; }
.emg-btn .emg-sub { font-size: 13px; font-weight: 600; opacity: .85; }
.emg-btn.on { background: linear-gradient(180deg, #f43f5e, #be123c); color: #fff; box-shadow: none; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(225,29,72,.45); } 50% { box-shadow: 0 0 0 14px rgba(225,29,72,0); } }
.emg-btn:disabled, .dir-btn:disabled { opacity: .45; cursor: not-allowed; animation: none; }
.hint { color: var(--text-2); font-size: 13.5px; margin: 12px 0; min-height: 2.6em; }
.hint.go { color: #b45309; font-weight: 600; }
.dirs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.dir-btn { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 14px 8px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.dir-btn:hover:not(:disabled) { border-color: var(--navy); }
.dir-btn.sel { background: var(--green); border-color: var(--green); color: #fff; }
.dir-btn.armed { border-color: var(--amber); background: #fffbeb; }

.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-2); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.glass { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ---------- intersection ---------- */
#map { width: 100%; max-height: 340px; display: block; border-radius: 12px; }
.status-text { font-size: 18px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 1050px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px)  { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; gap: 2px; }
.t-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.t-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--navy); }
.t-note { font-size: 11.5px; color: var(--text-2); }

/* ---------- bar charts ---------- */
.bars { position: relative; height: 170px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line); padding-top: 18px; }
.bars .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); font-size: 13px; text-align: center; padding: 0 12px; }
.bar { flex: 1; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; cursor: default; }
.bar:hover { filter: brightness(1.15); }
.bar .bl { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text); white-space: nowrap; }
.bar-axis { display: flex; gap: 3px; font-size: 11px; color: var(--text-2); }
.bar-axis span { flex: 1; max-width: 46px; text-align: center; }
.tip { position: fixed; pointer-events: none; background: #0f1b2d; color: #fff; padding: 6px 9px; border-radius: 8px; font-size: 12px; z-index: 2000; }

/* ---------- queue ---------- */
.qrow { display: grid; grid-template-columns: 56px 1fr 128px; align-items: center; gap: 10px; margin: 10px 0; font-size: 13.5px; font-weight: 500; }
.qtrack { height: 12px; border-radius: 6px; background: var(--surface-2); position: relative; overflow: hidden; }
.qfill { height: 100%; border-radius: 6px; background: var(--accent); }
.qthr { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); }
.qval { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qtag { font-size: 11px; font-weight: 700; color: #78350f; background: #fde68a; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }

/* ---------- log ---------- */
.table-wrap { max-height: 300px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.k { font-weight: 700; white-space: nowrap; }
.k-cmd { color: var(--accent); } .k-grn { color: var(--green); } .k-clr { color: #b45309; }
.k-rec { color: var(--text); } .k-lost { color: var(--red); }
.foot { text-align: center; padding: 0 0 24px; }

/* ---------- messages ---------- */
.chat-card { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; }
.chat-list { height: min(58vh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 4px 12px; background: var(--surface-2); border-radius: 12px; padding: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 86%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.msg.me .bubble { background: var(--navy); color: #fff; border-color: var(--navy); border-radius: 14px 14px 4px 14px; }
.bubble .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.bubble .who .r { font-weight: 600; color: var(--text-2); text-transform: uppercase; font-size: 10px; margin-left: 4px; }
.msg.me .bubble .who, .msg.me .bubble .who .r { color: rgba(255,255,255,.75); }
.bubble .txt { white-space: pre-wrap; word-break: break-word; }
.bubble .tm { font-size: 10.5px; color: var(--text-2); margin-top: 3px; text-align: right; }
.msg.me .bubble .tm { color: rgba(255,255,255,.65); }
.bubble a.locl { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.msg.me .bubble a.locl { color: #bfdbfe; }
.day { align-self: center; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface); border-radius: 99px; padding: 2px 10px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; }
.qbtn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.qbtn:hover { border-color: var(--navy); }
.qbtn.loc { background: #eff6ff; border-color: #bfdbfe; color: var(--navy); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; font: inherit; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.chat-form input:focus, .login-card input:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }

/* ---------- hospitals map ---------- */
.map-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
@media (max-width: 900px) { .map-layout { grid-template-columns: 1fr; } }
.hmap { height: min(62vh, 600px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); z-index: 1; }
.hosp-list { display: grid; gap: 10px; max-height: min(62vh, 620px); overflow-y: auto; }
.hosp { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.hosp:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.hosp .hn { font-weight: 700; display: flex; justify-content: space-between; gap: 6px; }
.hosp .hd { font-size: 12.5px; color: var(--text-2); }
.hosp .ht { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; }
.ht.gov { background: #eff6ff; color: var(--navy); } .ht.pvt { background: #f5f3ff; color: #6d28d9; } .ht.mil { background: #f0fdf4; color: #166534; }
.hosp .ha { display: flex; gap: 6px; flex-wrap: wrap; }
.hosp .ha a { font-size: 12.5px; font-weight: 600; text-decoration: none; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); }
.hosp .ha a.c { background: var(--red); color: #fff; border-color: var(--red); }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.3); border: 2px solid #fff; }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 14px; }
.pin.gov { background: var(--red); } .pin.pvt { background: #7c3aed; } .pin.mil { background: #15803d; }
.pin.int { background: var(--navy); border-radius: 8px; transform: none; } .pin.int span { transform: none; font-size: 12px; }
.pin.me { background: var(--accent); border-radius: 50%; }
.leaflet-popup-content { font: 13px/1.45 var(--font); }

/* ---------- call centre ---------- */
.call-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.call-layout > .card:first-child { grid-row: span 2; }
@media (max-width: 900px) { .call-layout { grid-template-columns: 1fr; } .call-layout > .card:first-child { grid-row: auto; } }
.call-hero { padding: 0; overflow: hidden; }
.call-photo { height: 210px; background: linear-gradient(180deg, rgba(11,59,102,0) 40%, rgba(11,59,102,.55)), url("hospital.jpg") center 45% / cover no-repeat, var(--navy); }
.call-body { padding: 20px; display: grid; gap: 12px; }
.call-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.call-body p { margin: 0; }
.call-btn { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; text-decoration: none; color: #fff; background: linear-gradient(180deg, #16a34a, #15803d); box-shadow: 0 6px 18px rgba(22,163,74,.3); transition: transform .05s; }
.call-btn:active { transform: scale(.98); }
.call-btn b { display: block; font-size: 17px; }
.call-btn small { display: block; font-size: 12.5px; opacity: .9; }
.call-btn.red { background: linear-gradient(180deg, #f43f5e, #be123c); box-shadow: 0 6px 18px rgba(225,29,72,.3); }
.call-btn.ghostc { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.call-ico { flex: 0 0 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.call-ico svg { width: 22px; height: 22px; }
.call-btn.ghostc .call-ico { background: var(--surface-2); }
.call-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .call-row { grid-template-columns: 1fr; } }
.steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.call-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.call-log li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; background: var(--surface); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-photo { min-height: 260px; } }
.login-photo { position: relative; color: #fff; display: flex; align-items: flex-end; padding: 40px; background:
  linear-gradient(180deg, rgba(8,32,60,.2) 0%, rgba(8,32,60,.88) 100%), url("hospital.jpg") center / cover no-repeat, var(--navy); }
.login-photo-text { max-width: 520px; }
.login-photo h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.03em; margin: 10px 0 8px; line-height: 1.05; }
.login-photo p { margin: 0; opacity: .9; font-size: 16px; }
.badge-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 99px; }
.badge-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.3); }
.login-side { display: grid; place-items: center; padding: 28px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card form { display: grid; gap: 14px; margin: 22px 0 16px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.login-card input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.err { color: var(--red); min-height: 1.2em; margin: 0; font-size: 13px; }

/* ---------- photos, alerts, report ---------- */
.btns { display: flex; gap: 8px; }
img.photo { display: block; max-width: min(320px, 60vw); max-height: 320px; border-radius: 10px; margin: 4px 0 6px; cursor: zoom-in; background: var(--surface-2); min-height: 80px; min-width: 120px; object-fit: cover; }
.msg.alert .bubble { background: #fff1f2; border: 1.5px solid #fda4af; color: #881337; }
.msg.alert.me .bubble { background: linear-gradient(180deg, #f43f5e, #be123c); border-color: #be123c; color: #fff; }
.msg.alert .txt { font-weight: 600; }
.lightbox { position: fixed; inset: 0; background: rgba(15,27,45,.88); display: grid; place-items: center; z-index: 3000; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.alert-card { border-color: #fecdd3; }
.alert-form { display: grid; gap: 12px; }
.alert-form .eta { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-form select, .alert-form input[type=text], .alert-form #alertNote { font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.conds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cond { font: inherit; font-weight: 700; padding: 10px 6px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.cond.red.sel { background: #fff1f2; border-color: #e11d48; color: #9f1239; }
.cond.amber.sel { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.cond.green.sel { background: #ecfdf3; border-color: #16a34a; color: #166534; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* ---- chat: edit / delete ---- */
.bubble .acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
.mact { font: inherit; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.mact:hover { color: var(--text); border-color: var(--text-2); }
.msg.me .mact { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.mact.danger { background: var(--red); border-color: var(--red); color: #fff; }
.mact.save { background: var(--navy); border-color: var(--navy); color: #fff; }
.msg.me .mact.save { background: #fff; color: var(--navy); border-color: #fff; }
.bubble .confirm { font-size: 12px; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bubble .edited { font-style: italic; }
.bubble .deleted { font-style: italic; opacity: .75; }
.msg.dead .bubble { background: var(--surface); color: var(--text-2); border-style: dashed; border-color: var(--line); }
.msg.dead .bubble .who, .msg.dead .bubble .tm { color: var(--text-2); }
.editf textarea { width: 100%; min-width: 220px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; resize: vertical; }
.editf .editb { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
@media (hover: hover) { .bubble .acts { opacity: 0; transition: opacity .15s; } .msg:hover .bubble .acts, .bubble .acts:focus-within { opacity: 1; } }
.bubble .acts.on { opacity: 1 !important; }
.msg.me .mact.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* chat: seen ticks + acknowledge */
.tick { margin-left: 6px; white-space: nowrap; }
.tick.seen { color: #0284c7; font-weight: 600; }
.msg.me .tick.seen { color: #7dd3fc; }
.msg.alert.me .tick.seen { color: #fff; }
.ack { margin-top: 6px; font-size: 12px; font-weight: 600; border-radius: 8px; padding: 5px 8px; line-height: 1.4; }
.ack.ok { background: #dcfce7; color: #166534; }
.ack.wait { background: #fef3c7; color: #92400e; }
.ack.late { background: #fee2e2; color: #991b1b; }
.ack.late a { color: #991b1b; text-decoration: underline; }
.ack.todo { background: #e0f2fe; color: #075985; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ack .ackb { background: #0369a1; color: #fff; border: 0; opacity: 1; }
.ack .ackb:disabled { opacity: .5; }

/* admin: User IDs */
.card.users { grid-column: 1 / -1; }
.add-id { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.add-id input, .add-id select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.add-id #newId { width: 170px; } .add-id #newName { flex: 1; min-width: 160px; }
#usersMsg.err { color: var(--red); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }

/* profile button, bell, side sheet, About */
.profile-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14); color: #fff; font: inherit; cursor: pointer; text-align: left; }
.profile-btn:hover { background: rgba(255,255,255,.24); }
.pav { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--navy); display: inline-grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.pav.sm { background: var(--navy); color: #fff; }
.pinfo { display: grid; line-height: 1.15; } .pinfo b { font-size: 13px; } .pinfo small { font-size: 11px; opacity: .8; }
.bell { position: relative; }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.bell.ring { animation: ring .9s ease 2; }
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
.hero-who { margin: 0 0 6px; color: rgba(255,255,255,.88); font-size: 14px; } .hero-who b { color: #fff; }
.pending-banner { max-width: 1240px; margin: 14px auto 0; padding: 12px 16px; border-radius: 12px; background: #fef3c7; color: #92400e; font-size: 14px; border: 1px solid #fde68a; }
.pending-banner.bad { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.pending-banner.hidden { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 900; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); z-index: 901; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.2); padding: 18px 20px 30px; color: var(--text); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -18px; background: var(--surface); padding: 6px 0 10px; z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet .sec { border-top: 1px solid var(--line); padding: 14px 0; }
.sheet .sec:first-child { border-top: 0; }
.sheet h3 { margin: 0 0 10px; font-size: 15px; } .sheet h4 { margin: 16px 0 6px; font-size: 13.5px; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.me-card { display: flex; gap: 14px; align-items: center; }
.big-av { width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.me-name { font-size: 18px; font-weight: 700; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv > span { color: var(--text-2); flex: none; } .kv > b { font-weight: 600; text-align: right; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 16px; letter-spacing: .12em; background: #eef2ff; color: var(--navy); padding: 2px 8px; border-radius: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.tag.green { background: #dcfce7; color: #166534; border-color: #bbf7d0; } .tag.amber { background: #fef3c7; color: #92400e; border-color: #fde68a; } .tag.red { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.linkbtn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0 2px; }
#nameInput { font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); width: 170px; }
.req-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0 4px; font-size: 13px; }
.req-form label { display: grid; gap: 4px; } .req-form select, .login-card select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.login-card select { padding: 12px 14px; border-radius: 12px; }
#sheetLogout { margin-top: 12px; }
.psm-note { background: #eef4ff; border: 1px solid #c7d7fe; color: #1e3a8a; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; }
.about p, .about li { font-size: 13.5px; line-height: 1.6; }
.about ol, .about ul { padding-left: 20px; margin: 6px 0; }
.about .kvs { margin: 10px 0; }
.disclaimer { margin: 14px 0 8px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; font-size: 13px; }
.reqc { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.reqh { display: flex; gap: 10px; align-items: center; } .reqb { display: flex; gap: 8px; margin-top: 10px; }
.ok { color: #166534; }
@media (max-width: 720px) { .pinfo small { display: none; } .profile-btn { padding-right: 8px; } }

/* =====================================================================
   THEME v3 (2026-12-07): flat, neutral operations-console style.
   One accent (blue). Red, amber and green only mean signal/alert states.
   ===================================================================== */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6eb;
  --line-2: #cfd4dc;
  --text: #111827;
  --text-2: #5f6b7a;
  --ink: #111827;
  --navy: #111827;
  --accent: #1d4ed8;
  --red: #c8102e;
  --red-2: #a50d25;
  --amber: #b45309;
  --green: #047857;
  --radius: 8px;
  --shadow: none;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html, body { background: var(--bg); font-size: 14px; }
h2 { font-size: 14px; font-weight: 600; letter-spacing: 0; }
a { color: var(--accent); }

/* header: compact dark bar, no photo */
.hero { background: var(--ink); color: #fff; padding: 0; overflow: visible; }
.hero-bg, .hero .credit { display: none; }
.topbar { padding: 10px 24px; }
.brand { font-size: 15px; font-weight: 600; gap: 10px; letter-spacing: 0; }
.logo { width: 28px; height: 28px; border-radius: 6px; background: var(--red); box-shadow: none; }
.logo svg { width: 15px; height: 15px; }
.hero-text { padding: 2px 24px 16px; display: grid; gap: 2px; }
.eyebrow { order: 2; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: #9aa4b2; margin: 0; }
.hero-who { order: 3; margin: 0; font-size: 12px; color: #9aa4b2; } .hero-who b { color: #d5dae1; font-weight: 600; }
.hero h1 { display: none; }
.hero-sub { order: 1; font-size: 14px; color: #c3cad4; margin: 0; }
.bell svg { display: block; fill: currentColor; } .hero-sub b { color: #fff; font-weight: 600; }
.hero .pill { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #e5e8ec; font-weight: 500; }
.btn.glass { background: transparent; border-color: rgba(255,255,255,.2); color: #e5e8ec; border-radius: 6px; }
.btn.glass:hover { background: rgba(255,255,255,.08); }
.profile-btn { border-radius: 6px; border-color: rgba(255,255,255,.16); background: transparent; padding: 3px 10px 3px 3px; }
.profile-btn:hover { background: rgba(255,255,255,.08); }
.pav { border-radius: 4px; width: 28px; height: 28px; background: #e5e8ec; color: var(--ink); font-weight: 700; font-size: 11px; }
.pav.sm { background: var(--ink); color: #fff; }
.bell.ring { animation: none; }

/* tabs: underline nav bar */
.tabs { position: sticky; top: 0; z-index: 900; max-width: none; width: 100%; margin: 0; padding: 0 max(24px, calc((100% - 1400px) / 2 + 24px)); gap: 4px; background: var(--surface); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.tab { flex: 0 0 auto; border-radius: 0; padding: 12px 12px 10px; font-size: 13.5px; font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; background: none; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { background: none; color: var(--text); }
.tab.active { background: none; color: var(--text); font-weight: 600; border-bottom-color: var(--accent); box-shadow: none; }
.tab-badge { border-radius: 4px; }

/* cards */
.panel { padding-top: 20px; }
.grid { gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; padding: 16px 18px; }
.card-head { margin-bottom: 12px; }
.card h2 .muted, h2 .muted { font-size: 12.5px; font-weight: 400; }
.chip { border-radius: 4px; font-size: 10.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); }
.chip.ok { background: #ecfdf3; border-color: #c6f0d9; color: var(--green); }
.pill { border-radius: 4px; font-weight: 600; font-size: 12px; padding: 4px 9px; }
.pill.mode.m0 { background: #ecfdf3; border-color: #c6f0d9; color: var(--green); }
.pill.mode.m1 { background: var(--red); border-color: var(--red); color: #fff; animation: none; }
.pill.mode.m2 { background: #fffaeb; border-color: #fbe3a8; color: var(--amber); }
.pill.online .dot { background: #12b76a; box-shadow: none; }

/* status line */
.status { grid-column: span 12; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 11px 18px; }
.status > h2 { margin: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); white-space: nowrap; }
.status-text { margin: 0; flex: 1 1 260px; font-size: 14px; font-weight: 600; }
#statusTime { margin: 0; white-space: nowrap; }

/* layout: control | intersection | queue */
.control { grid-column: span 4; display: flex; flex-direction: column; }
.control #lastCmd { margin-top: auto; padding-top: 8px; }
.inter   { grid-column: span 5; }
.queue   { grid-column: span 3; }
.kpis    { grid-column: span 12; }
.chart   { grid-column: span 6; }
.log     { grid-column: span 12; }
.users   { grid-column: span 12; }

/* emergency control */
.emg-btn { background: var(--surface); border: 1.5px solid var(--red); color: var(--red); border-radius: 6px; padding: 20px 10px; box-shadow: none; }
.emg-btn:hover:not(:disabled) { background: #fff5f6; }
.emg-btn .emg-label { font-size: 22px; font-weight: 700; letter-spacing: .12em; }
.emg-btn .emg-sub { font-size: 12.5px; font-weight: 500; color: var(--text-2); opacity: 1; }
.emg-btn.on { background: var(--red); border-color: var(--red); color: #fff; animation: ring2 1.6s infinite; }
.emg-btn.on .emg-sub { color: rgba(255,255,255,.85); }
@keyframes ring2 { 0%,100% { box-shadow: 0 0 0 0 rgba(200,16,46,.35); } 50% { box-shadow: 0 0 0 6px rgba(200,16,46,0); } }
.hint { font-size: 13px; }
.dir-btn { border-radius: 6px; border: 1px solid var(--line-2); box-shadow: none; font-weight: 500; padding: 12px 8px; }
.dir-btn:hover:not(:disabled) { border-color: var(--text); }
.dir-btn.sel { background: var(--green); border-color: var(--green); color: #fff; box-shadow: none; }
.dir-btn.armed { border-color: #f0b14a; background: #fffaeb; }
.btn { border-radius: 6px; font-weight: 500; border-color: var(--line-2); box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
.btn.primary:hover { background: #1e40af; filter: none; }
.btn.ghost:hover { background: var(--surface-2); }

/* measurements */
.tiles { gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tile { background: var(--surface); border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 12px 14px; }
.tile:last-child { border-right: 0; }
.t-label { font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.t-val { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.t-note { font-size: 11px; }
@media (max-width: 1050px) { .tile { border-bottom: 1px solid var(--line); } .tile:nth-child(3n) { border-right: 0; } }
@media (max-width: 520px)  { .tile:nth-child(3n) { border-right: 1px solid var(--line); } .tile:nth-child(2n) { border-right: 0; } }

/* charts */
.bars { height: 140px; border-bottom-color: var(--line-2); }
.bar { background: var(--accent); border-radius: 2px 2px 0 0; max-width: 36px; }
#chartRec .bar { background: #475467; }
.bar .bl { font-size: 10.5px; color: var(--text-2); }
.tip { border-radius: 4px; background: var(--ink); }

/* queue */
.queue h2 .muted { flex-basis: 100%; }
.qrow { grid-template-columns: 44px 1fr auto; gap: 8px; margin: 14px 0; font-size: 13px; font-weight: 500; }
.qtrack { height: 8px; border-radius: 2px; background: #eceef2; }
.qfill { background: #64748b; border-radius: 2px; transition: width .4s; }
.qfill.q { background: #f59e0b; }
.qthr { background: var(--text); width: 1.5px; }
.qval { min-width: 52px; display: grid; justify-items: end; line-height: 1.2; font-variant-numeric: tabular-nums; }
.qtag { margin: 2px 0 0; border-radius: 3px; background: #fef0c7; color: #93370d; }
#queueRows p { margin: 14px 0 0; }

/* event log */
th { background: var(--surface-2); font-size: 11px; font-weight: 600; letter-spacing: .05em; }
th, td { padding: 8px 10px; }
tbody tr:hover { background: var(--surface-2); }
.k-cmd { color: var(--accent); }

/* intersection map */
#map { max-height: 400px; border-radius: 6px; background: #3d434b; }
#map .tree { transform-box: fill-box; transform-origin: center; animation: sway 7s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
#map .amb > g { transform: translateY(50px); }
#map .amb-wait > g { animation: ambIn 1.8s cubic-bezier(.2,.7,.2,1) both; }
#map .amb-back > g { animation-name: ambInBack; }
#map .amb-go > g { animation: ambGo 3.6s linear infinite; }
@keyframes ambIn { from { transform: translateY(-70px); } to { transform: translateY(50px); } }
@keyframes ambInBack { from { transform: translateY(-120px); } to { transform: translateY(-48px); } }
@keyframes ambGo { from { transform: translateY(-60px); } to { transform: translateY(340px); } }
#map .lb1 { animation: flashA .5s steps(1) infinite; } #map .lb2 { animation: flashA .5s steps(1) infinite reverse; }
@keyframes flashA { 0% { opacity: 1; } 50% { opacity: .15; } }

/* messages */
.chat-list { border: 1px solid var(--line); border-radius: 6px; background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23334155' stroke-opacity='.07' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 14h8v8h8v8h-8v8h-8v-8h-8v-8h8z'/%3E%3Cpath d='M6 92h20l6-12 8 24 6-12h22'/%3E%3Cpath d='M128 92a10 10 0 0 0-10 10c0 8 10 18 10 18s10-10 10-18a10 10 0 0 0-10-10z'/%3E%3Ccircle cx='128' cy='102' r='3'/%3E%3Cpath d='M70 132h26v-12h10l8 8v4h4M70 132v-16h26'/%3E%3Ccircle cx='78' cy='136' r='3'/%3E%3Ccircle cx='108' cy='136' r='3'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 160px 160px repeat, #f3f4f6; }
.bubble { border-radius: 8px 8px 8px 2px; border-color: var(--line); box-shadow: none; }
.msg.me .bubble { background: var(--accent); border-color: var(--accent); border-radius: 8px 8px 2px 8px; box-shadow: none; }
.avatar { border-radius: 4px; }
.day { border-radius: 4px; border: 1px solid var(--line); background: var(--surface); }
.qbtn { border-radius: 4px; font-weight: 500; }
.qbtn:hover { border-color: var(--text); }
.qbtn.loc { background: var(--surface); border-color: var(--line-2); color: var(--accent); }
.chat-form input, .login-card input { border-radius: 6px; }
.chat-form input:focus, .login-card input:focus { outline: 2px solid #bfd0f5; border-color: var(--accent); }

/* hospitals, call centre */
.hmap, .hosp { border-radius: 6px; }
.hosp:hover { border-color: var(--line-2); box-shadow: none; }
.call-photo { background: linear-gradient(180deg, rgba(17,24,39,0) 40%, rgba(17,24,39,.6)), url("hospital.jpg") center 45% / cover no-repeat, var(--ink); }
.call-btn { border-radius: 6px; background: var(--green); box-shadow: none; }
.call-btn.red { background: var(--red); box-shadow: none; }
.call-btn:hover { filter: brightness(1.06); }

/* login */
.login-photo { background: linear-gradient(180deg, rgba(17,24,39,.35) 0%, rgba(17,24,39,.9) 100%), url("hospital.jpg") center / cover no-repeat, var(--ink); }
.logo { background: var(--red); }

/* sheets, banners */
.pending-banner { border-radius: 6px; }
.sheet h4 { color: var(--text-2); }

@media (max-width: 1050px) {
  .control, .inter { grid-column: span 6; }
  .queue, .chart { grid-column: span 12; }
}
@media (max-width: 720px) {
  .control, .inter, .queue { grid-column: span 12; }
  .topbar, .hero-text { padding-left: 14px; padding-right: 14px; }
  .tabs { width: 100%; padding: 0 8px; overflow-x: auto; }
  .tab { padding: 11px 10px 9px; }
  .status { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
  #map .amb-go > g { animation: none !important; transform: translateY(50px); }
}

/* ---------- v3: other pages (2026-12-07) ---------- */
.login-photo-text h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -.015em; }
.login-photo-text p { font-size: 15px; opacity: .85; }
.login-kicker { margin: 0 0 6px !important; font-size: 12px !important; font-weight: 500; color: #c3cad4; opacity: 1 !important; }
.badge-live { display: none; }
.hosp .ht { border-radius: 3px; font-weight: 600; letter-spacing: .03em; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.ht.gov, .ht.pvt, .ht.mil { background: var(--surface-2); color: var(--text-2); }
.ht.gov { color: var(--text); }
.hosp { border-color: var(--line); }
.call-title { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.call-ico { flex-basis: 36px; width: 36px; height: 36px; border-radius: 4px; background: rgba(255,255,255,.14); font-size: 12px; }
.call-btn { padding: 13px 16px; }
.call-btn b { font-size: 15px; font-weight: 600; }
.call-btn.ghostc { border: 1px solid var(--line-2); }
.call-btn.ghostc .call-ico { background: var(--surface-2); }
.cond { border-radius: 6px; font-weight: 500; border: 1px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.cond::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.cond.red::before { background: #c8102e; } .cond.amber::before { background: #f59e0b; } .cond.green::before { background: #047857; }
.cond.red.sel { background: #fef3f2; border-color: #c8102e; color: #912018; }
.cond.amber.sel { background: #fffaeb; border-color: #f59e0b; color: #93370d; }
.cond.green.sel { background: #ecfdf3; border-color: #047857; color: #05603a; }
.psm-note { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--text); color: var(--text); border-radius: 4px; }
.psm-note b { font-weight: 600; }
.disclaimer { border-radius: 4px; background: #fffaeb; border-color: #fbe3a8; color: #93370d; }
.mact { border-radius: 4px; }
.ack { border-radius: 4px; }

/* ---------- v3: login without photo (2026-12-07) ---------- */
.login { grid-template-columns: 1fr; background: linear-gradient(var(--ink) 0 240px, var(--bg) 240px); align-content: start; padding: 72px 16px 40px; }
.login-photo { display: none; }
.login-side { padding: 0; }
.login-card { max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px 28px 20px; animation: none; }
.login-card .brand.big { font-size: 18px; font-weight: 600; }
.login-card > .muted:first-of-type { margin: 6px 0 0; font-size: 13.5px; }
.login-card form { gap: 12px; margin: 20px 0 14px; }
.login-card label { font-weight: 500; }
.login-card input, .login-card select { padding: 10px 12px; border-radius: 6px; border-color: var(--line-2); }
.login-card .btn.block { padding: 11px; }
.login-card .err:empty { display: none; }
.login-card p.small { margin: 0; }
.login-card > .tiny { margin: 16px -28px 0; padding: 14px 28px 0; border-top: 1px solid var(--line); line-height: 1.6; }
@media (max-width: 860px) { .login { padding-top: 40px; background: linear-gradient(var(--ink) 0 180px, var(--bg) 180px); } }

/* =====================================================================
   v4 (2026-12-07): road-sign identity.
   Header is a road direction sign (JKR blue, white inset border).
   Type: Overpass, a highway-sign family. Colours come from road signs,
   signal lamps and road paint; nothing is decorative.
   ===================================================================== */
:root {
  --sign: #1B4F9C;
  --ink: #1A2230;
  --navy: #1A2230;
  --text: #1A2230;
  --text-2: #586374;
  --bg: #E9ECEF;
  --line: #D9DEE4;
  --line-2: #C3CAD3;
  --accent: #1B4F9C;
  --red: #D21F2B;
  --red-2: #A8161F;
  --green: #1E9E5A;
  --paint: #F2A900;
  --font: "Overpass", "Segoe UI", Roboto, system-ui, sans-serif;
}
html, body { font: 15px/1.5 var(--font); background: var(--bg); }
h2, .card h2 { font-size: 16px; font-weight: 700; letter-spacing: 0; }

/* the sign */
.hero { position: relative; background: var(--sign); transition: background-color .5s ease; }
.hero::before { content: ""; position: absolute; inset: 7px; border: 2px solid rgba(255,255,255,.92); border-radius: 10px; pointer-events: none; }
body.emg .hero { background: #B3121F; }
.topbar { padding: 16px 28px 6px; }
.hero-text { padding: 0 28px 20px; }
.brand { font-size: 19px; font-weight: 800; letter-spacing: .005em; }
.logo { width: 20px; height: 28px; background: none !important; border-radius: 0; box-shadow: none; }
.logo svg { width: 20px; height: 28px; }
.hero-sub { font-size: 15px; font-weight: 600; color: #fff; }
.hero-sub b { font-weight: 800; }
.eyebrow, .hero-who { color: rgba(255,255,255,.78); font-size: 13px; }
.hero-who b { color: #fff; }
.hero .pill, .btn.glass, .profile-btn { border-color: rgba(255,255,255,.45); color: #fff; background: rgba(255,255,255,.08); }
.pav { background: #fff; color: var(--sign); }

/* tabs */
.tab { font-size: 14.5px; font-weight: 600; }
.tab.active { font-weight: 800; border-bottom-color: var(--paint); border-bottom-width: 3px; }

/* labels in sentence case, never tracked caps */
.chip, th, .status > h2, .hosp .ht, .bubble .who .r, .t-label { text-transform: none; letter-spacing: 0; }
.status > h2 { font-size: 14px; font-weight: 800; color: var(--text); }
th { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.chip { font-size: 12px; }

/* "Now" line: one lamp chip per approach */
.phases { display: flex; gap: 4px; }
.ph { min-width: 30px; padding: 3px 0 1px; text-align: center; border-radius: 3px; font-weight: 800; font-size: 13px; color: #fff; background: #B8C0CA; transition: background-color .3s; }
.ph.r { background: var(--red); } .ph.y { background: var(--paint); color: var(--ink); } .ph.g { background: var(--green); }

/* panels */
.card { border-color: var(--line); border-radius: 6px; }
.t-val { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.emg-btn .emg-label { font-weight: 800; letter-spacing: .06em; }
.emg-btn { border-width: 2px; }
.btn.primary { background: var(--sign); border-color: var(--sign); }
.btn.primary:hover { background: #163f7d; }
.dir-btn { font-weight: 700; }
.bar { background: var(--sign); }
.qfill.q { background: var(--paint); }
.msg.me .bubble { background: var(--sign); border-color: var(--sign); }
#map .tree { animation: none; }

/* login: same sign */
.login { background: linear-gradient(var(--sign) 0 240px, var(--bg) 240px); }
@media (max-width: 860px) { .login { background: linear-gradient(var(--sign) 0 180px, var(--bg) 180px); } }
.login-card .brand.big { font-size: 20px; font-weight: 800; }

@media (max-width: 720px) {
  .topbar { padding: 14px 18px 6px; }
  .hero-text { padding: 0 18px 18px; }
}
#map { background: #C9CFD7; border: 1px solid var(--line-2); }
/* =====================================================================
   v5 (2026-12-07): soft cards, after the reference Khalees sent.
   Warm greige page, one white rounded frame, icon rail on the left,
   beige cards with large radii, white pills, dark pill buttons.
   Red, amber and green still only mean signal and alert states.
   ===================================================================== */
:root {
  --page: #D8D2C6;
  --frame: #FFFFFF;
  --bg: #FFFFFF;
  --surface: #EDE9E2;
  --surface-2: #F6F3EE;
  --line: #E2DDD4;
  --line-2: #CFC8BC;
  --ink: #2B2A28;
  --navy: #2B2A28;
  --text: #2B2A28;
  --text-2: #7A746A;
  --accent: #2B2A28;
  --sign: #2B2A28;
  --red: #D0342C;
  --red-2: #A9271F;
  --green: #3E9B63;
  --paint: #E0A526;
  --radius: 24px;
  --soft: 0 2px 10px rgba(60, 50, 35, .08);
  --font: "Manrope", "Segoe UI", Roboto, system-ui, sans-serif;
}
html, body { background: var(--page); font: 14.5px/1.5 var(--font); color: var(--text); }
h2, .card h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }

/* the frame and the icon rail */
#app:not(.hidden) { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; max-width: 1480px; margin: 28px auto; background: var(--frame); border-radius: 40px; padding: 18px 26px 26px 8px; min-height: calc(100vh - 56px); box-shadow: 0 30px 60px rgba(60, 50, 35, .12); transition: box-shadow .4s; }
body.emg #app:not(.hidden) { box-shadow: 0 0 0 3px var(--red), 0 30px 60px rgba(60, 50, 35, .12); }
#app > * { grid-column: 2; }
#app > .tabs { grid-column: 1; grid-row: 1 / span 30; position: sticky; top: 18px; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 0; width: auto; max-width: none; margin: 0; padding: 14px 0; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; min-height: calc(100vh - 110px); }
.rail-logo { width: 34px; height: 46px; margin: 2px 0 64px; }
.rail-logo svg { width: 100%; height: 100%; display: block; }
.tabs .tab { position: relative; flex: 0 0 auto; width: 52px; height: 52px; padding: 0; margin: 6px 0; border: 0; border-radius: 50%; justify-content: center; color: #8C867C; background: none; }
.tabs .tab + .tab::before { content: ""; position: absolute; top: -7px; left: 14px; right: 14px; height: 1px; background: var(--line); }
.tabs .tab .tl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabs .tab svg { display: block; width: 24px; height: 24px; fill: currentColor; }
.tabs .tab:hover { background: var(--surface-2); color: var(--text); }
.tabs .tab.active { background: var(--surface); color: var(--text); border: 0; box-shadow: none; }
.tabs .tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tab-badge { position: absolute; top: 4px; right: 2px; border-radius: 99px; background: var(--red); color: #fff; }

/* top bar inside the frame */
.hero { background: none; color: var(--text); padding: 0; overflow: visible; }
.hero::before, .hero-bg, .hero .credit, .hero-text { display: none; }
body.emg .hero { background: none; }
.topbar { max-width: none; padding: 6px 0 16px; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.brand .logo { display: none; }
.hero .pill, .pill { background: var(--surface-2); border: 0; color: var(--text); border-radius: 99px; font-weight: 600; padding: 7px 13px; box-shadow: none; }
.btn.glass, .profile-btn { background: var(--surface-2); border: 0; color: var(--text); border-radius: 99px; }
.btn.glass:hover, .profile-btn:hover { background: var(--surface); }
.profile-btn { padding: 4px 14px 4px 4px; }
.pav { border-radius: 50%; width: 34px; height: 34px; background: var(--ink); color: #fff; font-size: 12px; }
.pav.sm { background: var(--ink); }

/* panels and cards */
.panel { max-width: none; padding: 0; }
.grid { gap: 18px; }
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 22px 24px; box-shadow: none; }
.card-head { margin-bottom: 14px; }
.chip { background: var(--frame); border: 0; border-radius: 99px; padding: 4px 11px; font-weight: 600; box-shadow: var(--soft); }
.btn { border-radius: 99px; border: 0; background: var(--frame); color: var(--text); font-weight: 600; padding: 9px 16px; box-shadow: var(--soft); }
.btn.primary, .btn.dark { background: var(--ink); color: #fff; box-shadow: 0 6px 14px rgba(43, 42, 40, .22); }
.btn.primary:hover, .btn.dark:hover { background: #45433F; }
.btn.ghost { background: var(--frame); }
.btn.wide { width: 100%; padding: 13px 16px; font-size: 14.5px; }

/* row 1: intersection hero + approaches; row 2: control, queue, measurements */
.inter   { grid-column: span 8; position: relative; padding: 0; overflow: hidden; min-height: 440px; }
.status  { grid-column: span 4; display: flex; flex-direction: column; align-items: stretch; padding: 22px 22px 22px; }
.control { grid-column: span 4; }
.queue   { grid-column: span 4; }
.kpis    { grid-column: span 4; }
.chart   { grid-column: span 6; }
.log, .users { grid-column: span 12; }

/* intersection as the hero picture, with pills on top */
#map { display: block; position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; background: #CFC9BF; }
.inter #modePill { position: absolute; top: 18px; left: 18px; background: var(--frame); box-shadow: var(--soft); }
.inter #modePill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #A69F93; }
.inter #modePill.m0, .inter #modePill.m2 { background: var(--frame); color: var(--text); } .inter #modePill.m0::before { background: var(--green); }
.inter #modePill.m1 { background: var(--red); color: #fff; } .inter #modePill.m1::before { background: #fff; animation: blink 1s steps(1) infinite; }
.inter #modePill.m2::before { background: var(--paint); }
@keyframes blink { 50% { opacity: .2; } }
.ov-tr { position: absolute; top: 18px; right: 18px; display: flex; gap: 8px; }
.ochip { background: rgba(255, 255, 255, .92); border-radius: 99px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; box-shadow: var(--soft); }
.ov-bl { position: absolute; left: 18px; bottom: 16px; background: rgba(255, 255, 255, .92); border-radius: 18px; padding: 10px 16px; box-shadow: var(--soft); max-width: calc(100% - 36px); }
.ov-bl h2 { margin: 0; font-size: 17px; }
.ov-bl #devName { font-weight: 600; color: var(--text-2); }
.ov-bl p { margin: 0; font-size: 12.5px; color: var(--text-2); }

/* approaches list, like a room list */
.status .card-head { margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.appr-list { display: grid; gap: 8px; }
.appr { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; padding: 7px 14px 7px 7px; border-radius: 99px; transition: background-color .3s, box-shadow .3s; }
.appr.act { background: var(--frame); box-shadow: var(--soft); }
.appr-ic { width: 46px; height: 46px; border-radius: 50%; background: var(--frame); display: grid; place-content: center; gap: 2px; grid-auto-flow: row; }
.appr.act .appr-ic { background: var(--surface-2); }
.appr-ic i { width: 8px; height: 8px; border-radius: 50%; background: #D5CFC5; display: block; }
.appr-ic i.on:nth-child(1) { background: var(--red); } .appr-ic i.on:nth-child(2) { background: var(--paint); } .appr-ic i.on:nth-child(3) { background: var(--green); }
.appr-t { display: grid; line-height: 1.25; }
.appr-t b { font-size: 14.5px; font-weight: 700; }
.appr-t small { font-size: 12.5px; color: var(--text-2); }
.appr-chev { width: 8px; height: 8px; border-right: 2px solid #9A938A; border-top: 2px solid #9A938A; transform: rotate(45deg); margin-right: 4px; }
.appr:not(.act) .appr-chev { opacity: .5; }
.appr-tag { background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.status .status-text { margin: 14px 4px 14px; font-size: 13px; font-weight: 500; color: var(--text-2); flex: 0 0 auto; }
.status #toChat { margin-top: auto; }

/* emergency control: one big round button, direction pills under it */
.control { display: flex; flex-direction: column; }
.emg-btn { width: 200px; height: 200px; margin: 6px auto 16px; border-radius: 50%; padding: 0; display: grid; place-content: center; gap: 2px; background: var(--frame); color: var(--red); border: 0; box-shadow: 0 0 0 10px var(--surface-2), 0 0 0 11px var(--line-2), var(--soft); }
.emg-btn:hover:not(:disabled) { background: #FFF8F6; }
.emg-btn .emg-label { font-size: 21px; font-weight: 800; letter-spacing: .04em; }
.emg-btn .emg-sub { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.emg-btn.on { background: var(--red); color: #fff; box-shadow: 0 0 0 10px #F6D9D6, 0 0 0 11px #E9B3AE; animation: ring5 1.6s infinite; }
.emg-btn.on .emg-sub { color: rgba(255, 255, 255, .88); }
@keyframes ring5 { 0%, 100% { box-shadow: 0 0 0 10px #F6D9D6, 0 0 0 11px #E9B3AE; } 50% { box-shadow: 0 0 0 16px #F9E6E4, 0 0 0 17px #F1CBC7; } }
.hint { text-align: center; font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.dirs { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dir-btn { border-radius: 99px; border: 0; background: var(--frame); box-shadow: var(--soft); font-weight: 700; padding: 11px 4px; font-size: 13px; }
.dir-btn:hover:not(:disabled) { background: var(--surface-2); }
.dir-btn.sel { background: var(--green); color: #fff; }
.dir-btn.armed { background: #FFF4DC; }
.control #lastCmd { text-align: center; margin-top: auto; padding-top: 10px; }

/* queue: the darker card, pill sliders */
.queue { background: #6E655A; color: #fff; }
.queue h2 { color: #fff; }
.queue h2 .muted { color: rgba(255, 255, 255, .7); flex-basis: 100%; font-size: 12.5px; font-weight: 500; }
.queue .qrow { grid-template-columns: 1fr; gap: 6px; margin: 14px 0; }
.queue .qrow > span:first-child { font-weight: 700; font-size: 13.5px; }
.queue .qtrack { height: 40px; border-radius: 99px; background: rgba(255, 255, 255, .16); }
.queue .qfill { background: var(--frame); border-radius: 99px; }
.queue .qfill.q { background: var(--paint); }
.queue .qthr { background: rgba(255, 255, 255, .7); width: 2px; }
.queue .qval { margin-top: -38px; height: 36px; padding: 0 16px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--text); font-weight: 700; pointer-events: none; position: relative; }
.queue .qtag { margin: 0; background: var(--ink); color: #fff; border-radius: 99px; padding: 2px 9px; }
.queue #queueRows p { color: rgba(255, 255, 255, .7); }

/* measurements: a dial */
.dialwrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 6px 0 16px; }
.side { display: grid; line-height: 1.2; } .side.r { text-align: right; }
.side small { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.side b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.side .tiny { font-size: 11px; }
.dial { --p: 0; position: relative; width: 196px; height: 196px; border-radius: 50%; display: grid; place-items: center; }
.dial::before { content: ""; position: absolute; inset: 0; border-radius: 50%; -webkit-mask: radial-gradient(circle, transparent 0 84px, #000 85px 97px, transparent 98px); mask: radial-gradient(circle, transparent 0 84px, #000 85px 97px, transparent 98px); background: conic-gradient(from -135deg, transparent 0 270deg, var(--surface) 270deg), repeating-conic-gradient(from -135deg, #8E877C 0 1.4deg, transparent 1.4deg 9deg); }
.dial::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: conic-gradient(from -135deg, var(--ink) calc(var(--p) * 270deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 0 77px, #000 78px 83px, transparent 84px); mask: radial-gradient(circle, transparent 0 77px, #000 78px 83px, transparent 84px); transition: --p .6s; }
.dial-in { position: relative; z-index: 1; width: 138px; height: 138px; border-radius: 50%; background: var(--frame); box-shadow: 0 0 0 10px rgba(255, 255, 255, .55), 0 10px 24px rgba(60, 50, 35, .14); display: grid; place-content: center; text-align: center; line-height: 1.15; }
.dial-in b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dial-in small { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.dmin, .dmax { position: absolute; bottom: 8px; font-size: 11px; color: var(--text-2); font-weight: 600; }
.dmin { left: 8px; } .dmax { right: 4px; }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { background: var(--frame); border-radius: 18px; padding: 10px 12px; display: grid; line-height: 1.25; box-shadow: var(--soft); }
.mini small { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.mini b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* charts and log */
.bars { border-bottom-color: var(--line-2); }
.bar, #chartRec .bar { background: var(--ink); border-radius: 6px 6px 0 0; }
#chartRec .bar { background: #8E877C; }
.table-wrap { background: var(--frame); border-radius: 16px; border: 0; }
th { background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }

/* other pages */
.chat-list { border: 0; border-radius: 18px; background-color: var(--surface-2); }
.bubble { background: var(--frame); border-radius: 18px 18px 18px 6px; border: 0; box-shadow: var(--soft); }
.msg.me .bubble { background: var(--ink); border-radius: 18px 18px 6px 18px; }
.qbtn { border-radius: 99px; border: 0; background: var(--frame); box-shadow: var(--soft); }
.qbtn.loc { background: var(--frame); color: var(--text); }
.chat-form input, .login-card input, .login-card select, .add-id input, .add-id select { border-radius: 99px; border: 0; background: var(--frame); box-shadow: inset 0 0 0 1px var(--line-2); padding-left: 18px; }
.chat-form input:focus, .login-card input:focus { outline: 2px solid var(--ink); }
.hmap, .hosp { border-radius: 18px; border: 0; }
.hosp { background: var(--frame); }
.call-photo { border-radius: 18px; }
.call-btn { border-radius: 99px; }
.pending-banner { border-radius: 18px; }
.sheet { border-radius: 28px 0 0 28px; }

/* login: same frame */
.login { background: var(--page); padding: 72px 16px 40px; }
.login-card { background: var(--frame); border: 0; border-radius: 32px; box-shadow: 0 30px 60px rgba(60, 50, 35, .12); }
.login-card .btn.primary { width: 100%; }
.login .logo { display: inline-block; }

/* tablet and phone: no frame, rail becomes a bottom bar */
@media (max-width: 1100px) {
  .inter, .status { grid-column: span 12; }
  .control, .queue { grid-column: span 6; }
  .kpis { grid-column: span 12; }
}
@media (max-width: 820px) {
  #app:not(.hidden) { display: block; margin: 0; border-radius: 0; padding: 12px 14px 96px; min-height: 100vh; box-shadow: none; }
  body.emg #app:not(.hidden) { box-shadow: inset 0 0 0 3px var(--red); }
  #app > .tabs { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; z-index: 950; flex-direction: row; justify-content: space-around; min-height: 0; padding: 6px; background: var(--frame); border-radius: 99px; box-shadow: 0 10px 30px rgba(60, 50, 35, .22); }
  .rail-logo { display: none; }
  .tabs .tab { margin: 0; width: 50px; height: 50px; }
  .tabs .tab + .tab::before { display: none; }
  .control, .queue, .chart { grid-column: span 12; }
  .inter { min-height: 0; }
  #map { position: static; height: auto; aspect-ratio: 1 / 1; }
  .ov-tr { display: none; }
  .top-right { gap: 8px; } #connText { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .topbar { padding: 4px 2px 14px; }
  .brand { font-size: 19px; }
}
@media (max-width: 420px) {
  .dial { width: 168px; height: 168px; }
  .dialwrap { grid-template-columns: 1fr 1fr; } .dial { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}


/* ---------- v5: profile laid out like a social profile (2026-12-07) ---------- */
.sheet { background: var(--frame); padding: 16px 22px 30px; }
.sheet-head { background: var(--frame); }
.sheet-head .btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.ig-head { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 18px; margin: 6px 0 12px; }
.ig-av { width: 92px; height: 92px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 30px; font-weight: 800; box-shadow: 0 0 0 4px var(--frame), 0 0 0 6px var(--line-2); }
.ig-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.ig-stat b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ig-stat small { font-size: 12.5px; color: var(--text-2); }
.ig-name { font-size: 17px; font-weight: 800; }
.ig-name input { font: inherit; font-size: 15px; font-weight: 600; padding: 6px 12px; border: 0; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line-2); width: 60%; }
.ig-sub { font-size: 13.5px; color: var(--text-2); margin: 1px 0 14px; }
.ig-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 18px; }
.ig-btns .btn { background: var(--surface); box-shadow: none; padding: 9px 10px; font-weight: 700; }
.ig-btns .btn:hover { background: var(--line); }
.ig-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); position: sticky; top: 40px; background: var(--frame); z-index: 1; margin: 0 -22px; padding: 0 22px; }
.ig-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 0 10px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.ig-tabs button svg { width: 18px; height: 18px; fill: currentColor; }
.ig-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.ig-tabs button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.ig-pane { padding-top: 14px; }
.ig-pane .kvs, .sheet .about .kvs { margin-top: 0; }
.sheet .kv { border-bottom: 1px solid var(--line); padding: 10px 0; }
.sheet .kv:last-child { border-bottom: 0; }
.ig-pane[data-p="project"] .psm-note { margin-bottom: 10px; }
.sheet h4 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); margin: 18px 0 6px; }
.ig-pane[data-p="about"] > h4:first-child { margin-top: 2px; }
.sheet-bg { z-index: 990; } .sheet { z-index: 991; }
.ig-pane[data-p="project"] .kv { flex-direction: column; gap: 1px; }
.ig-pane[data-p="project"] .kv > b { text-align: left; }

/* ---------- v5: login as a two-panel card, photo left (2026-12-07) ---------- */
.login:not(.hidden) { min-height: 100vh; display: grid; place-items: center; grid-template-columns: minmax(0, 1100px); justify-content: center; padding: 40px 20px; align-content: center; background: var(--page); }
.login:not(.hidden) { grid-template-areas: "card"; }
.login-photo, .login-side { grid-area: card; }
.login:not(.hidden) .login-photo { display: block; align-self: stretch; justify-self: start; width: calc(50% - 30px); margin: 26px 0 26px 26px; border-radius: 24px; min-height: 560px; z-index: 1; background: #E6E6E4 url("login-intersection.webp") 58% 62% / cover no-repeat; }
.login-side { width: 100%; background: var(--frame); border-radius: 40px; padding: 26px 26px 26px calc(50% + 10px); box-shadow: 0 30px 60px rgba(40, 40, 40, .10); display: grid; place-items: center; min-height: 612px; }
.login-card { max-width: 420px; width: 100%; background: none; box-shadow: none; border: 0; border-radius: 0; padding: 24px 10px; text-align: left; animation: none; }
.login-card .brand.big { justify-content: center; font-size: 18px; font-weight: 700; gap: 10px; }
.login-card .brand.big .logo { width: 22px; height: 30px; }
.login-title { margin: 22px 0 4px; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.login-card > .login-sub { margin: 0; text-align: center; font-size: 14px; color: var(--text-2); }
.login-card form { gap: 16px; margin: 28px 0 14px; }
.login-card label { gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.login-card input, .login-card select { padding: 13px 18px; font-size: 14.5px; color: var(--text); background: var(--frame); border: 0; border-radius: 99px; box-shadow: inset 0 0 0 1px #D9D6D0; }
.login-card input:focus, .login-card select:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.login-card .btn.primary { padding: 14px; font-size: 15px; font-weight: 700; margin-top: 4px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#emailMode { display: block; padding: 13px; border-radius: 99px; background: #EEEDEB; color: var(--text); font-size: 14.5px; font-weight: 700; text-decoration: none; }
#emailMode:hover { background: #E4E2DE; }
.login-card #idHelp, .login-card #toggleRow { font-size: 13px; }
.login-card > .tiny { border-top: 0; margin: 10px 0 0; padding: 0; text-align: center; }
@media (max-width: 860px) {
  .login:not(.hidden) { padding: 0; place-items: stretch; background: var(--frame); }
  .login:not(.hidden) .login-photo { width: auto; margin: 12px 12px 0; min-height: 0; height: 240px; align-self: start; justify-self: stretch; border-radius: 22px; background-position: 50% 62%; }
  .login-side { border-radius: 0; box-shadow: none; padding: 252px 16px 24px; min-height: 100vh; align-items: start; }
  .login-card { padding: 18px 6px; }
  .login-title { font-size: 23px; margin-top: 16px; }
}

/* ---------- v9: project title, ambulance direction line, green/red emergency button, avatar (2026-12-07) ---------- */
.brand .app-name { font-size: 17px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; max-width: 560px; }
.login-card .brand.big .app-name { font-size: 17px; text-align: center; max-width: 340px; }
#map { background: #596068; }
.inter #map { bottom: 52px; height: calc(100% - 52px); }
.amb-from { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--frame); font-size: 15px; font-weight: 700; color: var(--text-2); border-top: 1px solid var(--line); }
.amb-from i { width: 10px; height: 10px; border-radius: 50%; background: #A69F93; flex: none; }
.amb-from.wait { color: #A3580B; } .amb-from.wait i { background: #E08A00; }
.amb-from.on { background: var(--red); color: #fff; border-top-color: var(--red); }
.amb-from.on i { background: #fff; animation: blink 1s steps(1) infinite; }
.emg-btn, .emg-btn:hover:not(:disabled) { background: #1E9E5A; color: #fff; box-shadow: 0 0 0 10px #DCEFE3, 0 0 0 11px #B9DEC8; }
.emg-btn .emg-sub { color: rgba(255, 255, 255, .9); }
.emg-btn.on, .emg-btn.on:hover:not(:disabled) { background: var(--red); color: #fff; box-shadow: 0 0 0 10px #F6D9D6, 0 0 0 11px #E9B3AE; }
.emg-btn.on .emg-sub { color: rgba(255, 255, 255, .9); }
@media (hover: hover) { .emg-btn:hover:not(:disabled) { filter: brightness(1.06); } }
.emg-btn:disabled { background: #B9C2BC; box-shadow: none; }
.pav img, .ig-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.pav { overflow: hidden; }
.ig-av { position: relative; cursor: pointer; overflow: visible; }
.ig-av img { border-radius: 50%; }
.ig-cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--frame); box-shadow: var(--soft); display: grid; place-items: center; }
.ig-cam svg { width: 16px; height: 16px; fill: var(--ink); }
.linkbtn { background: none; border: 0; padding: 4px 0; margin: 2px 0 0; font: inherit; font-size: 13px; color: var(--text-2); text-decoration: underline; cursor: pointer; }
.how li { margin-bottom: 6px; }
@media (max-width: 860px) {
  .brand .app-name { font-size: 16px; }
  .inter #map { bottom: auto; height: auto; }
  .amb-from { position: static; }
}

/* v10: profile photos in chat */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* v11: justified text + admin text editing */
.ig-pane .cms p, .ig-pane .psm-note, .ig-pane .how li, .ig-pane .disclaimer,
.sheet .about p, .sheet .about .psm-note, .sheet .about .how li, .sheet .about .disclaimer {
  text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto;
}
.cms-bar { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.cms.editing { outline: 2px dashed #1B4F9C; outline-offset: 6px; border-radius: 4px; background: #fff; caret-color: #1B4F9C; }
.cms.editing:focus { outline-style: solid; }

/* v12 approval notice */
.pending-banner.ok { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.pending-banner .btn { margin-left: 8px; vertical-align: middle; }

/* v13 waiting for approval */
.wait-box { display: grid; gap: 12px; margin-top: 8px; }
.wait-box .btn.block { width: 100%; }
.wait-id { display: grid; gap: 4px; text-align: center; padding: 18px; border-radius: 18px; background: #EDE9E2; font-size: 14px; color: #5f5a52; }
.wait-id b { font-size: 34px; letter-spacing: 0.12em; color: #2B2A28; font-variant-numeric: tabular-nums; }
.mail-set { margin-top: 16px; padding: 12px 14px; border-radius: 16px; background: #EDE9E2; }
.mail-set summary { cursor: pointer; font-weight: 600; }
.mail-set label { display: grid; gap: 4px; margin-top: 10px; font-size: 13px; }
