@import url('/theme.css');

:root {
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

/* ------------------------------------------------------------- layout --- */

#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 16px 18px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent);
}

.app-switch { padding: 12px; border-bottom: 1px solid var(--line); }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; margin-bottom: 2px;
  border-radius: 7px; color: var(--fg-2); font-weight: 500;
}
.nav a:hover { background: var(--panel-2); color: var(--fg); text-decoration: none; }
.nav a.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav .sec {
  padding: 14px 11px 6px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--fg-3); font-weight: 600;
}
.nav .badge { margin-left: auto; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-3); }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }

.content { padding: 20px; max-width: 1600px; width: 100%; }

/* ------------------------------------------------------------ elements --- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 12px; font-size: 13px; font-weight: 650; color: var(--fg-2);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card h3 .spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1200px) { .g4, .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
/*
 * `minmax(0, 1fr)`, not `1fr`.
 *
 * A bare `1fr` is `minmax(auto, 1fr)`, and `auto` there means min-content: the
 * column refuses to become narrower than its widest child. A card holding a
 * nine-column table therefore stretched to 555px inside a 390px screen, and the
 * table's own `overflow-x` never got the chance to do anything, because the box
 * it was supposed to scroll inside had simply grown instead.
 */
@media (max-width: 800px) { .grid { grid-template-columns: minmax(0, 1fr) !important; } }

.kpi { padding: 14px 16px; }
.kpi .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg-3); font-weight: 600;
}
.kpi .value {
  font-size: 27px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px;
  line-height: 1.15;
}
.kpi .sub { font-size: 12px; color: var(--fg-3); margin-top: 3px; }
.kpi .value.good { color: var(--good); }
.kpi .value.warn { color: var(--warn); }
.kpi .value.bad { color: var(--bad); }

.btn {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 7px 13px; cursor: pointer; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); border-color: var(--fg-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, var(--fg)); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 4px 10px; font-size: 12px; }

input, select, textarea {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-2); border-radius: 7px;
  padding: 7px 10px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
label { display: block; font-size: 12px; color: var(--fg-2); margin: 12px 0 5px; font-weight: 500; }

.range { display: flex; gap: 2px; background: var(--panel-2); padding: 3px; border-radius: 8px; border: 1px solid var(--line); }
.range button {
  background: none; border: 0; color: var(--fg-2); padding: 5px 10px;
  border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 500;
}
.range button:hover { color: var(--fg); }
.range button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.icon-btn {
  background: none; border: 1px solid var(--line-2); border-radius: 7px;
  color: var(--fg-2); cursor: pointer; padding: 5px 9px; font-size: 14px; line-height: 1;
}
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }

/*
 * Tables scroll inside their own box, never by widening the page.
 *
 * These have up to nine columns and no honest way to fit 390px. Unwrapped they
 * pushed the document to 885px, and the visible symptom was not "the table is
 * wide" — it was every card stopping short of the right edge, because the page
 * itself had become wider than the screen.
 *
 * `width: max-content` lets the table take the room its columns need, and
 * `min-width: 100%` keeps it filling the card on a desktop, where max-content
 * is usually narrower than the space available.
 */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
.tablewrap table { width: max-content; min-width: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line-2);
  white-space: nowrap; cursor: default;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.truncate { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--panel-2); color: var(--fg-2);
  border: 1px solid var(--line);
}
.badge.good { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }

.muted { color: var(--fg-3); }
.small { font-size: 12px; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bars .b { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bars .track { position: relative; height: 24px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bars .fill { position: absolute; inset: 0 auto 0 0; background: var(--s1); opacity: .22; }
.bars .b:hover .fill { opacity: .34; }
.bars .txt { position: relative; padding: 3px 9px; line-height: 18px; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .n { font-variant-numeric: tabular-nums; color: var(--fg-2); font-size: 12px; font-weight: 600; }

.vital { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel-2); }
.vital .name { font-size: 11px; color: var(--fg-3); letter-spacing: .06em; font-weight: 600; }
.vital .val { font-size: 22px; font-weight: 650; line-height: 1.15; margin-top: 2px; }
.vital .full { font-size: 11.5px; line-height: 1.35; color: var(--fg-2); margin-top: 3px; }
.vital .en { font-size: 10.5px; color: var(--fg-3); font-style: italic; }
.vital .stack { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 9px; }
.vital .stack i { display: block; height: 100%; border-radius: 2px; }

abbr[title] { text-decoration: underline dotted var(--fg-3); text-underline-offset: 2px; cursor: help; }
th abbr[title] { text-decoration-color: var(--line-2); }

/* --------------------------------------------------------------- charts --- */

.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--fg-2); margin-bottom: 8px;
}
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .key.line i { height: 3px; border-radius: 2px; width: 14px; }

.wf { font-family: var(--mono); font-size: 11px; }
.wf .row-wf {
  display: grid; grid-template-columns: minmax(180px, 320px) 1fr 62px 62px;
  gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line);
}
.wf .row-wf:hover { background: var(--panel-2); }
.wf .bar-wrap { position: relative; height: 15px; background: var(--panel-2); border-radius: 3px; }
.wf .seg { position: absolute; top: 0; height: 100%; }
.wf .lg { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 11px; color: var(--fg-2); }
.wf .lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.flag {
  display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 9.5px;
  font-weight: 700; letter-spacing: .03em; vertical-align: 1px; cursor: help;
  font-family: -apple-system, "Segoe UI", sans-serif;
}
.flag.good { background: var(--good-bg); color: var(--good); }
.flag.warn { background: var(--warn-bg); color: var(--warn); }
.flag.bad  { background: var(--bad-bg); color: var(--bad); }

