:root {
  color-scheme: dark;
  --bg: oklch(13% 0.014 98);
  --paper: oklch(20% 0.012 98);
  --paper-soft: oklch(17% 0.012 98);
  --paper-elevated: oklch(23% 0.014 98);
  --control: oklch(25% 0.012 98);
  --control-hover: oklch(29% 0.015 98);
  --ink: oklch(94% 0.012 96);
  --muted: oklch(70% 0.015 98);
  --subtle: oklch(54% 0.015 98);
  --line: oklch(33% 0.013 98);
  --line-strong: oklch(45% 0.018 98);
  --blue: oklch(74% 0.12 238);
  --green: oklch(78% 0.13 156);
  --coral: oklch(74% 0.15 35);
  --yellow: oklch(84% 0.13 92);
  --violet: oklch(76% 0.12 292);
  --action: oklch(78% 0.13 156);
  --action-hover: oklch(72% 0.14 156);
  --on-action: oklch(12% 0.012 98);
  --shadow: 0 26px 80px oklch(7% 0.02 98 / 0.52);
  --radius: 8px;
  --font-body: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, oklch(13% 0.014 98) 0%, oklch(15% 0.018 145) 52%, oklch(14% 0.018 35) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: oklch(99% 0.003 250 / 0.86);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
}

.brand-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.05;
  font-weight: 700;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  min-height: 46px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button svg {
  width: 18px;
  height: 18px;
}

.nav-button:hover {
  background: oklch(94% 0.01 250);
}

.nav-button.is-active {
  color: white;
  background: var(--ink);
}

.nav-count {
  min-width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: oklch(92% 0.01 250);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.is-active .nav-count {
  background: oklch(100% 0 0 / 0.16);
  color: white;
}

.vault-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px;
}

.vault-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vault-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: oklch(42% 0.12 160);
  font-family: var(--font-mono);
  font-size: 11px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px oklch(62% 0.15 160 / 0.14);
}

.sync-pill.is-demo {
  color: oklch(42% 0.11 92);
}

.sync-pill.is-demo .sync-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 4px oklch(78% 0.14 92 / 0.18);
}

.vault-name {
  margin: 10px 0 0;
  font-weight: 700;
}

.vault-path {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: oklch(97% 0.004 250 / 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
  max-width: 560px;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px 0 42px;
  outline: 0;
  transition: border 160ms ease, box-shadow 160ms ease;
}

.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px oklch(56% 0.18 245 / 0.13);
}

.icon-button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 160ms ease, background 160ms ease, border 160ms ease, opacity 160ms ease;
}

.icon-button {
  width: 44px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}

.icon-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: oklch(98% 0.004 250);
}

.primary-button {
  padding: 0 16px;
  color: white;
  background: var(--ink);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: oklch(24% 0.018 250);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.icon-button:disabled,
.ghost-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.secondary-button,
.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}

.ghost-button {
  background: transparent;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
}

.status-button {
  font-family: var(--font-mono);
  font-size: 12px;
}

.notice {
  width: min(1320px, calc(100% - 48px));
  min-height: 46px;
  margin: 14px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid oklch(83% 0.06 92);
  border-radius: var(--radius);
  background: oklch(97% 0.045 92);
  color: oklch(34% 0.08 92);
  padding: 8px 8px 8px 14px;
  font-size: 14px;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: oklch(18% 0.02 250 / 0.34);
  backdrop-filter: blur(10px);
  animation: fade 160ms ease both;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.auth-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
}

.auth-icon svg {
  width: 21px;
  height: 21px;
}

.auth-card h2 {
  margin-bottom: 0;
}

.auth-card .subcopy {
  margin-top: -6px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
}

.content {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.screen {
  animation: rise 220ms ease both;
}

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

.screen-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 44px;
  margin-bottom: 16px;
}

