:root {
  color-scheme: light;
  --navy-950: #102c35;
  --navy-900: #183b45;
  --navy-800: #234d56;
  --teal-700: #2b6f69;
  --teal-600: #37857c;
  --teal-100: #dcece7;
  --violet-700: #68588d;
  --violet-100: #ece7f4;
  --coral-700: #ac5146;
  --coral-500: #de765c;
  --coral-100: #fae6de;
  --amber-700: #8e632e;
  --amber-100: #f6ead3;
  --green-700: #47715b;
  --green-100: #e2eee5;
  --paper: #f5f1e8;
  --paper-deep: #eae5d9;
  --surface: #fffdf8;
  --surface-soft: #faf7ef;
  --line: #d9d5c9;
  --line-strong: #c5c2b7;
  --ink: #173038;
  --muted: #647279;
  --shadow-sm: 0 2px 10px rgba(19, 44, 53, 0.07);
  --shadow-md: 0 16px 48px rgba(19, 44, 53, 0.13);
  --shadow-lg: 0 32px 100px rgba(19, 44, 53, 0.24);
  --radius-xs: 7px;
  --radius-sm: 11px;
  --radius: 16px;
  --radius-lg: 24px;
  --focus: 0 0 0 3px rgba(222, 118, 92, 0.36);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); }
body, button, input, textarea, select { font: inherit; }
button, input, textarea, select { color: inherit; }
button { border: 0; }
a { color: var(--teal-700); }
code, pre, kbd { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
h1, h2, h3, h4, p { margin-top: 0; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

button:disabled { cursor: not-allowed; opacity: 0.45; }
.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: fixed; z-index: 300; top: 0.75rem; left: 0.75rem; padding: 0.65rem 0.85rem; color: white; background: var(--navy-950); border-radius: var(--radius-xs); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

.eyebrow {
  margin-bottom: 0.32rem;
  color: var(--teal-700);
  font-size: 0.69rem;
  font-weight: 820;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.attention-eyebrow { color: var(--coral-700); }

.button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  padding: 0.62rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1;
}

.button-primary { color: #fff; background: var(--navy-900); border-color: var(--navy-900); box-shadow: 0 4px 12px rgba(24, 59, 69, 0.16); }
.button-primary:hover:not(:disabled) { background: var(--teal-700); border-color: var(--teal-700); }
.button-secondary { color: var(--navy-900); background: var(--surface); border-color: var(--line-strong); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: var(--paper-deep); border-color: var(--line-strong); }
.button-quiet { color: var(--navy-900); background: transparent; border-color: transparent; box-shadow: none; }
.danger-button { color: var(--coral-700); background: transparent; border-color: rgba(172, 81, 70, 0.25); box-shadow: none; }
.danger-button:hover:not(:disabled) { background: var(--coral-100); border-color: rgba(172, 81, 70, 0.42); }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; color: var(--muted); background: transparent; border-radius: var(--radius-xs); cursor: pointer; font-size: 1.1rem; font-weight: 800; }
.icon-button:hover { color: var(--ink); background: var(--paper-deep); }
.text-action { padding: 0.25rem 0.38rem; color: var(--teal-700); background: transparent; border-radius: 5px; cursor: pointer; font-size: 0.72rem; font-weight: 780; }
.text-action:hover { background: var(--teal-100); }

/* First run */

.welcome-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.5rem;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 5vw, 4.5rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 45%, rgba(55, 133, 124, 0.11), transparent 27rem),
    radial-gradient(circle at 13% 7%, rgba(222, 118, 92, 0.08), transparent 18rem),
    var(--paper);
}

