/* =====================================================================
   Roost - team inbox
   Type: Space Grotesk (display), DM Sans (UI), IBM Plex Mono (meta)
   Radius system: panels 16px, controls 10px, pills full. Used consistently.
   ===================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f3f3f1;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #efefeb;
  --border: #e6e5e0;
  --border-2: #d7d6cf;
  --ink: #1a1a18;
  --ink-2: #3d3d39;
  --muted: #6f6e69;
  --faint: #98978f;
  --placeholder: #63625d;

  --accent: #2f4bd8;
  --accent-soft: #eceffd;
  --accent-ink: #ffffff;

  --sidebar: #161719;
  --sidebar-2: #202124;
  --sidebar-3: #2a2b2f;
  --sidebar-ink: #ecebe7;
  --sidebar-muted: #8f8e88;

  --st-todo: #5f6470;
  --st-todo-bg: #edeeef;
  --st-in-progress: #8a4f05;
  --st-in-progress-bg: #faf0dd;
  --st-blocked: #b81a45;
  --st-blocked-bg: #fbe9ee;
  --st-done: #07795a;
  --st-done-bg: #e3f4ee;

  --shadow-sm: 0 1px 2px rgba(22, 22, 20, 0.05);
  --shadow-md: 0 1px 2px rgba(22, 22, 20, 0.05), 0 14px 34px -18px rgba(22, 22, 20, 0.4);
  --shadow-lg: 0 24px 70px -24px rgba(10, 10, 12, 0.55);

  --radius-panel: 16px;
  --radius-control: 10px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 264px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101113;
  --surface: #191a1d;
  --surface-2: #1e2023;
  --surface-3: #25272b;
  --border: #2b2d31;
  --border-2: #3a3c41;
  --ink: #f1f0ec;
  --ink-2: #cbcac5;
  --muted: #9b9a94;
  --faint: #74736e;
  --placeholder: #918f89;

  --accent: #8b9dff;
  --accent-soft: #212842;
  --accent-ink: #0d0e10;

  --sidebar: #08090a;
  --sidebar-2: #131417;
  --sidebar-3: #1d1e22;
  --sidebar-ink: #f1f0ec;
  --sidebar-muted: #85847e;

  --st-todo: #a4a7b0;
  --st-todo-bg: #26282c;
  --st-in-progress: #efb262;
  --st-in-progress-bg: #32260f;
  --st-blocked: #f288a3;
  --st-blocked-bg: #33161f;
  --st-done: #53cf9c;
  --st-done-bg: #0e2a20;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 34px -18px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 28px 70px -24px rgba(0, 0, 0, 0.85);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

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

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

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

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: relative;
  z-index: 40;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px;
  overflow-y: auto;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--sidebar-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 8px 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--sidebar-ink);
  font-size: 14px;
  text-align: left;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-btn .nav-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn .nav-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--sidebar-muted);
  font-variant-numeric: tabular-nums;
}

.nav-btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-btn[aria-pressed="true"] .nav-count {
  color: var(--sidebar-ink);
}

.nav-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
  background: var(--st-todo);
}
.nav-swatch[data-st="in-progress"] { background: var(--st-in-progress); }
.nav-swatch[data-st="blocked"] { background: var(--st-blocked); }
.nav-swatch[data-st="done"] { background: var(--st-done); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 9px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-control);
  color: var(--sidebar-ink);
  font-size: 13.5px;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
}

.theme-icon {
  display: inline-flex;
}

[data-theme="dark"] .theme-icon-moon,
:root:not([data-theme="dark"]) .theme-icon-sun {
  display: none;
}

/* ---------- Main ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.menu-btn {
  display: none;
}

.page-head {
  min-width: 0;
}

.page-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ---------- Search ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
  flex: 1 1 240px;
  max-width: 340px;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 34px 9px 34px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.search-input::placeholder {
  color: var(--placeholder);
}

.search-input:hover {
  border-color: var(--border-2);
}

.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-clear {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border-2);
  color: var(--ink-2);
  transition: background 0.18s var(--ease);
}
.search-clear:hover {
  background: var(--faint);
  color: var(--surface);
}

/* ---------- Selects ---------- */
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 7px;
  height: 7px;
  border-right: 1.7px solid var(--faint);
  border-bottom: 1.7px solid var(--faint);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 9px 32px 9px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.select:hover {
  border-color: var(--border-2);
}

.select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Workspace ---------- */
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.list-pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.workspace.has-detail .list-pane {
  flex: 0 0 42%;
  max-width: 520px;
  border-right: 1px solid var(--border);
}

/* ---------- Task list ---------- */
.task-list {
  padding: 8px 0 40px;
}

.task-item {
  position: relative;
  border-bottom: 1px solid var(--border);
}

.task-item:first-child {
  border-top: 1px solid var(--border);
}

.task-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  width: 100%;
  padding: 17px 24px 17px 22px;
  background: transparent;
  border: 0;
  text-align: left;
  transition: background 0.16s var(--ease);
}

.task-open::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.22s var(--ease);
}

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

.task-open:hover::before,
.task-item.is-open .task-open::before {
  transform: scaleY(1);
}

.task-item.is-open {
  background: var(--accent-soft);
}

