/* Rounds: HHN Vitals look on a dispatch board. Calm, flat, one job per screen. Light first. */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; cursor: default; }
a { color: var(--link); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.6rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select, textarea { cursor: text; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.45rem 0.6rem; width: 100%; }
select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; cursor: pointer; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 0.85rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 0.5rem; z-index: 50; }
.skip:focus { left: 8px; }
.hidden { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { background: var(--navy); color: #DCE8F5; display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #FFFFFF; text-decoration: none; font-weight: 600; font-size: 1.1rem; padding: 4px 8px 16px; }
.brand img { border-radius: 8px; }
.rail nav, .rail #nav { display: flex; flex-direction: column; gap: 2px; }
.rail a.nav { display: flex; align-items: center; gap: 10px; color: #C9D9EA; text-decoration: none; padding: 8px 10px; border-radius: var(--radius); font-weight: 500; cursor: pointer; }
.rail a.nav:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }
.rail a.nav.on { background: rgba(58, 193, 198, 0.18); color: #FFFFFF; box-shadow: inset 3px 0 0 var(--teal); }
.rail a.nav svg { width: 18px; height: 18px; flex: none; }
.rail .sect { margin: 14px 10px 4px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7FA0C4; }
.rail-foot { margin-top: auto; padding: 10px; font-size: 0.85rem; color: #B6C6DA; }
.rail-foot .who { color: #FFFFFF; font-weight: 500; }
.rail-foot button { background: none; border: 1px solid rgba(255, 255, 255, 0.25); color: #DCE8F5; border-radius: var(--radius); padding: 4px 10px; margin-top: 8px; margin-right: 6px; }
.page { min-width: 0; }
#main { padding: 20px 24px 40px; }
#banner:empty { display: none; }
.banner { padding: 8px 24px; font-size: 0.9rem; background: var(--warn-tint); color: var(--warn-text); border-bottom: 1px solid var(--line); }
.banner.hold { background: var(--wait-tint); color: var(--wait-text); }

/* header rows */
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.head .grow { flex: 1; }
.datebar { display: inline-flex; align-items: center; gap: 4px; }
.datebar input[type="date"] { width: 11.5rem; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); border-radius: var(--radius); padding: 0.45rem 0.85rem; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.pri:hover { background: var(--pri-hover); border-color: var(--pri-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.btn.bad { color: var(--bad-text); border-color: var(--bad); }
.btn.sm { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }

/* instrument tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.tile .lbl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.tile .val { font-family: var(--mono); font-size: 1.5rem; font-weight: 500; line-height: 1.2; margin-top: 2px; }
.tile .sub { font-size: 0.8rem; color: var(--muted); }
.tile.bad .val { color: var(--bad-text); }
.tile.ok .val { color: var(--ok-text); }

/* board */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.board.nomap { grid-template-columns: 1fr; }
.lanes { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.lane.full { border-color: var(--warn); }
.lane-head { padding: 10px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.lane-head .name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.lane-head .facts { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.gauge { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.gauge > i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.gauge.over > i { background: var(--warn); }
.chip { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; }
.chip.rn { background: var(--rn-tint); color: var(--rn); }
.chip.lpn { background: var(--lpn-tint); color: var(--lpn); }
.chip.pd { background: var(--mute-tint); color: var(--mute-text); }
.chip.ok { background: var(--ok-tint); color: var(--ok-text); }
.chip.bad { background: var(--bad-tint); color: var(--bad-text); }
.chip.warn { background: var(--warn-tint); color: var(--warn-text); }
.chip.wait { background: var(--wait-tint); color: var(--wait-text); }
.timeline { position: relative; padding: 8px 12px 10px; overflow-x: auto; }
.axis { position: relative; height: 14px; font-size: 0.68rem; color: var(--faint); font-family: var(--mono); }
.axis span { position: absolute; transform: translateX(-50%); }
.track { position: relative; height: 54px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10%); border-radius: 3px; margin-top: 2px; }
.stop { position: absolute; top: 6px; height: 42px; min-width: 42px; background: var(--rn-tint); border: 1px solid var(--rn); border-radius: 5px; padding: 3px 6px; font-size: 0.75rem; line-height: 1.15; overflow: hidden; cursor: pointer; text-align: left; color: var(--ink); }
.stop.lpn { background: var(--lpn-tint); border-color: var(--lpn); }
.stop.done { background: var(--ok-tint); border-color: var(--ok); }
.stop.on_way { background: var(--wait-tint); border-color: var(--wait); box-shadow: 0 0 0 2px var(--wait-tint); }
.stop.missed { background: var(--bad-tint); border-color: var(--bad); }
.stop.sel { outline: 2px solid var(--ring); outline-offset: 1px; }
.stop .t { font-family: var(--mono); font-weight: 500; }
.stop .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.stop .k { color: var(--muted); }
.drive { position: absolute; top: 24px; height: 6px; background: var(--line-strong); opacity: 0.55; border-radius: 3px; }
.lane .empty { padding: 18px 12px; color: var(--faint); font-size: 0.85rem; }

.tray { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; box-shadow: var(--shadow); }
.tray.bad { border-color: var(--bad); }
.tray > header { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.tray ul { list-style: none; margin: 0; padding: 0; }
.tray li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tray li:last-child { border-bottom: 0; }
.tray li:hover { background: var(--surface); }
.tray .why { color: var(--bad-text); font-size: 0.85rem; }

/* map + detail column */
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.mapbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mapbox svg { display: block; width: 100%; height: 320px; background: var(--surface); }
.mapbox .streetmap { width: 100%; height: 400px; background: var(--surface); }
.mapbox .streetmap canvas { cursor: default; }
.mapbox .streetmap .maplibregl-ctrl-attrib { font-size: 0.68rem; }
.stopnum { width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 600 0.72rem/22px var(--mono); text-align: center; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); cursor: pointer; }
.stopnum.done { opacity: 0.5; }
.stopnum.sel { outline: 2.5px solid #0B2440; width: 26px; height: 26px; line-height: 26px; }
.myday .mapbox { margin-bottom: 10px; }
.myday .dayroute { margin-bottom: 12px; padding: 10px 12px; }
.myday .dayroute .lbl { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.myday .dayroute .acts { margin-top: 0; }
.myday .mapbox .streetmap { height: 260px; }
.myday .mapbox svg { height: 260px; }
.mapbox .legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--line); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.detail h2 { margin-bottom: 4px; }
.detail dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 10px 0; font-size: 0.9rem; }
.detail dt { color: var(--faint); }
.detail dd { margin: 0; }
.detail .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.detail .fld { margin-top: 8px; }

/* forms and tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card > h2 { margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.fld label { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.fld .hint { font-size: 0.8rem; color: var(--faint); margin: 0; }
.fld .err { color: var(--bad-text); font-size: 0.82rem; margin: 0; min-height: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th { text-align: left; font-weight: 600; color: var(--faint); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 10px; border-bottom: 1px solid var(--line-strong); }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface); }
table.list tr.sel td { background: var(--wait-tint); }
.notice { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 10px; font-size: 0.9rem; }
.notice.tone-ok { background: var(--ok-tint); color: var(--ok-text); }
.notice.tone-bad { background: var(--bad-tint); color: var(--bad-text); }
.notice.tone-warn { background: var(--warn-tint); color: var(--warn-text); }
.notice.tone-muted { background: var(--mute-tint); color: var(--mute-text); }
.search { max-width: 360px; }
.windows .w { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.windows .w.blk { grid-template-columns: 1fr 1fr 1.6fr auto; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #FFFFFF; padding: 10px 16px; border-radius: var(--radius); font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 40; }
.toast.show { opacity: 1; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.weekstrip a { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; font-size: 0.8rem; cursor: pointer; }
.weekstrip a.on { border-color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
.weekstrip a .d { font-weight: 600; }
.weekstrip a .s { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.weekstrip a .s b { color: var(--bad-text); }

/* my day (phone first) */
.myday { max-width: 560px; margin: 0 auto; }
.myday .stopcard { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--rn); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.myday .stopcard.done { border-left-color: var(--ok); opacity: 0.75; }
.myday .stopcard.on_way { border-left-color: var(--wait); box-shadow: 0 0 0 2px var(--wait-tint); }
.myday .stopcard.missed { border-left-color: var(--bad); }
.myday .stopcard .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.myday .eta { font-family: var(--mono); font-size: 1.25rem; font-weight: 500; }
.myday .addr { color: var(--muted); margin: 2px 0 6px; }
.myday .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.myday .acts .btn { flex: 1; justify-content: center; padding: 0.6rem; }
.myday .drive-note { font-size: 0.8rem; color: var(--faint); font-family: var(--mono); margin-bottom: 4px; }

/* login */
.login-body { background: var(--bg); }
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: var(--navy); display: flex; align-items: center; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 16px; color: #FFFFFF; }
.login-brand img { border-radius: 12px; }
.login-name { font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; }
.login-card { align-self: center; justify-self: center; width: min(400px, 90vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 14px; }
.login-foot { font-size: 0.85rem; color: var(--faint); margin: 14px 0 0; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px; }
  .rail #nav { flex-direction: row; flex-wrap: wrap; }
  .rail .sect { display: none; }
  .rail-foot { margin-top: 0; margin-left: auto; }
  .board { grid-template-columns: 1fr; }
  .side { position: static; }
  .lane { grid-template-columns: 1fr; }
  .lane-head { border-right: 0; border-bottom: 1px solid var(--line); }
  #main { padding: 14px; }
  .login { grid-template-columns: 1fr; }
  .login-side { padding: 28px; }
  .weekstrip { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.tray li:focus-visible, tr.click:focus-visible { outline: 2px solid var(--accent, #0F54AA); outline-offset: -2px; }
