/* ─────────────────────────────────────────────────────────────
   Dispatch — team task inbox
   A printed operations-desk aesthetic: warm paper, ink type,
   one cobalt accent, monospace index marks and a status spine.
   ───────────────────────────────────────────────────────────── */

/* ── Fonts (local, OFL) ─────────────────────────────────────── */
@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 600;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --paper: #f1ece1;
  --paper-deep: #e7e0d0;
  --surface: #fcfaf4;
  --surface-2: #f7f3e9;

  --ink: #1a1813;
  --ink-2: #3a362c;
  --muted: #5c5647;
  --faint: #6e6756;

  --border: #d9d1bd;
  --border-strong: #958b72;
  --hairline: #e4ddcc;

  --accent: #1e4b8f;
  --accent-deep: #163a6f;
  --accent-soft: #e2e9f5;

  --todo: #625c4a;
  --todo-bg: #e9e3d3;
  --progress: #8a4f07;
  --progress-bg: #f4e6cd;
  --blocked: #a52e23;
  --blocked-bg: #f6e0da;
  --done: #2c6947;
  --done-bg: #dfecdf;

  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail-w: 312px;
  --radius: 3px;
  --radius-lg: 5px;
  --shadow-sheet: -30px 0 70px rgba(26, 24, 19, 0.22);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── Reset / base ───────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(120, 110, 90, 0.05) 0.6px, transparent 0.6px),
    radial-gradient(rgba(120, 110, 90, 0.04) 0.6px, transparent 0.6px);
  background-size: 26px 26px, 26px 26px;
  background-position: 0 0, 13px 13px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, dl, dd, dt, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  text-decoration: none;
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ── App shell ──────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Desk rail ──────────────────────────────────────────────── */
.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 22px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(252, 250, 244, 0.75), rgba(241, 236, 225, 0.35));
}

.rail-top { padding-bottom: 20px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  flex: none;
  transition: transform 0.35s var(--ease);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand:hover .brand-mark { transform: rotate(-14deg); }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 27px;
  letter-spacing: 0.005em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 3px;
}

.rail-block { margin-top: 6px; }

.rail-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}

.views { display: flex; flex-direction: column; gap: 1px; }

.view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--ink-2);
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.view-row:hover { background: var(--surface); color: var(--ink); }
.view-row.is-active {
  background: var(--surface);
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.view-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
}
.view-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 2ch;
  text-align: right;
}
.view-row.is-active .view-count { color: var(--accent); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.s-todo { background: var(--todo); }
.s-in-progress { background: var(--progress); }
.s-blocked { background: var(--blocked); }
.s-done { background: var(--done); }

.rail-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.rail-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--done);
  box-shadow: 0 0 0 3px var(--done-bg);
}
.rail-hint {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--faint);
}
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink-2);
}

/* ── Main desk ──────────────────────────────────────────────── */
.main {
  min-width: 0;
  padding: 46px clamp(24px, 4vw, 60px) 60px;
  max-width: 1180px;
}

.page-head { border-bottom: 1px solid var(--border); padding-bottom: 26px; }

.head-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.head-kicker .sep { color: var(--faint); }

.head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 12px;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 4.6vw, 58px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.head-summary {
  max-width: 34ch;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: right;
  padding-bottom: 6px;
}
.head-summary strong { color: var(--ink); font-weight: 600; }

/* ── Toolbar ────────────────────────────────────────────────── */
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px auto;
  align-items: end;
  gap: 18px;
  padding: 22px 0 18px;
  border-bottom: 2px solid var(--ink);
}

.field { min-width: 0; }
.field--search { max-width: 460px; }

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 7px;
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--faint);
  pointer-events: none;
}

input[type="search"],
select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
input[type="search"] { padding-left: 38px; }
input[type="search"]::placeholder { color: var(--faint); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

input[type="search"]:hover,
select:hover { border-color: var(--ink-2); }

input[type="search"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-wrap { position: relative; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
}
.select-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 8px;
  color: var(--ink-2);
  pointer-events: none;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 3px;
  white-space: nowrap;
}
.result-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.clear-filters {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.clear-filters:hover { background: var(--surface); border-color: var(--ink-2); }

/* ── Task list ──────────────────────────────────────────────── */
.list-region { position: relative; }
.task-list { border-bottom: 1px solid var(--border); }

.task {
  --status: var(--todo);
  --status-bg: var(--todo-bg);
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 0 20px;
  padding: 20px 22px 20px 18px;
  border-left: 3px solid var(--status);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.18s var(--ease), border-left-width 0.18s var(--ease);
}
.task[data-status="in-progress"] { --status: var(--progress); --status-bg: var(--progress-bg); }
.task[data-status="blocked"] { --status: var(--blocked); --status-bg: var(--blocked-bg); }
.task[data-status="done"] { --status: var(--done); --status-bg: var(--done-bg); }

.task:hover { background: var(--surface); }

.task-index {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--status);
  padding-top: 2px;
}
.task-index::before {
  content: "№";
  font-size: 10px;
  color: var(--faint);
  margin-right: 3px;
  vertical-align: 2px;
}

.task-main { min-width: 0; }

.task-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--status);
  background: var(--status-bg);
  border: 1px solid color-mix(in srgb, var(--status) 26%, transparent);
  border-radius: 999px;
  padding: 3px 9px;
}
.status-chip .dot { width: 6px; height: 6px; background: var(--status); }