.welcome-brand, .app-brand {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  color: var(--navy-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.23rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-symbol {
  width: 39px;
  height: 39px;
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 10px;
  background: var(--navy-900);
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(24, 59, 69, 0.2);
}

.brand-symbol i { display: block; width: 5px; background: var(--surface); border-radius: 3px; }
.brand-symbol i:nth-child(1) { height: 10px; opacity: 0.72; }
.brand-symbol i:nth-child(2) { height: 18px; }
.brand-symbol i:nth-child(3) { height: 14px; opacity: 0.88; }
.brand-symbol-small { width: 35px; height: 35px; padding: 8px; border-radius: 9px; }

.welcome-card {
  width: min(1230px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 7rem);
  align-self: center;
  justify-self: center;
  padding: clamp(2rem, 5vw, 5.5rem);
}

.welcome-copy { position: relative; z-index: 2; }
.welcome-copy h1 {
  max-width: 720px;
  margin-bottom: 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 6vw, 6.25rem);
  font-weight: 500;
  letter-spacing: -0.064em;
  line-height: 0.95;
}

.welcome-lede { max-width: 650px; margin-bottom: 1.75rem; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.17rem); line-height: 1.7; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.welcome-actions .button { min-height: 48px; padding-inline: 1rem; }
.support-note { min-height: 1.25rem; margin: 0.9rem 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

.recent-workspace {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding: 0.75rem 0.85rem;
  text-align: left;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.recent-workspace > span:nth-child(2) { min-width: 0; display: grid; gap: 0.1rem; }
.recent-workspace small { color: var(--muted); font-size: 0.65rem; font-weight: 730; letter-spacing: 0.08em; text-transform: uppercase; }
.recent-workspace strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.81rem; }
.recent-icon { width: 31px; height: 31px; display: grid; place-items: center; background: var(--paper-deep); border-radius: 8px; }

.welcome-visual { position: relative; min-height: 440px; isolation: isolate; }
.visual-orbit { position: absolute; z-index: -1; border: 1px solid rgba(43, 111, 105, 0.17); border-radius: 50%; }
.visual-orbit-one { inset: 0 4% 2% 2%; }
.visual-orbit-two { inset: 13% -12% 15% 17%; }
.visual-card, .visual-note { position: absolute; background: rgba(255, 253, 248, 0.96); border: 1px solid rgba(23, 48, 56, 0.12); box-shadow: var(--shadow-md); }
.visual-card-main { top: 18%; right: 7%; width: min(390px, 82%); padding: 1.55rem; border-radius: 20px; transform: rotate(-1.5deg); }
.visual-label { display: inline-block; margin-bottom: 1.1rem; padding: 0.25rem 0.5rem; color: var(--violet-700); background: var(--violet-100); border-radius: 999px; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; }
.visual-card h2 { margin-bottom: 1.5rem; font: 560 clamp(1.5rem, 2.8vw, 2.1rem)/1.12 Georgia, serif; letter-spacing: -0.04em; }
.visual-meta { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.65rem; color: var(--muted); font-size: 0.69rem; }
.visual-progress { height: 5px; overflow: hidden; background: var(--paper-deep); border-radius: 5px; }
.visual-progress i { display: block; width: 62%; height: 100%; background: linear-gradient(90deg, var(--teal-600), var(--violet-700)); }
.visual-card-back { left: 0; bottom: 12%; width: 260px; display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; border-radius: var(--radius); transform: rotate(2.5deg); }
.visual-card-back div, .visual-note div { display: grid; gap: 0.15rem; }
.visual-card-back strong, .visual-note strong { font-size: 0.78rem; }
.visual-card-back small, .visual-note small { color: var(--muted); font-size: 0.66rem; }
.visual-dot { width: 11px; height: 11px; flex: 0 0 auto; background: var(--green-700); border: 3px solid var(--green-100); border-radius: 50%; box-sizing: content-box; }
.visual-note { top: 7%; left: 4%; display: flex; gap: 0.65rem; padding: 0.8rem 0.9rem; border-radius: 13px; transform: rotate(1.5deg); }
.visual-note > span { color: var(--violet-700); }
.welcome-trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem 2rem; color: var(--muted); font-size: 0.72rem; }
.welcome-trust span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Application shell */

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, auto) minmax(500px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0.65rem clamp(1rem, 2.5vw, 2rem);
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid rgba(23, 48, 56, 0.13);
  backdrop-filter: blur(18px);
}