.task-item.is-open .task-open,
.task-item.is-open .task-open:hover {
  background: transparent;
}

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

.task-title {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
}

.task-summary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 11px;
  font-size: 12px;
  color: var(--muted);
}

.task-meta .meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-2);
}

.task-chevron {
  align-self: center;
  color: var(--faint);
  transition: transform 0.22s var(--ease), color 0.18s var(--ease);
}

.task-open:hover .task-chevron {
  transform: translateX(2px);
  color: var(--ink-2);
}

/* ---------- Pills & labels ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pill[data-st="todo"] { color: var(--st-todo); background: var(--st-todo-bg); }
.pill[data-st="in-progress"] { color: var(--st-in-progress); background: var(--st-in-progress-bg); }
.pill[data-st="blocked"] { color: var(--st-blocked); background: var(--st-blocked-bg); }
.pill[data-st="done"] { color: var(--st-done); background: var(--st-done-bg); }

.prio {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.prio[data-p="high"] {
  color: var(--ink);
}

.due.is-overdue {
  color: var(--st-blocked);
  font-weight: 600;
}

.meta-strong {
  color: var(--ink-2);
  font-weight: 500;
}

/* ---------- Empty & loading states ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  max-width: 380px;
  margin: 0 auto;
  padding: 88px 24px;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  background: var(--accent-soft);
  margin-bottom: 6px;
}

.empty-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.empty-text {
  color: var(--muted);
  font-size: 14px;
  max-width: 34ch;
}

.empty-state .btn {
  margin-top: 10px;
}

.skeleton-row {
  padding: 17px 24px;
  border-bottom: 1px solid var(--border);
}

.skeleton-row:first-child {
  border-top: 1px solid var(--border);
}

.sk-line {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3), var(--border), var(--surface-3));
  background-size: 200% 100%;
  animation: sk 1.4s ease-in-out infinite;
}

.sk-line + .sk-line {
  margin-top: 10px;
}

.sk-title { width: 42%; height: 15px; }
.sk-body { width: 78%; }
.sk-meta { width: 30%; }

@keyframes sk {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    transform 0.12s var(--ease), color 0.18s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--ink-2);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--ink-2);
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-2);
}

/* ---------- Detail pane ---------- */
.detail-pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  animation: detail-in 0.32s var(--ease) both;
}

@keyframes detail-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.detail {
  max-width: 720px;
  padding: 26px 34px 60px;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.detail-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.close-detail:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-2);
}

.detail-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 27px;
  line-height: 1.18;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.detail-control {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 24px 0 8px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
}

.detail-control label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-control .select-wrap {
  align-self: flex-start;
  min-width: 190px;
}

.detail-control .select {
  background: var(--surface);
  font-weight: 600;
}

.control-help {
  font-size: 12px;
  color: var(--muted);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
  margin: 22px 0 26px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.detail-meta div {
  min-width: 0;
}

.detail-meta dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-meta dd {
  font-size: 14px;
  color: var(--ink);
}

.detail-meta .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 9px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  color: var(--ink-2);
}

.detail-body {
  white-space: pre-line;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.72;
  max-width: 68ch;
}

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-undo {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--bg);
  border: 1px solid color-mix(in srgb, var(--bg) 45%, transparent);
  border-radius: 8px;
  background: transparent;
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.18s var(--ease);
}

.toast-undo:hover {
  background: color-mix(in srgb, var(--bg) 16%, transparent);
}

/* ---------- Drawer ---------- */
.drawer-scrim {
  display: none;
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 960px) {
  .app {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 84vw);
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
    border-right: 0;
  }

  .app.drawer-open .sidebar {
    transform: none;
  }

  .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 10, 12, 0.5);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
  }
  .app.drawer-open .drawer-scrim {
    opacity: 1;
  }
  .drawer-scrim[hidden] {
    display: none;
  }

  .main {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .menu-btn {
    display: grid;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding: 14px 16px;
    gap: 12px;
  }

  .toolbar {
    width: 100%;
    margin-left: 0;
  }

  .search {
    max-width: none;
    flex: 1 1 100%;
  }

  .select-wrap {
    flex: 1 1 calc(50% - 5px);
  }

  .select {
    width: 100%;
  }

  .select-wrap-status {
    flex: 1 1 100%;
  }

  .workspace {
    display: block;
    overflow: visible;
  }

  .workspace.has-detail .list-pane {
    display: none;
  }

  .list-pane {
    overflow: visible;
  }

  .task-open {
    padding: 16px 16px 16px 16px;
    gap: 10px;
  }

  .detail-pane {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--bg);
    overflow-y: auto;
    animation: sheet-in 0.32s var(--ease) both;
  }

  @keyframes sheet-in {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: none; }
  }

  .detail {
    max-width: none;
    padding: 16px 16px 56px;
  }

  .detail-title {
    font-size: 22px;
  }

  .detail-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

@media (max-width: 420px) {
  .detail-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 0;
    margin: -6px 0 10px;
    background: var(--bg);
  }

  .close-detail span {
    display: none;
  }
  .close-detail {
    padding: 9px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .detail-pane,
  .toast {
    animation: none !important;
  }
}

/* ---------- Reduced transparency ---------- */
@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
