/* Tracker: dark, calm, fast. One accent, one radius scale, system type. */

/* ---------- tokens ---------- */

:root {
  color-scheme: dark;

  --bg: oklch(0.15 0.005 30);
  --surface: oklch(0.19 0.006 30);
  --surface-2: oklch(0.23 0.007 30);
  --ink: oklch(0.93 0.004 30);
  --ink-dim: oklch(0.72 0.005 30);
  --line: oklch(0.3 0.008 30);

  /* one accent, locked: indicator, primary buttons, focus rings, review count */
  --accent: oklch(0.62 0.19 27);
  --accent-solid: oklch(0.56 0.17 27);      /* solid fills, keeps button text at 4.5:1 */
  --accent-solid-hover: oklch(0.6 0.18 27);

  /* status + sentiment, calibrated for dark */
  --ok: oklch(0.78 0.13 150);
  --warn: oklch(0.8 0.12 80);
  --tense: oklch(0.7 0.17 27);
  --neutral: oklch(0.75 0.008 30);

  --r-card: 12px;
  --r-ctl: 8px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --z-sticky: 10;
  --z-tabbar: 20;
  --z-backdrop: 30;
  --z-sheet: 40;
  --z-toast: 50;
}

/* ---------- base ---------- */

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body.sheet-lock {
  overflow: hidden;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

/* the sheet is focused programmatically on open for keyboard users;
   a container outline is noise, the modal state is already obvious */
.detail:focus-visible,
.detail:focus {
  outline: none;
}

::selection {
  background: color-mix(in oklab, var(--accent) 32%, transparent);
}

.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.dim {
  color: var(--ink-dim);
}

.is-tense {
  color: var(--tense);
}

.noscript {
  padding: 24px;
  color: var(--ink);
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r-ctl);
  transition: transform 140ms var(--ease-out), background-color 120ms ease, border-color 120ms ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--accent-solid);
  color: oklch(0.97 0.01 27);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-ctl);
  color: var(--ink-dim);
  transition: transform 140ms var(--ease-out), background-color 120ms ease, color 120ms ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.input,
.search,
.textarea,
.status-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* stops iOS zoom-on-focus */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  transition: border-color 120ms ease;
}

.input:focus,
.search:focus,
.textarea:focus {
  border-color: oklch(0.42 0.03 27);
}

.input::placeholder,
.search::placeholder,
.textarea::placeholder {
  color: var(--ink-dim);
}

.textarea {
  resize: vertical;
  min-height: 72px;
}

.search {
  padding-left: 36px;
}

.search::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-dim);
  pointer-events: none;
}

/* segmented filter */

.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
}

.seg-btn {
  flex: 1;
  min-height: 38px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
  border-radius: 6px;
  transition: background-color 120ms ease, color 120ms ease;
}

.seg-btn.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

/* select with its own chevron */

.select-wrap {
  position: relative;
  display: inline-flex;
}

.status-select {
  width: auto;
  min-height: 36px;
  padding: 5px 30px 5px 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface-2);
  appearance: none;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 9px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-dim);
  pointer-events: none;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ok);
  flex: none;
}

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

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(360px, 100%);
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-sub {
  margin-top: 6px;
  margin-bottom: 22px;
  font-size: 14px;
  color: var(--ink-dim);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
}

.pw-row {
  display: flex;
  gap: 8px;
}

.pw-row .input {
  flex: 1;
  min-width: 0;
}

.pw-toggle {
  flex: none;
  font-size: 13px;
  min-width: 64px;
}

.login-error {
  margin-top: 10px;
  font-size: 13px;
  color: var(--tense);
}

.login-submit {
  width: 100%;
  margin-top: 16px;
}

/* ---------- app frame, mobile first ---------- */

.main {
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-head {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 0;
}

.head-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.head-logout {
  min-height: 44px;
  padding: 0 8px;
  margin-right: -8px;
  font-size: 13px;
  color: var(--ink-dim);
  border-radius: var(--r-ctl);
  transition: color 120ms ease;
}

.head-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px 12px;
}

.head-note {
  padding: 6px 16px 12px;
  font-size: 13px;
  color: var(--ink-dim);
}

/* bottom tab bar */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-tabbar);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.app-mark,
.tab-logout {
  display: none;
}

.tabs-group {
  display: flex;
  flex: 1;
}

.tab {
  position: relative;
  flex: 1;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  transition: color 120ms ease;
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  width: 36px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: oklch(0.97 0.01 27);
  background: var(--accent-solid);
  border-radius: var(--r-pill);
}

/* ---------- lists and cards ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 8px;
}

.card {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: transform 140ms var(--ease-out), background-color 120ms ease, border-color 120ms ease;
}

.card:active {
  transform: scale(0.98);
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-dim);
}

.card-note {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* first-load stagger only; capped at 8 steps */