.app-brand > span:last-child { display: grid; }
.app-brand strong { font: 700 1.02rem/1.1 Georgia, serif; }
.app-brand small { color: var(--muted); font: 600 0.58rem/1.2 Inter, sans-serif; letter-spacing: 0.04em; }
.workspace-identity { min-width: 0; display: flex; align-items: center; justify-self: center; gap: 0.6rem; }
.workspace-identity > span:last-child { min-width: 0; display: grid; gap: 0.06rem; }
.workspace-identity strong, .workspace-identity small { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-identity strong { font-size: 0.76rem; }
.workspace-identity small { color: var(--muted); font-size: 0.65rem; }
.connection-dot { width: 9px; height: 9px; flex: 0 0 auto; background: #99a4a6; border-radius: 50%; box-shadow: 0 0 0 4px rgba(153, 164, 166, 0.13); }
.connection-dot[data-state="saved"] { background: var(--green-700); box-shadow: 0 0 0 4px var(--green-100); }
.connection-dot[data-state="dirty"] { background: var(--coral-500); box-shadow: 0 0 0 4px var(--coral-100); }
.connection-dot[data-state="warning"] { background: var(--amber-700); box-shadow: 0 0 0 4px var(--amber-100); }
.connection-dot[data-state="saving"] { background: var(--teal-600); animation: pulse 1s ease-in-out infinite; }
.header-actions { display: flex; align-items: center; justify-self: end; gap: 0.2rem; }
.compact-button { min-height: 37px; padding: 0.55rem 0.7rem; font-size: 0.75rem; }
.mini-dot { width: 7px; height: 7px; background: #9ca6a8; border-radius: 50%; }
.mini-dot[data-state="connected"] { background: var(--green-700); }
.mini-dot[data-state="working"] { background: var(--violet-700); }
.mini-dot[data-state="stale"] { background: var(--amber-700); }

.menu {
  position: fixed;
  z-index: 100;
  top: 61px;
  right: 1rem;
  width: 230px;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.menu button { width: 100%; display: flex; gap: 0.7rem; padding: 0.68rem 0.72rem; text-align: left; background: transparent; border-radius: 8px; cursor: pointer; font-size: 0.78rem; }
.menu button:hover { background: var(--paper-deep); }
.menu button span { width: 17px; color: var(--muted); text-align: center; }
.menu hr { margin: 0.3rem; border: 0; border-top: 1px solid var(--line); }

.app-main { min-height: calc(100vh - 112px); padding: clamp(1rem, 2.5vw, 2rem); }
.attention-strip { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 auto 1.25rem; }
.attention-strip h1 { margin: 0; font: 560 clamp(1.75rem, 3vw, 2.6rem)/1 Georgia, serif; letter-spacing: -0.045em; }
.attention-counts { display: flex; align-items: center; gap: 0.35rem; }
.attention-count { display: flex; align-items: center; gap: 0.55rem; padding: 0.48rem 0.65rem; background: transparent; border-radius: 10px; cursor: pointer; }
.attention-count:hover { background: rgba(255, 253, 248, 0.7); }
.attention-count > span:last-child { display: grid; justify-items: start; }
.attention-count strong { font-size: 0.88rem; }
.attention-count small { color: var(--muted); font-size: 0.62rem; }
.attention-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; font-size: 0.7rem; font-weight: 850; }
.attention-icon.needs-you { color: var(--amber-700); background: var(--amber-100); }
.attention-icon.ai-working { color: var(--violet-700); background: var(--violet-100); }
.attention-icon.ai-updated { color: var(--teal-700); background: var(--teal-100); }

.workspace-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.72rem 0.85rem;
  color: var(--navy-900);
  background: var(--teal-100);
  border: 1px solid rgba(43, 111, 105, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.77rem;
}

.workspace-alert[data-tone="warning"] { color: #65451f; background: var(--amber-100); border-color: rgba(142, 99, 46, 0.24); }
.workspace-alert[data-tone="error"] { color: #74352e; background: var(--coral-100); border-color: rgba(172, 81, 70, 0.25); }
.alert-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.alert-actions button { padding: 0.38rem 0.52rem; background: rgba(255, 255, 255, 0.7); border-radius: 6px; cursor: pointer; font-size: 0.7rem; font-weight: 760; }

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0.15rem;
}

.search-field { position: relative; width: min(390px, 34vw); }
.search-field input { width: 100%; min-height: 40px; padding: 0.6rem 3.1rem 0.6rem 2.15rem; color: var(--ink); background: rgba(255, 253, 248, 0.86); border: 1px solid var(--line); border-radius: var(--radius-xs); }
.search-field input::placeholder { color: #8b9699; }
.search-icon { position: absolute; z-index: 1; left: 0.75rem; top: 0.52rem; color: var(--muted); font-size: 1.1rem; }
.search-field kbd { position: absolute; right: 0.55rem; top: 0.52rem; padding: 0.18rem 0.32rem; color: var(--muted); background: var(--paper-deep); border: 1px solid var(--line); border-radius: 4px; font-size: 0.6rem; }
.filter-badge { min-width: 17px; height: 17px; display: inline-grid; place-items: center; color: white; background: var(--coral-700); border-radius: 999px; font-size: 0.58rem; }
.quick-filters { display: flex; align-items: center; gap: 0.18rem; padding: 0.2rem; background: rgba(234, 229, 217, 0.72); border-radius: 9px; }
.quick-filters button { min-width: 34px; min-height: 31px; padding: 0.35rem 0.5rem; color: var(--muted); background: transparent; border-radius: 7px; cursor: pointer; font-size: 0.68rem; font-weight: 760; }
.quick-filters button[aria-pressed="true"] { color: var(--navy-900); background: var(--surface); box-shadow: var(--shadow-sm); }
.board-result-summary { display: grid; justify-items: end; gap: 0.05rem; margin-left: auto; }
.board-result-summary strong { font-size: 0.72rem; }
.board-result-summary span { color: var(--muted); font-size: 0.62rem; }

/* Board */

.board {
  min-height: calc(100vh - 275px);
  display: grid;
  grid-auto-columns: minmax(280px, 1fr);
  grid-auto-flow: column;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0 0 1.4rem;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--line-strong) transparent;
}

.board-column { min-width: 0; display: flex; flex-direction: column; scroll-snap-align: start; }
.column-header { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.48rem 0.5rem; }
.column-header > div { min-width: 0; display: flex; align-items: center; gap: 0.5rem; }
.column-header h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.77rem; letter-spacing: -0.01em; }
.column-header .column-count { min-width: 23px; padding: 0.17rem 0.4rem; color: var(--muted); background: var(--paper-deep); border-radius: 999px; text-align: center; font-size: 0.61rem; font-weight: 760; }
.column-dot { width: 8px; height: 8px; flex: 0 0 auto; background: var(--column-color); border-radius: 50%; }
.column-cards { min-height: 150px; display: grid; align-content: start; gap: 0.58rem; padding: 0.48rem; background: rgba(232, 227, 216, 0.64); border: 1px solid rgba(23, 48, 56, 0.075); border-radius: var(--radius); }
.column-cards.is-drop-target { background: rgba(220, 236, 231, 0.86); box-shadow: inset 0 0 0 2px rgba(43, 111, 105, 0.32); }

.kanban-card {
  position: relative;
  min-width: 0;
  padding: 0.88rem;
  background: var(--surface);
  border: 1px solid rgba(23, 48, 56, 0.11);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(23, 48, 56, 0.045);
  cursor: pointer;
}

.kanban-card:hover { border-color: rgba(43, 111, 105, 0.4); box-shadow: 0 7px 18px rgba(23, 48, 56, 0.08); transform: translateY(-1px); }
.kanban-card.is-dragging { opacity: 0.46; transform: rotate(1deg); }
.kanban-card[data-attention="needs_you"] { border-left: 3px solid var(--amber-700); }
.kanban-card[data-attention="ai_updated"] { border-left: 3px solid var(--violet-700); }
.kanban-card[data-attention="ai_working"] { border-left: 3px solid var(--teal-600); }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 0.55rem; margin-bottom: 0.62rem; }
.card-badges { display: flex; align-items: center; gap: 0.28rem; min-width: 0; }
.priority, .kind-badge, .recurring-badge { display: inline-flex; align-items: center; padding: 0.19rem 0.36rem; border-radius: 5px; font-size: 0.58rem; font-weight: 820; line-height: 1; }
.priority { color: var(--navy-900); background: var(--paper-deep); }
.priority[data-priority="P0"] { color: white; background: var(--coral-700); }
.priority[data-priority="P1"] { color: #744a22; background: #f4ddc5; }
.kind-badge { color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); font-weight: 700; text-transform: capitalize; }
.recurring-badge { color: var(--teal-700); background: var(--teal-100); }
.card-assignee { max-width: 115px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 0.61rem; }
.kanban-card h3 { margin-bottom: 0.4rem; font-size: 0.87rem; letter-spacing: -0.015em; line-height: 1.3; }
.card-description { margin-bottom: 0.72rem; color: var(--muted); font-size: 0.69rem; line-height: 1.48; }
.latest-preview { margin: 0.65rem 0; padding: 0.55rem 0.6rem; color: #40565d; background: var(--surface-soft); border-radius: 7px; font-size: 0.64rem; line-height: 1.45; }
.latest-preview strong { display: block; margin-bottom: 0.16rem; color: var(--teal-700); font-size: 0.57rem; letter-spacing: 0.06em; text-transform: uppercase; }
.attention-cue { display: inline-flex; align-items: center; gap: 0.32rem; margin-bottom: 0.62rem; padding: 0.28rem 0.43rem; border-radius: 6px; font-size: 0.6rem; font-weight: 750; }
.attention-cue[data-attention="needs_you"] { color: var(--amber-700); background: var(--amber-100); }
.attention-cue[data-attention="ai_updated"] { color: var(--violet-700); background: var(--violet-100); }
.attention-cue[data-attention="ai_working"] { color: var(--teal-700); background: var(--teal-100); }
.card-progress { height: 3px; margin-bottom: 0.62rem; overflow: hidden; background: var(--paper-deep); border-radius: 3px; }
.card-progress i { display: block; height: 100%; background: var(--teal-600); }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; color: var(--muted); font-size: 0.58rem; }
.card-footer > span { display: inline-flex; align-items: center; gap: 0.22rem; }
.card-primary-action { margin-top: 0.7rem; width: 100%; min-height: 31px; padding: 0.38rem; color: var(--teal-700); background: rgba(220, 236, 231, 0.55); border-radius: 7px; cursor: pointer; font-size: 0.64rem; font-weight: 790; }
.card-primary-action:hover { background: var(--teal-100); }
.card-move-actions { position: absolute; z-index: 2; top: 0.42rem; right: 0.42rem; display: none; gap: 0.15rem; padding: 0.15rem; background: rgba(255, 253, 248, 0.96); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow-sm); }
.kanban-card:hover .card-move-actions, .kanban-card:focus-within .card-move-actions { display: flex; }
.card-move-actions button { width: 25px; height: 25px; display: grid; place-items: center; padding: 0; color: var(--muted); background: transparent; border-radius: 5px; cursor: pointer; }
.card-move-actions button:hover { color: var(--ink); background: var(--paper-deep); }
.add-card-button { width: calc(100% - 0.96rem); min-height: 34px; margin: 0.4rem 0.48rem 0; color: var(--muted); background: transparent; border: 1px dashed rgba(23, 48, 56, 0.18); border-radius: 9px; cursor: pointer; font-size: 0.66rem; font-weight: 730; }
.add-card-button:hover { color: var(--teal-700); background: rgba(255, 253, 248, 0.5); border-color: rgba(43, 111, 105, 0.28); }
.column-empty { padding: 1.2rem 0.8rem; color: var(--muted); text-align: center; font-size: 0.66rem; line-height: 1.45; }

.quiet-state { max-width: 560px; margin: 10vh auto; padding: 2rem; text-align: center; }
.quiet-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 1rem; color: var(--teal-700); background: var(--teal-100); border-radius: 18px; font-size: 1.4rem; }
.quiet-state h2 { margin-bottom: 0.5rem; font: 560 1.8rem/1.15 Georgia, serif; letter-spacing: -0.035em; }
.quiet-state p { color: var(--muted); line-height: 1.55; }

