/* Docket — team inbox */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  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;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #F2EFE7;
  --surface: #FFFDF8;
  --surface-2: #F7F4EC;
  --ink: #15171C;
  --ink-2: #2B2E36;
  --muted: #5B584F;
  --line: #DFD9CC;
  --line-strong: #C6BEAD;

  --cobalt: #2B44D8;
  --cobalt-ink: #1C2EA3;
  --cobalt-tint: #E6E9FC;

  --todo: #5A6373;      --todo-tint: #E8EAEE;  --todo-ink: #363E4B;
  --prog: #B86E00;      --prog-tint: #FBEBCD;  --prog-ink: #6F4300;
  --block: #C23A22;     --block-tint: #FBE0DA; --block-ink: #8A2111;
  --done: #2F7A4C;      --done-tint: #DCEFE2;  --done-ink: #1D5232;

  --rail-w: 244px;
  --detail-w: 468px;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(21, 23, 28, .04), 0 14px 32px -18px rgba(21, 23, 28, .28);

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-status="todo"]        { --s: var(--todo);  --s-tint: var(--todo-tint);  --s-ink: var(--todo-ink); }
[data-status="in-progress"] { --s: var(--prog);  --s-tint: var(--prog-tint);  --s-ink: var(--prog-ink); }
[data-status="blocked"]     { --s: var(--block); --s-tint: var(--block-tint); --s-ink: var(--block-ink); }
[data-status="done"]        { --s: var(--done);  --s-tint: var(--done-tint);  --s-ink: var(--done-ink); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--font-mono); font-size: .84em; letter-spacing: .01em; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 6px;
}
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}
.app.has-detail { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--detail-w); }

/* ---------- Rail ---------- */