@media (prefers-reduced-motion: no-preference) {
  .list.stagger > li {
    opacity: 0;
    animation: rise 280ms var(--ease-out) forwards;
  }
  .list.stagger > li:nth-child(1) { animation-delay: 0ms; }
  .list.stagger > li:nth-child(2) { animation-delay: 40ms; }
  .list.stagger > li:nth-child(3) { animation-delay: 80ms; }
  .list.stagger > li:nth-child(4) { animation-delay: 120ms; }
  .list.stagger > li:nth-child(5) { animation-delay: 160ms; }
  .list.stagger > li:nth-child(6) { animation-delay: 200ms; }
  .list.stagger > li:nth-child(7) { animation-delay: 240ms; }
  .list.stagger > li:nth-child(n+8) { animation-delay: 280ms; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- badges, sentiment, chips ---------- */

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.badge-active {
  color: var(--ok);
  background: color-mix(in oklab, var(--ok) 17%, transparent);
}

.badge-on-hold {
  color: var(--warn);
  background: color-mix(in oklab, var(--warn) 17%, transparent);
}

.badge-completed {
  color: var(--neutral);
  background: color-mix(in oklab, var(--neutral) 14%, transparent);
}

.sent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-dim);
}

.sent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.sent-positive .sent-dot { color: var(--ok); }
.sent-neutral .sent-dot { color: var(--neutral); }
.sent-cautious .sent-dot { color: var(--warn); }
.sent-tense .sent-dot { color: var(--tense); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  transition: transform 140ms var(--ease-out), border-color 120ms ease;
}

button.chip:active {
  transform: scale(0.96);
}

.chip-static {
  color: var(--ink-dim);
}

/* ---------- review ---------- */

.ritem {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.ritem-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-dim);
}

.ritem-sum {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
}

.ritem-detail {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-dim);
}

.ritem-sug {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-dim);
}

.ritem-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.assign-pop {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--bg);
  overflow: hidden;
}

.assign-title {
  padding: 8px 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
}

.assign-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.assign-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 14px;
  text-align: left;
  border-radius: 6px;
  transition: background-color 120ms ease;
}

.assign-opt:active {
  background: var(--surface-2);
}

.assign-sug {
  font-size: 13px;
  color: var(--ink-dim);
}

.assign-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-dim);
}

.handled {
  margin: 4px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
}

.handled summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-dim);
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-card);
}

.handled summary::-webkit-details-marker {
  display: none;
}

.handled .chev {
  transition: transform 180ms var(--ease-out);
}

.handled[open] .chev {
  transform: rotate(180deg);
}

.handled-list {
  padding: 2px 14px 12px;
}

.handled-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--ink-dim);
}

.h-sum {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h-status {
  flex: none;
}

/* ---------- detail: sheet on mobile, pane on desktop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: oklch(0.05 0.002 30 / 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 250ms ease;
}

.detail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(20px + env(safe-area-inset-top));
  z-index: var(--z-sheet);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r-card) var(--r-card) 0 0;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 280ms var(--ease-drawer), visibility 0s linear 280ms;
}

.detail.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 280ms var(--ease-drawer);
}

.grabber {
  flex: none;
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: var(--r-pill);
  background: var(--line);
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.d-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 8px;
  background: var(--surface);
}

.d-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sheet-close {
  margin: -6px -10px 0 0;
}

.d-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 2px 0 14px;
  font-size: 13px;
  color: var(--ink-dim);
}

.d-desc {
  max-width: 65ch;
  padding-bottom: 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}

.d-tags {
  padding-bottom: 16px;
}

.d-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.d-h {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
}

.d-updated {
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-dim);
}

/* tasks */

.tasks {
  display: flex;
  flex-direction: column;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 0;
  cursor: pointer;
}

.task-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.task.is-done .task-title {
  color: var(--ink-dim);
  text-decoration: line-through;
}

.task-meta {
  flex: none;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-dim);
}

.task-flag {
  flex: none;
  font-size: 13px;
  color: var(--warn);
}

.task-meta.is-tense {
  color: var(--tense);
}

.task-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.task-add-row {
  display: flex;
  gap: 8px;
}

.task-add-row .input {
  flex: 1;
  min-width: 0;
}

.task-add-row .btn {
  flex: none;
}

/* notes */

.note-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.note-add .btn {
  align-self: flex-end;
}

.notes {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-dim);
}

.note-text {
  margin-top: 3px;
  max-width: 65ch;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

/* links */

.links {
  display: flex;
  flex-direction: column;
}

.link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
}

.link .arrow {
  color: var(--ink-dim);
  flex: none;
}

.link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* simple fact rows in person detail */

.facts {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.facts li {
  font-size: 14px;
  max-width: 65ch;
}

/* ---------- states ---------- */

.pane-empty {
  display: grid;
  place-items: center;
  min-height: 40vh;
  padding: 24px;
  text-align: center;
}

.pane-empty p {
  max-width: 32ch;
  font-size: 14px;
  color: var(--ink-dim);
}

.empty {
  padding: 48px 24px;
  text-align: center;
}

.empty p {
  margin: 0 auto;
  max-width: 36ch;
  font-size: 14px;
  color: var(--ink-dim);
}

.fail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
}