.screen-header .kicker {
  margin-bottom: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.fetch-result.is-running svg,
.mail-cleanup-state.is-running svg {
  animation: spin 900ms linear infinite;
}

.mail-cleanup-card {
  width: min(560px, 100%);
  gap: 16px;
}

.mail-cleanup-icon {
  background: var(--action);
  color: var(--on-action);
}

.mail-cleanup-card h2 {
  margin: 4px 0 0;
}

.mail-cleanup-card > .subcopy {
  margin: -4px 0 0;
  text-transform: none;
  font-size: 14px;
  font-weight: 400;
}

.mail-cleanup-rules {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.mail-cleanup-rules p {
  margin: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mail-cleanup-rules svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--ink);
}

.mail-cleanup-state {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 9px 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mail-cleanup-state svg {
  width: 17px;
  height: 17px;
}

.mail-cleanup-state.is-ready,
.mail-cleanup-state.is-success {
  color: var(--green);
}

.mail-cleanup-state.is-queued {
  color: var(--yellow);
}

.mail-cleanup-state.is-running,
.mail-cleanup-state.is-failed {
  color: var(--coral);
}

.mail-cleanup-note {
  margin: -6px 0 0;
  color: var(--yellow);
  font-size: 12px;
  line-height: 1.45;
}

.mail-cleanup-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 10px 12px;
}

.mail-cleanup-summary summary {
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

.mail-cleanup-summary p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.mail-cleanup-actions {
  justify-content: flex-end;
}

.fetch-center {
  display: grid;
  gap: 8px;
  margin: -2px 0 20px;
}

.fetch-center-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: end;
  padding: 0 2px 4px;
}

.fetch-center-header .kicker {
  margin-bottom: 3px;
}

.fetch-center-header h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}

.fetch-center-header > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.fetch-row {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) auto minmax(280px, 1.1fr);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 12px 14px;
}

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

.fetch-label > svg {
  width: 20px;
  height: 20px;
  color: var(--ink);
  flex: 0 0 auto;
}

.fetch-label span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.fetch-label strong {
  color: var(--ink);
  font-size: 14px;
}

.fetch-label small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.fetch-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.fetch-result {
  display: grid;
  justify-content: flex-end;
  justify-items: end;
  gap: 6px;
  min-width: 0;
}

.fetch-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
}

.fetch-status svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.fetch-result.is-ready .fetch-status,
.fetch-result.is-success .fetch-status {
  color: var(--green);
}

.fetch-result.is-queued .fetch-status {
  color: var(--yellow);
}

.fetch-result.is-running .fetch-status,
.fetch-result.is-failed .fetch-status {
  color: var(--coral);
}

.fetch-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
}

.fetch-metrics > span {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
}

.fetch-metrics > span + span {
  margin-left: 9px;
  border-left: 1px solid var(--line);
  padding-left: 9px;
}

.fetch-metrics strong {
  color: var(--ink);
  font-size: 11px;
}

.epost-cleanup-card {
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.93;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.25;
}

.subcopy {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px;
  min-height: 104px;
}

.metric-value {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.metric-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(100% 0 0 / 0.9);
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.8) inset;
  overflow: hidden;
}

.panel-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.panel-body {
  padding: 14px;
}

.task-list,
.inbox-list,
.project-list,
.timeline-list {
  display: grid;
  gap: 10px;
}

.task-card,
.inbox-card,
.project-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px;
  transition: transform 160ms ease, border 160ms ease, box-shadow 160ms ease;
}

.task-card:hover,
.inbox-card:hover,
.project-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px oklch(18% 0.02 250 / 0.08);
}

.task-top,
.inbox-top,
.project-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.task-card .task-top {
  grid-template-columns: auto minmax(0, 1fr);
}

.check-button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: transparent;
  background: white;
  display: grid;
  place-items: center;
  transition: background 160ms ease, color 160ms ease, border 160ms ease;
}

.check-button svg {
  width: 17px;
  height: 17px;
}