.geo { position: relative; }
.geo svg { border-radius: 8px; background: var(--ocean); display: block; }
.geo-legend {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--fg-2);
}
.geo-legend .sw { display: inline-flex; align-items: center; gap: 5px; }
.geo-legend .sw i { display: inline-block; width: 18px; height: 11px; border-radius: 3px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 150px; }
.filters label { margin: 0 0 4px; }

.drill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--fg-3); font-weight: 500; }
.card h3 .drill { text-transform: none; letter-spacing: 0; }
.kpi.linked { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.kpi.linked:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.kpi.linked .label::after { content: ' →'; color: var(--accent); }
.vital.linked { cursor: pointer; }
.vital.linked:hover { border-color: var(--accent); }

.split { display: flex; gap: 2px; height: 7px; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.split i { display: block; height: 100%; border-radius: 2px; }

.opp { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
       padding: 10px 12px; border-bottom: 1px solid var(--line); }
.opp:hover { background: var(--panel-2); }
.opp .save { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--good); white-space: nowrap; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 6px 0 6px 4px; display: grid; grid-template-columns: 66px 1fr; gap: 10px; align-items: baseline; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--fg-3); border: 2px solid var(--panel);
}
.tl-item.view::before { background: var(--s1); }
.tl-item.error::before { background: var(--bad); }
.tl-item.request_failed::before { background: var(--warn); }
.tl-item.rage::before, .tl-item.dead::before { background: var(--serious); }
.tl-item.custom::before { background: var(--s3); }
.tl-item .t { color: var(--fg-3); font-size: 11px; font-family: var(--mono); }
.tl-item .d { font-size: 12px; color: var(--fg-3); }

pre.stack {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px;
  color: var(--fg-2); margin: 0; line-height: 1.55; max-height: 340px;
}

.snippet {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 12px; font-family: var(--mono); font-size: 12px; color: var(--fg);
  white-space: pre-wrap; word-break: break-all; user-select: all;
}

.modal-bg {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--fg) 45%, transparent);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 22px; width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 6px; font-size: 18px; }


.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  background: none; border: 0; color: var(--fg-2); padding: 9px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.empty { padding: 40px; text-align: center; color: var(--fg-3); }
.spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