.rail {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 16px 20px;
  background: var(--ink);
  color: #ECE9E1;
  overflow-y: auto;
}
.rail :focus-visible { outline-color: #9FB0FF; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
}
.brand-team { font-size: 13px; color: #A9A69D; }

.rail-label {
  padding: 0 8px 8px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #9E9B92;
}

.views-list { list-style: none; padding: 0; display: grid; gap: 2px; }
.view-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: #DAD6CD;
  text-align: left; font-size: 15px;
}
.view-btn:hover { background: #22252C; color: #fff; }
.view-btn[aria-pressed="true"] { background: #2A2E38; color: #fff; box-shadow: inset 3px 0 0 #7C8DFF; }
.view-dot {
  width: 10px; height: 10px; border-radius: 3px; flex: none;
  background: var(--s, #ECE9E1);
}
.view-btn[data-status="todo"] .view-dot { background: #A3ACBB; }
.view-btn[data-status="all"] .view-dot { background: transparent; border: 2px solid #ECE9E1; }
.view-name { flex: 1; }
.view-count { font-family: var(--font-mono); font-size: 12.5px; color: #A9A69D; }
.view-btn[aria-pressed="true"] .view-count { color: #fff; }

.progress { padding: 0 8px; }
.progress .rail-label { padding-left: 0; }
.progress-figure { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.progress-of { font-family: var(--font-body); font-size: 14px; font-weight: 400; color: #A9A69D; letter-spacing: 0; }
.progress-track {
  display: flex; height: 8px; margin-top: 10px; border-radius: 99px; overflow: hidden;
  background: #2E323B;
}
.progress-seg { height: 100%; width: 0; background: var(--s); transition: width .4s ease; }
.progress-seg[data-status="in-progress"] { background: #E0A13A; }
.progress-seg[data-status="blocked"] { background: #E2634B; }
.progress-seg[data-status="done"] { background: #5DB47F; }

.rail-foot { margin-top: auto; padding: 0 8px; display: grid; gap: 10px; }
.rail-reset {
  justify-self: start;
  padding: 7px 10px; border-radius: 8px;
  border: 1px solid #3A3E48; background: transparent; color: #DAD6CD; font-size: 13px;
}
.rail-reset:hover { background: #22252C; color: #fff; }
.rail-note { font-size: 12px; line-height: 1.45; color: #9E9B92; }

/* ---------- Main ---------- */

.main {
  min-width: 0;
  padding: 36px 40px 64px;
  container-type: inline-size;
  container-name: main;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding-bottom: 24px; border-bottom: 2px solid var(--ink);
}
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cobalt-ink);
}
h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600; line-height: 1.08; letter-spacing: -.03em;
  max-width: 18ch;
}
.page-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.chip strong { font-weight: 700; }
.chip-alert { background: var(--block-tint); border-color: #F1C2B7; color: var(--block-ink); }

/* Toolbar */
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px 180px;
  gap: 14px;
  margin-top: 24px;
}
.field { display: grid; gap: 6px; min-width: 0; }
.field label {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
input[type="search"], .field select {
  width: 100%; height: 46px;
  border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--surface);
  font-size: 15px;
}
input[type="search"] { padding: 0 44px 0 40px; }
input[type="search"]::placeholder { color: #7F7A6F; }
input[type="search"]:focus-visible, .field select:focus-visible {
  outline: 3px solid var(--cobalt); outline-offset: 1px; border-color: var(--cobalt); border-radius: 10px;
}
.search-kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  min-width: 24px; padding: 1px 7px; text-align: center;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
  font-family: var(--font-mono); font-size: 12px;
}
input[type="search"]:not(:placeholder-shown) + .search-kbd { display: none; }

select {
  appearance: none; -webkit-appearance: none;
  padding: 0 38px 0 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 8l4.5 4.5L14.5 8' fill='none' stroke='%2315171C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  cursor: pointer;
}

.result-bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 28px 0 12px;
}
.result-heading {
  font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.01em;
}
.result-count { font-size: 14px; color: var(--muted); text-align: right; }

/* Groups + rows */
.list { display: grid; gap: 26px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
}
.group-head .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--s); }
.group-count {
  font-family: var(--font-mono); font-size: 12px; font-weight: 400;
  padding: 1px 8px; border-radius: 99px; background: var(--s-tint); color: var(--s-ink);
}
.group-rule { flex: 1; height: 1px; background: var(--line); }

.rows {
  list-style: none; padding: 0;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 160px 104px 84px;
  grid-template-areas: "status main who due pri";
  align-items: center;
  column-gap: 18px; row-gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  transition: background-color .15s ease;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row.is-open { background: var(--cobalt-tint); box-shadow: inset 4px 0 0 var(--cobalt); }
.row.is-flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0% { background: #FFF1B8; }
  100% { background: var(--surface); }
}

.row-status { grid-area: status; }
.row-main { grid-area: main; min-width: 0; }
.row-who { grid-area: who; }
.row-due { grid-area: due; }
.row-pri { grid-area: pri; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 8px; border-radius: 99px;
  background: var(--s-tint); color: var(--s-ink);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--s); flex: none;
}
.pill[data-status="done"]::before {
  width: 10px; height: 10px; border-radius: 0; background: none;
  border: solid var(--s); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -2px);
  width: 5px; height: 9px;
}

.row-open {
  display: block; width: 100%;
  padding: 0; border: 0; background: none;
  text-align: left;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3;
  color: var(--ink);
}
.row-open::after { content: ""; position: absolute; inset: 0; border-radius: 0; }
.row-open:focus-visible { outline: none; }
.row-open:focus-visible::after { outline: 3px solid var(--cobalt); outline-offset: -3px; border-radius: 4px; }
.row-open:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.row[data-status="done"] .row-open { color: var(--muted); }
.row-open mark { background: #FFE58A; color: inherit; border-radius: 3px; padding: 0 1px; }

.row-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin-top: 4px;
  font-size: 13px; color: var(--muted);
}
.tag {
  padding: 0 7px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 12px; color: var(--ink-2);
}
.row-comments { display: inline-flex; align-items: center; gap: 4px; }
.row-comments svg { width: 14px; height: 14px; }

.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: none;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--av-bg, #E6E9FC); color: var(--av-ink, #1C2EA3);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}

.due { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.due-label { display: block; font-family: var(--font-mono); font-size: 12.5px; }
.due-note { display: block; font-size: 12px; font-weight: 600; }
.due.is-overdue .due-note { color: var(--block-ink); }
.due.is-today .due-note { color: var(--prog-ink); }
.due.is-done .due-note { color: var(--muted); font-weight: 400; }

.pri { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.pri-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.pri-bars i { display: block; width: 3px; border-radius: 1px; background: var(--line-strong); }
.pri-bars i:nth-child(1) { height: 5px; }
.pri-bars i:nth-child(2) { height: 8px; }
.pri-bars i:nth-child(3) { height: 12px; }
.pri-low .pri-bars i:nth-child(-n+1),
.pri-medium .pri-bars i:nth-child(-n+2),
.pri-high .pri-bars i:nth-child(-n+3) { background: var(--ink); }
.pri-high { font-weight: 600; }

/* Row compaction when the list column is narrow */
@container main (max-width: 860px) {
  .row {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "main main main main"
      "status who due pri";
    padding: 14px 16px;
    column-gap: 14px;
  }
  .row-due { justify-self: end; }
  .due-label, .due-note { display: inline; }
  .due-note::before { content: " · "; color: var(--muted); font-weight: 400; }
  .due.is-none .due-note::before { content: ""; }
}
@container main (max-width: 520px) {
  .row { column-gap: 10px; }
  .who-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pri-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .due-note { display: none; }
  .due.is-overdue .due-label { color: var(--block-ink); font-weight: 600; }
  .due.is-overdue .due-label::before { content: "! "; }
}

/* Empty state */
.empty {
  display: grid; justify-items: center; gap: 8px;
  padding: 48px 24px; text-align: center;
  background: var(--surface); border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
}
.empty-art { width: 120px; height: 80px; margin-bottom: 6px; }
.empty-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.empty-text { max-width: 42ch; color: var(--muted); }
.empty-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 14.5px;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-ink); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line); background: transparent; }
.btn-icon { width: 42px; padding: 0; }

/* ---------- Detail ---------- */

.detail {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px -30px rgba(21, 23, 28, .45);
  animation: panel-in .22s ease-out;
}
@keyframes panel-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.detail-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.detail-step { display: flex; align-items: center; gap: 6px; }
.detail-pos { min-width: 56px; text-align: center; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.detail-scroll { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }

.detail-kicker { font-size: 13px; color: var(--muted); }
.detail-kicker .mono { color: var(--cobalt-ink); text-transform: uppercase; }
.detail-title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.025em;
}

.status-box {
  margin-top: 22px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--s-tint, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--s, #999) 30%, transparent);
  transition: background-color .2s ease;
}
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-row label { font-weight: 700; font-size: 14px; color: var(--s-ink, var(--ink)); }
.status-select { position: relative; flex: 0 1 220px; }
.status-dot {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%; background: var(--s); pointer-events: none;
}
.status-select select {
  width: 100%; height: 44px; padding-left: 34px;
  border: 1.5px solid var(--s); border-radius: 10px;
  background-color: var(--surface);
  font-weight: 600; font-size: 15px;
}
.status-select select:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 10px; }
.status-feedback {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--s, #999) 25%, transparent);
  font-size: 14px; color: var(--ink-2);
}
.status-feedback svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--done); }
.status-feedback.is-fresh { animation: feedback-in .35s ease-out; }
@keyframes feedback-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.link-btn {
  padding: 0; border: 0; background: none;
  color: var(--cobalt-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}

.meta {
  display: grid; grid-template-columns: 1fr 1fr;
  margin-top: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.meta > div { padding: 12px 14px; border-top: 1px solid var(--line); min-width: 0; }
.meta > div:nth-child(-n+2) { border-top: 0; }
.meta > div:nth-child(even) { border-left: 1px solid var(--line); }
.meta > div.meta-wide { grid-column: 1 / -1; border-left: 0; }
.meta dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.meta dd { margin-top: 4px; font-size: 14.5px; }
.meta .tags { display: flex; flex-wrap: wrap; gap: 6px; }

.detail-body { margin-top: 26px; display: grid; gap: 14px; font-size: 16px; line-height: 1.62; color: var(--ink-2); max-width: 62ch; }
.detail-body .outcome {
  padding: 14px 16px;
  border-left: 3px solid var(--cobalt);
  background: var(--cobalt-tint);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}
.detail-body .outcome strong { display: block; font-family: var(--font-display); color: var(--cobalt-ink); }

.activity { margin-top: 30px; }
.activity-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.activity-list { list-style: none; padding: 0; margin-top: 10px; display: grid; gap: 10px; }
.activity-list li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: baseline; font-size: 14px; color: var(--ink-2); }
.activity-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--s, var(--line-strong)); transform: translateY(-1px); }
.activity-list time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-left: 6px; }

/* ---------- Toast ---------- */

.toast-region {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px));
  display: grid; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--ink); color: #F4F1EA;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .5);
  animation: toast-in .25s ease-out;
}
.toast :focus-visible { outline-color: #9FB0FF; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--s, #5DB47F); }
.toast-icon svg { width: 13px; height: 13px; color: #fff; }
.toast-msg { flex: 1; font-size: 14px; line-height: 1.4; }
.toast-msg strong { font-weight: 700; }
.toast-action {
  flex: none; padding: 7px 12px; border-radius: 8px;
  border: 1px solid #4A4F5C; background: #262A33; color: #fff; font-weight: 600; font-size: 13.5px;
}
.toast-action:hover { background: #333845; }
.toast-dismiss {
  flex: none; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: #BDB9AF;
  display: grid; place-items: center;
}
.toast-dismiss:hover { background: #262A33; color: #fff; }
.toast-dismiss svg { width: 16px; height: 16px; }

/* ---------- Responsive ---------- */

@media (max-width: 1240px) {
  :root { --rail-w: 216px; --detail-w: 420px; }
  .main { padding: 30px 28px 56px; }
  .toolbar { grid-template-columns: minmax(0, 1fr) 170px 160px; }
}

@media (max-width: 1000px) and (min-width: 861px) {
  .app.has-detail { grid-template-columns: 0 minmax(0, 1fr) var(--detail-w); }
  .app.has-detail .rail { visibility: hidden; padding: 0; }
}

@media (max-width: 860px) {
  .app, .app.has-detail { display: block; }
  .rail {
    position: static; height: auto;
    gap: 14px;
    padding: 16px 16px 12px;
  }
  .brand { padding: 0; justify-content: space-between; }
  .brand > div { margin-right: auto; }
  .rail-label { display: none; }
  .views-list {
    display: flex; gap: 6px;
    overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px;
    scrollbar-width: none;
  }
  .views-list::-webkit-scrollbar { display: none; }
  .views-list li { flex: none; }
  .view-btn { padding: 8px 12px; border: 1px solid #3A3E48; border-radius: 99px; font-size: 14px; }
  .view-btn[aria-pressed="true"] { box-shadow: none; background: #ECE9E1; color: var(--ink); border-color: #ECE9E1; }
  .view-btn[aria-pressed="true"] .view-count { color: var(--ink); }
  .view-btn[data-status="all"][aria-pressed="true"] .view-dot { border-color: var(--ink); }
  .progress { padding: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
  .progress-figure { font-size: 18px; }
  .progress-track { margin-top: 0; }
  .rail-foot { display: none; }

  .main { padding: 22px 16px 96px; }
  .page-head { padding-bottom: 18px; }
  .page-summary { width: 100%; }
  .toolbar { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
  .field-search { grid-column: 1 / -1; }
  .search-kbd { display: none; }
  .result-bar { margin-top: 22px; }

  .detail {
    position: fixed; inset: 0; z-index: 60;
    height: auto;
    border-left: 0;
    animation-name: sheet-in;
  }
  @keyframes sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .detail-bar { padding: 10px 12px; }
  .detail-scroll { padding: 20px 18px 110px; }
  .detail-title { font-size: 24px; }
  body.detail-locked { overflow: hidden; }
}

@media (max-width: 420px) {
  .status-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .status-select { flex: none; }
  .meta { grid-template-columns: 1fr; }
  .meta > div:nth-child(2) { border-top: 1px solid var(--line); }
  .meta > div:nth-child(even) { border-left: 0; }
}

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

@media (forced-colors: active) {
  .pill, .view-btn[aria-pressed="true"], .row.is-open { border: 1px solid CanvasText; }
}