.check-button.is-done {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.check-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.check-button.is-saving {
  color: var(--blue);
  border-color: oklch(83% 0.06 245);
  background: oklch(96% 0.025 245);
}

.check-button.is-saving svg,
.primary-button.is-saving svg {
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.task-title,
.inbox-title,
.project-title {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
}

.text-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 700;
  line-height: 1.25;
}

.text-action:hover {
  color: var(--blue);
}

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

.inbox-excerpt {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: oklch(98% 0.005 250);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.tag.blue {
  color: oklch(40% 0.14 245);
  background: oklch(94% 0.04 245);
  border-color: oklch(83% 0.06 245);
}

.tag.green {
  color: oklch(39% 0.12 160);
  background: oklch(94% 0.04 160);
  border-color: oklch(82% 0.06 160);
}

.tag.coral {
  color: oklch(44% 0.14 35);
  background: oklch(95% 0.04 35);
  border-color: oklch(84% 0.08 35);
}

.tag.orange {
  color: oklch(42% 0.13 58);
  background: oklch(95% 0.045 58);
  border-color: oklch(84% 0.08 58);
}

.tag.yellow {
  color: oklch(42% 0.11 92);
  background: oklch(96% 0.055 92);
  border-color: oklch(86% 0.09 92);
}

.tag.violet {
  color: oklch(42% 0.13 292);
  background: oklch(95% 0.04 292);
  border-color: oklch(84% 0.07 292);
}

.mini-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  display: grid;
  place-items: center;
}

.mini-action:hover {
  border-color: var(--line-strong);
}

.mini-action:disabled {
  cursor: wait;
  opacity: 0.54;
}

.mini-action:disabled svg[data-lucide="loader-circle"] {
  animation: spin 850ms linear infinite;
}

.mini-action svg {
  width: 16px;
  height: 16px;
}

.focus-strip {
  display: grid;
  gap: 10px;
}

.focus-item {
  border-left: 4px solid var(--blue);
  background: oklch(98% 0.005 250);
  padding: 12px;
  border-radius: 6px;
}

.focus-item:nth-child(2) {
  border-left-color: var(--coral);
}

.focus-item:nth-child(3) {
  border-left-color: var(--green);
}

.focus-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.focus-text {
  margin: 0;
  line-height: 1.35;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-accent {
  width: 10px;
  height: 42px;
  border-radius: 999px;
  background: var(--blue);
}

.project-accent.green {
  background: var(--green);
}

.project-accent.coral {
  background: var(--coral);
}

.project-accent.orange {
  background: oklch(71% 0.15 58);
}

.project-accent.violet {
  background: var(--violet);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: oklch(92% 0.01 250);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.project-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-band {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(100% 0 0 / 0.72);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr 0.9fr 0.9fr;
  gap: 10px;
}

.filter-field {
  display: grid;
  gap: 6px;
}

.filter-field span,
.filter-summary {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.filter-field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
}

.filter-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px oklch(56% 0.18 245 / 0.12);
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.table tr:last-child td {
  border-bottom: 0;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(340px, 1.18fr);
  gap: 16px;
}

.habit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(340px, 0.84fr);
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

.habit-list {
  display: grid;
  gap: 10px;
}

.habit-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px;
}

.habit-card.is-paused {
  opacity: 0.62;
}

.habit-card.is-skipped {
  border-color: oklch(74% 0.13 92 / 0.42);
}

.habit-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.habit-title {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.28;
}

.habit-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.habit-dot {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.habit-dot.is-due {
  background: var(--control);
  border: 1px solid var(--line);
}

.habit-dot.is-done {
  background: var(--green);
}

.habit-dot.is-skipped {
  background: var(--yellow);
}

.habit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.weekday-toggle.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.toggle-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.calendar-box {
  display: grid;
  gap: 10px;
}

.calendar-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.settings-card.is-wide {
  grid-column: 1 / -1;
}

.settings-card-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-action {
  min-height: 36px;
  margin-left: auto;
  padding: 0 10px;
  font-size: 12px;
}

.settings-card-head h2 {
  margin: 0;
  font-size: 17px;
}

.settings-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(97% 0.006 250);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.settings-icon svg {
  width: 17px;
  height: 17px;
}

.settings-rows {
  display: grid;
  border-top: 1px solid var(--line);
}

.settings-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-key {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  text-transform: uppercase;
}

.settings-value {
  min-width: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.settings-value.is-green {
  color: oklch(39% 0.12 160);
}

.settings-value.is-yellow {
  color: oklch(42% 0.11 92);
}

.review-checks {
  display: grid;
  gap: 10px;
}

.review-check {
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: white;
}

.markdown-preview {
  min-height: 420px;
  margin: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: oklch(18% 0.012 250);
  color: oklch(94% 0.006 250);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
}

.command-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: start center;
  padding: 9vh 16px 16px;
  background: oklch(18% 0.02 250 / 0.26);
  backdrop-filter: blur(10px);
  animation: fade 160ms ease both;
}

.command-panel {
  width: min(680px, 100%);
  max-height: min(680px, 82vh);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.command-search {
  min-height: 62px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.command-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.command-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}

.command-list {
  padding: 8px;
  overflow: auto;
}

.command-group {
  margin: 12px 8px 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.command-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.command-item:hover,
.command-item:focus {
  background: oklch(96% 0.006 250);
  outline: 0;
}

.command-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

.command-icon svg {
  width: 17px;
  height: 17px;
}

.command-item strong,
.command-item small {
  display: block;
}

.command-item strong {
  font-size: 14px;
  line-height: 1.25;
}

.command-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

kbd {
  min-width: 28px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 6px;
  background: oklch(98% 0.004 250);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.capture-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: oklch(18% 0.02 250 / 0.26);
  display: flex;
  justify-content: flex-end;
  animation: fade 160ms ease both;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: oklch(18% 0.02 250 / 0.24);
  display: flex;
  justify-content: flex-end;
  animation: fade 160ms ease both;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.capture-panel,
.detail-panel {
  width: min(480px, 100%);
  height: 100%;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: slide-in 200ms ease both;
}

.detail-panel {
  width: min(560px, 100%);
}

@keyframes slide-in {
  from { transform: translateX(24px); }
  to { transform: translateX(0); }
}

.capture-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.task-detail-title {
  min-width: 0;
}

.task-detail-title h2 {
  overflow-wrap: anywhere;
}

.task-detail-header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

.detail-done-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.detail-done-button.is-done {
  border-color: var(--green);
  background: oklch(96% 0.035 155);
  color: var(--green);
}

.capture-body {
  padding: 16px;
  display: grid;
  gap: 14px;
  overflow: auto;
}

.detail-body {
  padding: 16px;
  display: grid;
  gap: 14px;
  overflow: auto;
}

.planning-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(98% 0.004 250);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.segment-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.segment-row.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

.segment-button:hover {
  border-color: var(--line-strong);
}

.segment-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.segment-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-value {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-link {
  min-width: 0;
  justify-self: start;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-inline-action {
  justify-self: start;
}

.linked-note-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 9px 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.linked-note-preview p {
  margin: 0;
}

.linked-note-preview p + p {
  margin-top: 6px;
}

.linked-note-preview a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linked-note-preview .note-action-link-mail {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: oklch(97% 0.012 245);
  font-weight: 700;
  text-decoration: none;
}

.linked-note-preview .note-action-link-mail:hover {
  border-color: var(--blue);
  background: oklch(96% 0.025 245);
}

.detail-preview {
  min-height: 260px;
  max-height: 42vh;
}

.loading-row {
  min-height: 86px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.loading-row svg {
  width: 18px;
  height: 18px;
  animation: spin 850ms linear infinite;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 12px;
  outline: 0;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px oklch(56% 0.18 245 / 0.12);
}

.error {
  margin: -4px 0 0;
  color: var(--coral);
  font-size: 13px;
}

.capture-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.mobile-nav {
  display: none;
}

.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;
}

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

  .sidebar {
    display: none;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .topbar .secondary-button {
    display: none;
  }

  .content {
    padding: 18px 12px 92px;
  }

  .work-grid,
  .review-grid,
  .habit-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .fetch-row {
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  }

  .fetch-result {
    grid-column: 1 / -1;
    justify-content: stretch;
    justify-items: start;
  }

  .fetch-status,
  .fetch-metrics {
    justify-content: flex-start;
    text-align: left;
  }

  .settings-card.is-wide {
    grid-column: auto;
  }

  .filter-band {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-summary {
    justify-content: space-between;
  }

  .metric-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: clamp(38px, 12vw, 62px);
  }

  .mobile-nav {
    position: fixed;
    z-index: 30;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: oklch(100% 0 0 / 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    min-height: 54px;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
  }

  .mobile-nav button.is-active {
    color: white;
    background: var(--ink);
  }

  .mobile-nav svg {
    width: 21px;
    height: 21px;
  }
}

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

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .metric {
    min-height: 96px;
  }

  .topbar {
    min-height: 66px;
  }

  .search input {
    height: 44px;
  }

  .screen-header {
    margin-bottom: 12px;
  }

  .fetch-center {
    margin-bottom: 14px;
  }

  .fetch-center-header {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .fetch-center-header > p {
    text-align: left;
  }

  .task-detail-header-actions {
    gap: 6px;
  }

  .detail-done-button {
    width: 44px;
    padding: 0;
  }

  .detail-done-button span {
    display: none;
  }

  .detail-actions .detail-link {
    width: 100%;
    justify-content: center;
  }

  .fetch-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .fetch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fetch-row + .fetch-row .fetch-actions {
    grid-template-columns: 1fr;
  }

  .fetch-actions button {
    min-width: 0;
    padding-inline: 9px;
  }

  .fetch-result {
    grid-column: auto;
  }

  .fetch-metrics {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .fetch-metrics > span + span {
    margin-left: 0;
    border-left: 0;
    padding-left: 0;
  }

  .epost-cleanup-card {
    gap: 12px;
    padding: 16px;
  }

  #habit-time {
    width: min(142px, 100%);
    min-height: 40px;
    padding: 8px 10px;
    font-size: 15px;
    line-height: 1.2;
    text-align: left;
    text-align-last: left;
    justify-self: start;
  }

  #habit-time::-webkit-date-and-time-value {
    text-align: left;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tr {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    column-gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 12px 0 18px;
  }

  .table td {
    border-bottom: 0;
    padding: 4px 0;
  }

  .table .task-status-cell {
    grid-column: 1;
    grid-row: 1;
    padding-top: 5px;
  }

  .table .task-status-cell .check-button {
    width: 18px;
    height: 18px;
  }

  .table .task-status-cell .check-button svg {
    width: 11px;
    height: 11px;
  }

  .table .task-title-cell {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .table .task-title-cell .text-action {
    display: block;
    width: 100%;
  }

  .table .task-project-cell,
  .table .task-due-cell {
    grid-column: 2;
  }

  .table .task-project-cell {
    padding-top: 10px;
  }
}

/* Dark cockpit surface pass */
::selection {
  background: oklch(78% 0.13 156 / 0.28);
}

::placeholder {
  color: oklch(62% 0.014 98);
}

a {
  color: var(--blue);
}

input,
select,
textarea {
  color-scheme: dark;
}

.sidebar {
  background: oklch(17% 0.012 98 / 0.88);
}

.topbar {
  background: oklch(15% 0.014 98 / 0.86);
}

.brand-mark,
.nav-button.is-active,
.primary-button,
.auth-icon,
.progress span,
.segment-button.is-active,
.mobile-nav button.is-active {
  border-color: transparent;
  background: var(--action);
  color: var(--on-action);
}

.primary-button:hover {
  background: var(--action-hover);
  color: var(--on-action);
}

.is-active .nav-count {
  background: oklch(12% 0.012 98 / 0.18);
  color: var(--on-action);
}

.nav-count,
kbd {
  background: var(--control);
  color: var(--muted);
}

.nav-button:hover,
.icon-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.command-item:hover,
.command-item:focus,
.segment-button:hover,
.weekday-toggle:hover {
  background: var(--control-hover);
}

.vault-card,
.metric,
.task-card,
.inbox-card,
.project-card,
.timeline-card,
.settings-card,
.auth-card,
.command-panel,
.capture-panel,
.detail-panel {
  background: var(--paper);
}

.panel,
.filter-band,
.mobile-nav {
  background: oklch(19% 0.012 98 / 0.88);
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.04) inset, var(--shadow);
}

.task-card:hover,
.inbox-card:hover,
.project-card:hover {
  box-shadow: 0 12px 32px oklch(7% 0.02 98 / 0.42);
}

.search input,
.icon-button,
.secondary-button,
.ghost-button,
.mini-action,
.filter-field select,
.review-check,
.habit-card,
.weekday-toggle,
.calendar-box input,
.command-icon,
.segment-button,
.linked-note-preview,
.field input,
.field select,
.field textarea {
  background: var(--control);
  color: var(--ink);
  border-color: var(--line);
}

.weekday-toggle.is-active {
  border-color: transparent;
  background: var(--action);
  color: var(--on-action);
}

.habit-dot {
  background: oklch(31% 0.012 98);
}

.habit-dot.is-due {
  background: var(--control);
  border-color: var(--line);
}

.habit-dot.is-done {
  background: var(--green);
}

.habit-dot.is-skipped {
  background: var(--yellow);
}

select option {
  background: var(--paper);
  color: var(--ink);
}

.search input:focus,
.filter-field select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px oklch(74% 0.12 238 / 0.16);
}

.focus-item,
.planning-block,
.settings-icon {
  background: var(--paper-soft);
}

.check-button {
  background: var(--control);
  border-color: var(--line-strong);
}

.check-button.is-done {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-action);
}

.check-button.is-saving {
  background: oklch(27% 0.045 238);
  border-color: oklch(48% 0.08 238);
  color: var(--blue);
}

.tag {
  background: oklch(25% 0.014 98);
  color: var(--muted);
  border-color: var(--line);
}

.tag.blue {
  color: oklch(82% 0.09 238);
  background: oklch(28% 0.055 238);
  border-color: oklch(48% 0.08 238);
}

.tag.green {
  color: oklch(84% 0.11 156);
  background: oklch(28% 0.052 156);
  border-color: oklch(48% 0.08 156);
}

.tag.coral {
  color: oklch(84% 0.11 35);
  background: oklch(30% 0.055 35);
  border-color: oklch(50% 0.08 35);
}

.tag.orange {
  color: oklch(85% 0.11 58);
  background: oklch(29% 0.056 58);
  border-color: oklch(50% 0.08 58);
}

.tag.yellow {
  color: oklch(88% 0.11 92);
  background: oklch(31% 0.06 92);
  border-color: oklch(52% 0.08 92);
}

.tag.violet {
  color: oklch(84% 0.09 292);
  background: oklch(29% 0.052 292);
  border-color: oklch(50% 0.075 292);
}

.notice {
  background: oklch(28% 0.052 92);
  border-color: oklch(52% 0.08 92);
  color: oklch(89% 0.11 92);
}

.sync-pill,
.settings-value.is-green {
  color: oklch(84% 0.11 156);
}

.sync-pill.is-demo,
.settings-value.is-yellow {
  color: oklch(88% 0.11 92);
}

.sync-dot {
  box-shadow: 0 0 0 4px oklch(78% 0.13 156 / 0.14);
}

.sync-pill.is-demo .sync-dot {
  box-shadow: 0 0 0 4px oklch(84% 0.13 92 / 0.16);
}

.progress {
  background: oklch(27% 0.014 98);
}

.markdown-preview {
  background: oklch(12% 0.012 98);
  color: oklch(90% 0.014 96);
}

.auth-backdrop,
.command-backdrop,
.capture-backdrop,
.detail-backdrop {
  background: oklch(7% 0.012 98 / 0.62);
}

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

.linked-note-preview .note-action-link-mail {
  color: var(--ink);
  background: oklch(27% 0.035 238);
}

.linked-note-preview .note-action-link-mail:hover {
  background: oklch(31% 0.052 238);
}

.text-action:hover,
.linked-note-preview a {
  color: var(--blue);
}