/* Dialogs and forms */

.dialog {
  width: min(780px, calc(100vw - 2rem));
  max-height: min(900px, calc(100vh - 2rem));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(23, 48, 56, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop { background: rgba(12, 31, 38, 0.52); backdrop-filter: blur(4px); }
.dialog > form, .dialog > div:not(.detail-shell) { max-height: inherit; overflow: auto; padding: 1.25rem; }
.small-dialog { width: min(630px, calc(100vw - 2rem)); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.dialog-header h2 { margin: 0; font: 560 clamp(1.65rem, 4vw, 2.35rem)/1 Georgia, serif; letter-spacing: -0.045em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.field { min-width: 0; display: grid; gap: 0.35rem; }
.field-wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 0.63rem; font-weight: 780; letter-spacing: 0.075em; text-transform: uppercase; }
.field input, .field textarea, .field select, .handoff-dialog textarea {
  width: 100%;
  padding: 0.68rem 0.72rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}
.field textarea { resize: vertical; line-height: 1.52; }
.check-field { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); font-size: 0.75rem; }
.check-field input { width: 17px; height: 17px; accent-color: var(--teal-700); }
.dialog-footer { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.dialog-spacer { flex: 1; }

/* Card workspace */

.detail-dialog { width: min(1120px, calc(100vw - 2rem)); max-width: none; height: min(860px, calc(100vh - 2rem)); max-height: none; overflow: hidden; }
.detail-shell { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem 0.9rem; }
.detail-title-group { min-width: 0; }
.detail-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.36rem; margin-bottom: 0.32rem; color: var(--muted); font-size: 0.64rem; }
.detail-header h2 { max-width: 800px; margin: 0 0 0.5rem; font: 560 clamp(1.8rem, 4vw, 2.7rem)/1.04 Georgia, serif; letter-spacing: -0.045em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.meta-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.42rem; color: var(--muted); background: var(--paper); border-radius: 6px; font-size: 0.62rem; }
.detail-tabs { display: flex; gap: 0.15rem; overflow-x: auto; padding: 0 1.35rem; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.detail-tabs button { flex: 0 0 auto; padding: 0.68rem 0.72rem 0.6rem; color: var(--muted); background: transparent; border-bottom: 2px solid transparent; cursor: pointer; font-size: 0.71rem; font-weight: 740; }
.detail-tabs button[aria-selected="true"] { color: var(--navy-900); border-color: var(--teal-700); }
.detail-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 1.2rem 1.35rem 1.6rem; }
.detail-footer { display: flex; align-items: center; gap: 0.48rem; padding: 0.8rem 1.35rem; background: rgba(255, 253, 248, 0.97); border-top: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr); gap: 1rem; }
.detail-section { min-width: 0; padding: 1rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.detail-section + .detail-section { margin-top: 0.75rem; }
.detail-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.detail-section-header h3 { margin: 0; font-size: 0.86rem; }
.detail-section-header p { margin: 0.18rem 0 0; color: var(--muted); font-size: 0.66rem; }
.markdown { color: #354b52; font-size: 0.79rem; line-height: 1.65; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h3, .markdown h4 { color: var(--ink); }
.markdown code { padding: 0.08rem 0.23rem; background: var(--paper-deep); border-radius: 4px; font-size: 0.88em; }
.markdown pre { overflow: auto; padding: 0.7rem; background: var(--navy-950); border-radius: 8px; color: #e8f0ed; }
.fact-list { display: grid; gap: 0; margin: 0; }
.fact-list > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 0.7rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(217, 213, 201, 0.75); }
.fact-list dt { color: var(--muted); font-size: 0.62rem; }
.fact-list dd { margin: 0; overflow-wrap: anywhere; font-size: 0.71rem; font-weight: 660; }
.section-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.75rem; }
.section-actions .button { min-height: 34px; padding: 0.45rem 0.62rem; font-size: 0.68rem; }
.empty-message { padding: 1rem; color: var(--muted); text-align: center; font-size: 0.7rem; line-height: 1.5; }

.plan-list, .turn-list, .memory-list, .activity-list, .option-list, .output-list { display: grid; gap: 0.55rem; }
.plan-row { display: grid; grid-template-columns: 115px minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; padding: 0.62rem; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.plan-row select { width: 100%; padding: 0.38rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 0.66rem; }
.plan-row span { font-size: 0.73rem; }
.plan-state { padding: 0.2rem 0.35rem; color: var(--muted); background: var(--paper); border-radius: 5px; font-size: 0.59rem; font-weight: 730; }

.turn-card { padding: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.turn-card header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.turn-card h4 { margin: 0; font-size: 0.77rem; }
.turn-card p { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.69rem; line-height: 1.48; }
.status-label { display: inline-flex; align-items: center; padding: 0.2rem 0.38rem; color: var(--muted); background: var(--paper); border-radius: 999px; font-size: 0.58rem; font-weight: 780; text-transform: capitalize; }
.status-label[data-status="running"], .status-label[data-status="queued"], .status-label[data-status="claimed"] { color: var(--violet-700); background: var(--violet-100); }
.status-label[data-status="needs_input"] { color: var(--amber-700); background: var(--amber-100); }
.status-label[data-status="complete"], .status-label[data-status="approved"] { color: var(--green-700); background: var(--green-100); }
.status-label[data-status="failed"], .status-label[data-status="cancelled"] { color: var(--coral-700); background: var(--coral-100); }
.checkpoint-list { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.65rem; }
.question-card { margin-top: 0.55rem; padding: 0.65rem; background: var(--amber-100); border-radius: 8px; font-size: 0.7rem; }
.question-card strong { display: block; margin-bottom: 0.25rem; }

.briefing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.briefing-item { padding: 0.65rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.briefing-item strong { display: block; margin-bottom: 0.22rem; color: var(--muted); font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.07em; }
.briefing-item p { margin: 0; font-size: 0.7rem; line-height: 1.46; }
.phase-track { display: flex; gap: 0.2rem; overflow-x: auto; margin-bottom: 0.85rem; padding: 0.25rem; background: var(--paper); border-radius: 9px; }
.phase-track span { flex: 0 0 auto; padding: 0.32rem 0.44rem; color: var(--muted); border-radius: 6px; font-size: 0.58rem; text-transform: capitalize; }
.phase-track span.is-current { color: white; background: var(--teal-700); font-weight: 760; }
.option-card { padding: 0.78rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.option-card[data-status="rejected"] { opacity: 0.56; }
.option-card header { display: flex; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.48rem; }
.option-card h4 { margin: 0; font-size: 0.78rem; }
.option-card p { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.68rem; line-height: 1.48; }
.option-criteria { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.38rem; }
.option-criteria div { padding: 0.45rem; background: var(--surface-soft); border-radius: 7px; }
.option-criteria strong { display: block; margin-bottom: 0.12rem; color: var(--muted); font-size: 0.55rem; text-transform: uppercase; }
.option-criteria span { font-size: 0.63rem; line-height: 1.4; }

.memory-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.65rem; padding: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.memory-card h4 { margin: 0 0 0.28rem; font-size: 0.76rem; }
.memory-card p { margin-bottom: 0.36rem; color: var(--muted); font-size: 0.67rem; line-height: 1.48; }
.memory-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; color: var(--muted); font-size: 0.57rem; }
.memory-actions { display: flex; flex-direction: column; gap: 0.2rem; }
.memory-state { display: inline-flex; width: fit-content; margin-bottom: 0.35rem; padding: 0.2rem 0.36rem; color: var(--teal-700); background: var(--teal-100); border-radius: 5px; font-size: 0.56rem; font-weight: 760; text-transform: capitalize; }
.cycle-card { margin-bottom: 0.6rem; padding: 0.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.cycle-card h4 { margin-bottom: 0.35rem; font-size: 0.76rem; }
.cycle-card dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.35rem; margin: 0; }
.cycle-card dl > div { padding: 0.42rem; background: var(--surface-soft); border-radius: 6px; }
.cycle-card dt { color: var(--muted); font-size: 0.55rem; text-transform: uppercase; }
.cycle-card dd { margin: 0.12rem 0 0; font-size: 0.62rem; line-height: 1.4; }

.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 0.65rem; align-items: start; padding: 0.55rem 0.2rem; border-bottom: 1px solid rgba(217, 213, 201, 0.7); }
.activity-row > i { width: 8px; height: 8px; margin-top: 0.24rem; background: var(--teal-600); border-radius: 50%; }
.activity-row[data-actor-kind="ai"] > i { background: var(--violet-700); }
.activity-row > div { display: grid; gap: 0.1rem; }
.activity-row strong { font-size: 0.69rem; font-weight: 650; }
.activity-row span, .activity-row time { color: var(--muted); font-size: 0.58rem; }

/* Output surfaces */

.surface { position: relative; min-width: 0; padding: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.surface > header, .surface > footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.58rem; }
.surface > h4 { margin: 0.48rem 0; font-size: 0.78rem; }
.surface > footer { margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px solid rgba(217, 213, 201, 0.65); }
.surface-type { color: var(--teal-700); font-weight: 770; text-transform: uppercase; letter-spacing: 0.05em; }
.surface-content { min-width: 0; color: #3f555c; font-size: 0.7rem; line-height: 1.5; }
.surface-content pre { max-height: 340px; margin: 0; overflow: auto; padding: 0.65rem; color: #e8f0ed; background: var(--navy-950); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.surface-content a { overflow-wrap: anywhere; }
.status-surface { margin: 0; padding: 0.6rem; color: var(--green-700); background: var(--green-100); border-radius: 7px; font-weight: 700; }
.unsafe-content { margin: 0; padding: 0.55rem; color: var(--coral-700); background: var(--coral-100); border-radius: 7px; }
.surface-actions { display: flex; justify-content: flex-end; gap: 0.25rem; margin-top: 0.4rem; }
.table-wrap { overflow-x: auto; }
.table-filter { display: grid; gap: 0.25rem; margin-bottom: 0.45rem; color: var(--muted); font-size: 0.58rem; }
.table-filter input { padding: 0.42rem; border: 1px solid var(--line); border-radius: 6px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.64rem; }
.table-wrap th, .table-wrap td { max-width: 250px; padding: 0.42rem; overflow: hidden; border-bottom: 1px solid var(--line); text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap th button { padding: 0; color: var(--ink); background: transparent; cursor: pointer; font-size: inherit; font-weight: 780; }
.diff-view span { display: block; min-height: 1.15em; }
.diff-view span[data-kind="add"] { color: #aee6bf; background: rgba(70, 152, 91, 0.15); }
.diff-view span[data-kind="remove"] { color: #f1b3a5; background: rgba(172, 81, 70, 0.14); }
.image-preview { width: 100%; padding: 0; overflow: hidden; background: var(--paper); border-radius: 8px; cursor: zoom-in; }
.image-preview img { max-width: 100%; max-height: 400px; display: block; margin: auto; object-fit: contain; }
.surface-content.is-zoomed .image-preview img { max-height: none; }
.file-metadata { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; margin: 0; }
.file-metadata div { min-width: 0; padding: 0.45rem; background: var(--surface-soft); border-radius: 6px; }
.file-metadata dt { color: var(--muted); font-size: 0.54rem; text-transform: uppercase; }
.file-metadata dd { margin: 0.12rem 0 0; overflow-wrap: anywhere; font-size: 0.62rem; }

/* Agent, handoff, recovery */

.agent-dialog { width: min(760px, calc(100vw - 2rem)); }
.agent-connection-state { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; padding: 0.9rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.agent-state-icon { width: 40px; height: 40px; display: grid; place-items: center; color: var(--violet-700); background: var(--violet-100); border-radius: 12px; }
.agent-connection-state > div { display: grid; gap: 0.16rem; }
.agent-connection-state strong { font-size: 0.82rem; }
.agent-connection-state span { color: var(--muted); font-size: 0.69rem; }
.agent-start-guide { display: grid; gap: 0.5rem; }
.agent-start-guide > div { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; padding: 0.65rem; }
.step-number { width: 25px; height: 25px; display: grid; place-items: center; color: white; background: var(--teal-700); border-radius: 50%; font-size: 0.62rem; font-weight: 820; }
.agent-start-guide strong { font-size: 0.75rem; }
.agent-start-guide p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.45; }
.advanced-details { margin-top: 0.8rem; padding: 0.65rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 0.69rem; }
.advanced-details summary { color: var(--ink); cursor: pointer; font-weight: 720; }
.advanced-details p { line-height: 1.5; }
.copy-panel { margin-top: 0.55rem; padding: 0.55rem; background: var(--surface); border-radius: 7px; }
.copy-panel p { margin-bottom: 0.45rem; }
#agentDiagnostics { max-height: 130px; overflow: auto; padding: 0.55rem; color: #e8f0ed; background: var(--navy-950); border-radius: 7px; font-size: 0.58rem; white-space: pre-wrap; }

.handoff-card-field { margin-bottom: 0.8rem; }
.segmented-tabs { display: flex; gap: 0.2rem; margin-bottom: 0.9rem; padding: 0.22rem; background: var(--paper); border-radius: 9px; }
.segmented-tabs button, .format-toggle button { flex: 1; padding: 0.5rem; color: var(--muted); background: transparent; border-radius: 7px; cursor: pointer; font-size: 0.69rem; font-weight: 740; }
.segmented-tabs button[aria-selected="true"], .format-toggle button[aria-pressed="true"] { color: var(--navy-900); background: var(--surface); box-shadow: var(--shadow-sm); }
.handoff-dialog section > p { color: var(--muted); font-size: 0.73rem; line-height: 1.5; }
.handoff-dialog textarea { resize: vertical; font: 0.67rem/1.48 "SFMono-Regular", Consolas, monospace; }
.format-toggle { width: 170px; display: flex; gap: 0.15rem; margin: 0 0 0.45rem auto; padding: 0.17rem; background: var(--paper); border-radius: 7px; }
.format-toggle button { padding: 0.33rem; font-size: 0.62rem; }
.inline-actions, .recovery-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.handoff-preview { margin: 0.75rem 0; padding: 0.75rem; background: var(--teal-100); border-radius: 9px; font-size: 0.69rem; line-height: 1.5; }
.handoff-preview[data-tone="error"] { color: var(--coral-700); background: var(--coral-100); }
.handoff-preview pre { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 0.61rem; }
.handoff-preview dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }
.handoff-preview dt { color: var(--muted); font-size: 0.55rem; }
.handoff-preview dd { margin: 0.1rem 0 0; font-weight: 760; }
.caution-note { display: grid; gap: 0.12rem; margin-bottom: 0.8rem; padding: 0.65rem; color: #65451f; background: var(--amber-100); border-radius: 8px; }
.caution-note strong { font-size: 0.72rem; }
.caution-note span { font-size: 0.65rem; }
.comparison-list, .workspace-details { display: grid; grid-template-columns: 1fr 1fr; margin: 0.8rem 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.comparison-list > div, .workspace-details > div { min-width: 0; padding: 0.65rem; border-bottom: 1px solid var(--line); }
.comparison-list dt, .workspace-details dt { color: var(--muted); font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.06em; }
.comparison-list dd, .workspace-details dd { margin: 0.18rem 0 0; overflow-wrap: anywhere; font-size: 0.68rem; font-weight: 680; }

.provenance-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem 0.9rem; min-height: 42px; padding: 0.65rem 1rem max(0.65rem, env(safe-area-inset-bottom)); color: var(--muted); background: rgba(245, 241, 232, 0.9); border-top: 1px solid rgba(23, 48, 56, 0.08); font-size: 0.65rem; }
.provenance-footer a { color: var(--navy-800); font-weight: 720; text-underline-offset: 0.16em; }
.toast-region { position: fixed; z-index: 300; right: 1rem; bottom: 1rem; display: grid; gap: 0.45rem; }
.toast { max-width: min(390px, calc(100vw - 2rem)); padding: 0.72rem 0.85rem; color: white; background: var(--navy-900); border-radius: 9px; box-shadow: var(--shadow-md); font-size: 0.72rem; line-height: 1.45; }
.toast[data-tone="success"] { background: var(--green-700); }
.toast[data-tone="warning"] { background: var(--amber-700); }
.toast[data-tone="error"] { background: var(--coral-700); }
.loading-overlay { position: fixed; z-index: 400; inset: 0; display: grid; place-content: center; justify-items: center; gap: 0.7rem; color: var(--navy-900); background: rgba(245, 241, 232, 0.87); backdrop-filter: blur(6px); }
.loading-mark { width: 34px; height: 34px; border: 3px solid var(--teal-100); border-top-color: var(--teal-700); border-radius: 50%; animation: spin 800ms linear infinite; }
.loading-overlay strong { font: 560 1rem Georgia, serif; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }

@media (max-width: 1100px) {
  .app-header { grid-template-columns: minmax(170px, 1fr) auto; }
  .workspace-identity { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .welcome-card { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); gap: 2rem; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .welcome-shell { overflow-x: hidden; }
  .welcome-card { grid-template-columns: 1fr; padding: 2rem 0; }
  .welcome-copy h1 { max-width: 680px; }
  .welcome-visual { width: min(520px, 100%); min-height: 390px; margin: auto; }
  .attention-strip { align-items: flex-start; flex-direction: column; }
  .attention-counts { width: 100%; overflow-x: auto; }
  .attention-count { flex: 0 0 auto; }
  .board-toolbar { flex-wrap: wrap; }
  .search-field { width: min(100%, 440px); flex: 1 1 270px; }
  .board-result-summary { flex: 1 0 100%; align-items: start; justify-items: start; margin-left: 0; }
}

@media (max-width: 680px) {
  .app-header { position: relative; grid-template-columns: 1fr; gap: 0.55rem; }
  .app-brand { grid-row: 1; }
  .header-actions { width: 100%; grid-column: 1; grid-row: 2; justify-self: stretch; overflow-x: auto; padding-bottom: 0.1rem; }
  .header-actions .compact-button { flex: 0 0 auto; }
  .workspace-identity { grid-column: 1; grid-row: 3; }
  .menu { top: 102px; right: 0.75rem; }
  .app-main { padding: 0.75rem; }
  .attention-strip { margin-bottom: 0.85rem; }
  .attention-strip h1 { font-size: 2rem; }
  .board { min-height: 570px; grid-auto-columns: minmax(82vw, 1fr); }
  .quick-filters { max-width: 100%; overflow-x: auto; }
  .dialog { width: calc(100vw - 0.75rem); max-height: calc(100vh - 0.75rem); border-radius: 18px; }
  .dialog > form, .dialog > div:not(.detail-shell) { padding: 1rem; }
  .detail-dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .detail-header { padding: 1rem 0.85rem 0.75rem; }
  .detail-tabs { padding-inline: 0.85rem; }
  .detail-body { padding: 0.85rem; }
  .detail-footer { padding: 0.7rem 0.85rem max(0.7rem, env(safe-area-inset-bottom)); overflow-x: auto; }
  .detail-footer .button { flex: 0 0 auto; }
  .detail-header h2 { font-size: 1.85rem; }
  .form-grid, .briefing-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .option-criteria, .cycle-card dl { grid-template-columns: 1fr; }
  .plan-row { grid-template-columns: 1fr; }
  .file-metadata { grid-template-columns: 1fr; }
  .workspace-alert { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .welcome-shell { padding: 1rem 0.85rem; }
  .welcome-brand { font-size: 1.05rem; }
  .welcome-card { gap: 1rem; padding-top: 1.2rem; }
  .welcome-copy h1 { font-size: clamp(2.6rem, 14vw, 3.8rem); }
  .welcome-lede { font-size: 0.94rem; }
  .welcome-actions { align-items: stretch; flex-direction: column; }
  .welcome-actions .button { width: 100%; }
  .welcome-visual { min-height: 330px; }
  .visual-card-main { right: 2%; width: 91%; padding: 1.15rem; }
  .visual-card-back { bottom: 4%; width: 220px; }
  .visual-note { top: 2%; left: 0; }
  .welcome-trust { align-items: flex-start; flex-direction: column; margin-inline: auto; }
  .app-brand small { display: none; }
  .compact-button span:nth-child(2) { display: none; }
  .compact-button { width: 40px; padding: 0; }
  .header-actions #newCardButton { width: auto; padding-inline: 0.7rem; }
  .header-actions #newCardButton span:nth-child(2) { display: inline; }
  .attention-count { padding-inline: 0.35rem; }
  .attention-count small { font-size: 0.58rem; }
  .search-field kbd { display: none; }
  .search-field input { padding-right: 0.7rem; }
  .board { grid-auto-columns: minmax(88vw, 1fr); }
  .comparison-list, .workspace-details { grid-template-columns: 1fr; }
  .inline-actions, .recovery-actions { align-items: stretch; flex-direction: column; }
  .handoff-preview dl { grid-template-columns: 1fr; }
  .memory-card { grid-template-columns: 1fr; }
  .memory-actions { flex-direction: row; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
  .kanban-card, .button, .toast, .recent-workspace { transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease; }
}

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

@media print {
  .app-header, .attention-counts, .board-toolbar, .add-card-button, .card-move-actions, .provenance-footer { display: none !important; }
  .app-main { padding: 0; }
  .board { display: block; overflow: visible; }
  .board-column { break-inside: avoid; margin-bottom: 1rem; }
  .column-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