.tooltip {
  position: fixed; pointer-events: none; z-index: 200;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 9px 11px; font-size: 12px; color: var(--fg);
  box-shadow: var(--shadow-lg); white-space: nowrap;
}
.tooltip .k { color: var(--fg-3); margin-right: 8px; }
.tooltip b { font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--good);
  border-radius: 8px; padding: 11px 16px; box-shadow: var(--shadow-lg);
  animation: slide .2s ease;
}
.toast.err { border-left-color: var(--bad); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

.devices summary, .glossary summary {
  cursor: pointer; font-size: 13px; font-weight: 650; color: var(--fg-2);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.devices summary::before, .glossary summary::before { content: '▸'; color: var(--fg-3); }
.devices[open] summary::before, .glossary[open] summary::before { content: '▾'; }
.devices summary::-webkit-details-marker, .glossary summary::-webkit-details-marker { display: none; }
.kv { padding: 9px 11px; background: var(--panel-2); border-radius: 7px; min-width: 0; }
.kv .k { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv .v { font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.glossary .term { padding: 10px 12px; background: var(--panel-2); border-radius: 7px; }
.glossary .term .hu { color: var(--fg); font-size: 13px; margin: 2px 0 3px; }

/* ------------------------------------------------------------- leaflet --- */

.leaflet-host .leaflet-container {
  background: var(--ocean);
  border-radius: 8px;
  font: inherit;
  outline: none;
}

/*
 * OSM's standard tiles are drawn for a light page, so dark mode filters them
 * locally rather than pulling a second tile set (another external dependency).
 *
 * Darkening, NOT inverting. OSM land is near-white, so invert() lands it on
 * #0b0d12 — 1.30:1 against the card, which is why the inactive world was a
 * black smear — and hue-rotate turned the sea brown. Plain brightness keeps
 * land at #5c5b59 (2.21:1) and water blue, both legible.
 */
:root[data-theme='dark'] .leaflet-host .leaflet-tile-pane,
:root:not([data-theme='light']) .leaflet-host .leaflet-tile-pane {
  filter: brightness(.38) saturate(.75) contrast(1.05);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .leaflet-host .leaflet-tile-pane { filter: none; }
}

.leaflet-host .leaflet-control-attribution {
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--fg-3);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px 0 0 0;
}
.leaflet-host .leaflet-control-attribution a { color: var(--fg-2); }

.leaflet-host .leaflet-control-zoom a {
  background: var(--panel);
  color: var(--fg);
  border-color: var(--line-2);
}
.leaflet-host .leaflet-control-zoom a:hover { background: var(--panel-2); }

.leaflet-rum-tip.leaflet-tooltip {
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.leaflet-rum-tip.leaflet-tooltip::before { display: none; }
.leaflet-rum-tip .k { color: var(--fg-3); }
.leaflet-rum-tip b { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- replay --- */

.replay-stage {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* rrweb sizes the replayed page itself; keep it contained and centred. */
.replay-canvas { position: relative; width: 100%; height: 100%; }
.replay-canvas .replayer-wrapper { transform-origin: top left; }
.replay-canvas iframe { border: 0; background: #fff; }

.replay-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
}
.replay-time, .replay-total { font-size: 12px; color: var(--fg-2); min-width: 52px; }
.replay-total { text-align: right; }
.replay-speed { width: auto; padding: 4px 8px; font-size: 12px; }

.replay-track {
  position: relative; flex: 1; min-width: 160px; height: 22px;
  cursor: pointer; display: flex; align-items: center;
}
.replay-track::before {
  content: ''; position: absolute; left: 0; right: 0; height: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
}
.replay-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.replay-played {
  position: absolute; left: 0; height: 6px; width: 0;
  background: var(--accent); border-radius: 3px;
}
.replay-marks { position: absolute; inset: 0; pointer-events: none; }
.replay-mark {
  position: absolute; top: 3px; width: 3px; height: 16px; padding: 0;
  border: 0; border-radius: 2px; background: var(--fg-3);
  cursor: pointer; pointer-events: auto; transform: translateX(-1px);
}
.replay-mark:hover { transform: translateX(-1px) scaleX(2); }
.replay-mark.error { background: var(--bad); }
.replay-mark.rage, .replay-mark.dead { background: var(--serious); }
.replay-mark.view { background: var(--s1); }

/* ------------------------------------------------------------- mobile --- */

/*
 * Below 800px the sidebar becomes a drawer instead of disappearing.
 *
 * It used to be `display: none` here, which left the navigation unreachable:
 * whatever view you landed on was the only one you could get to. The panel is
 * now off-canvas and slides in over the content, with a scrim behind it.
 *
 * The open state is a class on <html> so CSS owns the transition and the app
 * code never has to know where the breakpoint is.
 */
.menu-btn, .drawer-close { display: none; }
.drawer-scrim { display: none; }

@media (max-width: 800px) {
  .menu-btn { display: inline-flex; }
  .drawer-close { display: inline-flex; margin-left: auto; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
    /* Wide enough to read, never edge to edge: the strip of visible page is
       what tells you the drawer is a layer you can dismiss. */
    width: min(300px, 84vw);
    flex-basis: min(300px, 84vw);
  }
  :root.drawer-open .sidebar { transform: translateX(0); }

  .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: color-mix(in srgb, #000 46%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  :root.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }

  .content { padding: 14px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar h1 { font-size: 16px; }

  /* Control rows are flex with no wrapping, so on a narrow screen they set a
     hard minimum width for the whole page — the session filters pinned it at
     373px, which overflowed a 360px phone. Let them wrap instead. */
  .range { flex-wrap: wrap; }
  .row, .row.wrap { flex-wrap: wrap; }

  /* 380px of truncation does not fit on a 390px screen once padding and the
     other columns are counted. */
  .truncate { max-width: 52vw; }
}

/* Respect a reduced-motion preference: the drawer still works, it just
   appears rather than slides. */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .drawer-scrim { transition: none; }
}

/* ------------------------------------------------------ landing / login --- */

/*
 * Signed out: the intro video is the whole background, dimmed, with the
 * sign-in card floating on it.
 *
 * The card stays OPAQUE on purpose. Frosted glass over video is the obvious
 * thing to reach for and it is the wrong thing here: the text contrast would
 * then depend on whichever frame happened to be behind it, which is
 * unmeasurable and changes 30 times a second. Opaque card means the label and
 * input contrast is exactly what tools/contrast.mjs already verifies for every
 * other surface in the product, video or no video.
 */
.landing {
  flex: 1;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}
.landing-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/*
 * The veil is what makes it a background rather than a feature. It is the page
 * background colour at high opacity, so the video reads as texture in both
 * themes and never competes with the form.
 */
.landing-veil {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
}

.landing-form {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 560px) {
  .landing { padding: 16px; }
  .landing-form { padding: 24px 20px; }
}

/*
 * Reduced motion: no looping video. A still frame would be defensible, but the
 * honest answer to "do not animate" is to drop it, not to keep it and hope.
 */
@media (prefers-reduced-motion: reduce) {
  .landing-bg video { display: none; }
}