.fail p {
  font-size: 14px;
  color: var(--ink-dim);
}

.skel {
  pointer-events: none;
}

.skel-bar {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  margin-top: 10px;
}

.skel-bar:first-child {
  margin-top: 2px;
}

.w-40 { width: 40%; }
.w-55 { width: 55%; }
.w-70 { width: 70%; }
.w-85 { width: 85%; }

@media (prefers-reduced-motion: no-preference) {
  .skel-bar {
    animation: pulse 1.3s ease-in-out infinite;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast-msg {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  opacity: 0;
  transform: translateY(8px);
  transition: transform 250ms var(--ease-out), opacity 250ms var(--ease-out);
}

.toast-msg.is-in {
  opacity: 1;
  transform: none;
}

.toast-msg.is-out {
  opacity: 0;
  transform: translateY(4px);
  transition-duration: 150ms;
}

/* ---------- hover, fine pointers only ---------- */

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent-solid-hover);
  }
  .btn-ghost:hover,
  .icon-btn:hover {
    background: var(--surface-2);
  }
  .icon-btn:hover {
    color: var(--ink);
  }
  .seg-btn:hover:not(.is-active) {
    color: var(--ink);
  }
  .tab:hover {
    color: var(--ink);
  }
  .head-logout:hover,
  .tab-logout:hover {
    color: var(--ink);
  }
  .card:hover {
    background: var(--surface-2);
  }
  button.chip:hover {
    border-color: var(--ink-dim);
  }
  .assign-opt:hover {
    background: var(--surface-2);
  }
  .link:hover span {
    text-decoration: underline;
  }
  .link:hover .arrow {
    color: var(--ink);
  }
}

/* ---------- desktop, a second deliberate layout ---------- */

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 184px minmax(340px, 400px) 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
  }

  /* left rail */
  .tabs {
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 16px 10px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: var(--bg);
  }

  .app-mark {
    display: block;
    padding: 4px 12px 18px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .tabs-group {
    flex-direction: column;
    flex: 1;
    gap: 2px;
  }

  .tab {
    flex: 0 0 auto;
    justify-content: flex-start;
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--r-ctl);
    transition: background-color 120ms ease, color 120ms ease;
  }

  .tab.is-active {
    background: var(--surface-2);
  }

  .tab.is-active::after {
    top: auto;
    bottom: 7px;
    left: 12px;
    translate: 0 0;
    width: 16px;
  }

  .tab-logout {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
    color: var(--ink-dim);
    border-radius: var(--r-ctl);
    transition: color 120ms ease, background-color 120ms ease;
  }

  /* master list column */
  .main {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .head-row {
    display: none;
  }

  .head-controls {
    padding: 14px 16px 12px;
  }

  .head-note {
    padding: 14px 16px 12px;
  }

  /* flat rows instead of cards */
  .list {
    gap: 0;
    padding: 0 0 8px;
  }

  .list > li {
    border-bottom: 1px solid var(--line);
  }

  .card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 12px 16px;
  }

  .card:active {
    transform: none;
  }

  .card.is-cursor {
    background: var(--surface);
  }

  .card.is-selected,
  .card.is-selected.is-cursor {
    background: var(--surface-2);
  }

  .ritem {
    margin: 12px 16px 0;
  }

  /* detail pane */
  .backdrop {
    display: none;
  }

  .detail {
    position: static;
    transform: none;
    visibility: visible;
    transition: none;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    min-width: 0;
    height: 100%;
    min-height: 0;
  }

  .grabber {
    display: none;
  }

  .detail-scroll {
    padding: 12px 32px 40px;
  }

  .d-head {
    background: var(--bg);
  }

  .sheet-close {
    display: none;
  }

  .pane-empty {
    min-height: 70vh;
  }

  /* tighter controls with a mouse */
  .btn {
    min-height: 36px;
  }

  .btn-sm {
    min-height: 30px;
  }

  .input,
  .search,
  .status-select {
    min-height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 14px;
  }

  .textarea {
    font-size: 14px;
  }

  .seg-btn {
    min-height: 28px;
  }

  .task,
  .link,
  .assign-opt {
    min-height: 36px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .toast {
    left: auto;
    right: 20px;
    bottom: 20px;
    justify-content: flex-end;
  }
}

/* ---------- reduced motion: crossfades only ---------- */

@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled),
  .card:active,
  .icon-btn:active,
  button.chip:active {
    transform: none;
  }

  .handled .chev {
    transition: none;
  }

  .toast-msg {
    transform: none;
    transition: opacity 200ms ease;
  }

  .toast-msg.is-out {
    transition-duration: 120ms;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 899px) {
  .detail {
    transform: none;
    opacity: 0;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
  }

  .detail.is-open {
    opacity: 1;
    transition: opacity 200ms ease;
  }
}