.task-project {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.task-project::before { content: "— "; letter-spacing: 0; }

.task-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.open-item {
  position: static;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
/* The whole row is the hit target while only the button is the control. */
.open-item::after { content: ""; position: absolute; inset: 0; }
.task:hover .task-title { color: var(--accent); }

.task-summary {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item svg { width: 13px; height: 13px; color: var(--faint); flex: none; }
.meta-item.is-overdue { color: var(--blocked); }
.meta-item.is-overdue svg { color: var(--blocked); }

.tag-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 2px 7px;
  background: var(--surface-2);
}

.task-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 2px;
}
.priority {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid transparent;
}
.priority[data-priority="high"] { color: var(--blocked); background: var(--blocked-bg); border-color: color-mix(in srgb, var(--blocked) 24%, transparent); }
.priority[data-priority="medium"] { color: var(--progress); background: var(--progress-bg); border-color: color-mix(in srgb, var(--progress) 24%, transparent); }
.priority[data-priority="low"] { color: var(--muted); background: var(--surface-2); border-color: var(--border); }

.open-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.task:hover .open-hint,
.task:focus-within .open-hint { opacity: 1; transform: none; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 78px 24px 90px;
  border-bottom: 1px solid var(--border);
}
.empty-mark { font-size: 36px; color: var(--border-strong); }
.empty-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  margin-top: 10px;
  text-wrap: balance;
}
.empty-copy {
  margin: 8px auto 22px;
  max-width: 42ch;
  font-size: 14.5px;
  color: var(--muted);
}

.btn {
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); }

/* ── Page foot ──────────────────────────────────────────────── */
.page-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}
.foot-note { text-transform: none; letter-spacing: 0.02em; }

/* ── Detail sheet ───────────────────────────────────────────── */
dialog#detail {
  inset: 0 0 0 auto;
  margin: 0 0 0 auto;
  width: min(584px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: none;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
}
dialog#detail::backdrop {
  background: rgba(26, 24, 19, 0.34);
  backdrop-filter: blur(1.5px);
}
dialog#detail[open] { animation: sheet-in 0.3s var(--ease); }
@keyframes sheet-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sheet {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-image: linear-gradient(180deg, var(--surface-2), var(--surface) 220px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.sheet-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.close-detail:hover { background: var(--paper); border-color: var(--ink-2); }
.close-detail svg { width: 12px; height: 12px; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px 44px;
}

.sheet-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.status-panel {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.status-control { max-width: 260px; }
.status-feedback {
  margin-top: 10px;
  min-height: 1.3em;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--done);
  letter-spacing: 0.02em;
}
.status-feedback.is-error { color: var(--blocked); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 26px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.fact {
  background: var(--surface);
  padding: 13px 15px;
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}
.fact dd { font-size: 14.5px; color: var(--ink); }

.sheet-content { margin-top: 30px; }
.sheet-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
}
.prose p {
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 66ch;
  text-wrap: pretty;
}
.prose p + p { margin-top: 14px; }
.prose p:first-child { color: var(--ink); font-size: 16px; }

.sheet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 60;
  background: var(--ink);
  color: #fdfbf6;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(26, 24, 19, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) 200px; }
  .toolbar-meta { grid-column: 1 / -1; justify-content: space-between; padding-bottom: 0; }
  .head-summary { text-align: left; max-width: 100%; }
  .head-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }

  .rail {
    position: static;
    height: auto;
    padding: 18px 20px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .rail-top { padding-bottom: 14px; }
  .brand-name { font-size: 24px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark svg { width: 22px; height: 22px; }

  .rail-block { margin-top: 2px; }
  .rail-label { padding-left: 0; }
  .views {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .view-row {
    flex: none;
    width: auto;
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    border-left-width: 1px;
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
  }
  .view-row.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
  }
  .view-count { font-size: 11px; }
  .rail-foot { display: none; }

  .main { padding: 26px 20px 48px; }
  .page-head { padding-bottom: 20px; }
  .page-title { font-size: 40px; }
  .head-summary { font-size: 13.5px; padding-bottom: 0; }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 0 16px;
  }
  .field--search { max-width: none; }
  .toolbar-meta { padding-bottom: 0; }

  .task {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0 13px;
    padding: 17px 12px 17px 12px;
  }
  .task-index { font-size: 13px; }
  .task-side {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding-top: 0;
  }
  .open-hint { display: none; }
  .task-title { font-size: 16.5px; }
  .task-summary { font-size: 13.5px; }
  .task-meta { margin-top: 10px; }

  dialog#detail { width: 100%; height: 100dvh; box-shadow: none; }
  dialog#detail[open] { animation: sheet-up 0.28s var(--ease); }
  @keyframes sheet-up {
    from { transform: translateY(18px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .sheet-body { padding: 22px 20px 40px; }
  .facts { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .facts { grid-template-columns: 1fr; }
  .close-label { display: none; }
  .close-detail { padding: 8px; }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Ensure the native dialog is hidden when closed even in odd UAs */
dialog#detail:not([open]) { display: none; }
