:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #f8f9f7;
  --text: #17201b;
  --muted: #607068;
  --line: #d9dfda;
  --primary: #176b43;
  --primary-hover: #105535;
  --primary-soft: #e4f2e9;
  --warning: #7a4d05;
  --warning-bg: #fff4d6;
  --danger: #9b2c2c;
  --danger-bg: #fde8e8;
  --info: #24577a;
  --info-bg: #e5f2fa;
  --shadow: 0 8px 28px rgb(24 40 31 / 8%);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: var(--primary); }

button, input, select, textarea { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(10px);
}

.site-header__inner {
  width: min(100% - 32px, 1080px);
  min-height: 62px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav { display: flex; align-items: center; gap: 16px; }
.site-nav > a { color: var(--text); font-weight: 650; text-decoration: none; }
.site-nav form { margin: 0; }

.page-shell {
  width: min(100% - 32px, 1080px);
  margin: 0 auto;
  padding: 34px 0 64px;
}

h1, h2, h3 { margin-top: 0; line-height: 1.18; letter-spacing: -0.025em; }
h1 { margin-bottom: 8px; font-size: clamp(1.65rem, 4vw, 2.25rem); }
h2 { margin-bottom: 8px; font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { margin-bottom: 6px; font-size: 1.05rem; }
p { margin-top: 0; }

.eyebrow {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.muted, .hint, .field-help, .result-count { color: var(--muted); }
.hint { font-size: .9rem; }
.field-help { margin: 7px 0 0; font-size: .84rem; }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading h1, .section-heading h2, .section-heading p { margin-bottom: 0; }

.capture-card, .detail-card, .status-panel, .auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.capture-card { padding: clamp(20px, 4vw, 30px); }

.capture-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
}

.capture-form textarea { min-height: 92px; resize: vertical; }
.capture-form__submit { min-width: 126px; }

.field { display: grid; gap: 7px; }
.field label { font-size: .9rem; font-weight: 700; }

input, select, textarea {
  width: 100%;
  border: 1px solid #bac5bd;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { resize: vertical; }
textarea[readonly] { background: var(--surface-soft); color: #45534b; }

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgb(23 107 67 / 20%);
  outline-offset: 2px;
  border-color: var(--primary);
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .62; }
.button--primary { background: var(--primary); color: #fff; }
.button--primary:hover { background: var(--primary-hover); }
.button--secondary { border-color: var(--primary); background: #fff; color: var(--primary); }
.button--secondary:hover { background: var(--primary-soft); }
.button--quiet { border-color: var(--line); background: transparent; color: var(--text); }
.button--quiet:hover { background: var(--surface-soft); }
.button--small { min-height: 36px; padding: 7px 11px; font-size: .86rem; }
.button--block { width: 100%; }

.capture-result { margin-top: 16px; }
.capture-result p { margin-bottom: 9px; }
.capture-result p:last-child { margin-bottom: 0; }
.capture-result__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.alert {
  margin-bottom: 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
}

.alert--success { border-color: #b5d9c2; background: var(--primary-soft); color: #125131; }
.alert--warning { border-color: #edd48e; background: var(--warning-bg); color: var(--warning); }
.alert--error { border-color: #efb8b8; background: var(--danger-bg); color: var(--danger); }
.alert--info { border-color: #bad9ec; background: var(--info-bg); color: var(--info); }
.flash-stack { margin-bottom: 18px; }

.ideas-section { margin-top: 34px; }
.work-section { margin-top: 34px; }
.section-heading--ideas { align-items: flex-end; }
.result-count { font-size: .9rem; white-space: nowrap; }

.filters {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 210px) auto auto;
  align-items: end;
  gap: 12px;
}

.idea-list { display: grid; gap: 10px; }

.idea-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.idea-card:hover { border-color: #a9b8ae; box-shadow: 0 5px 18px rgb(24 40 31 / 7%); transform: translateY(-1px); }
.idea-card__main { min-width: 0; }
.idea-card__title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.idea-card h3 { margin: 0; }
.idea-card p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.idea-card__meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; white-space: nowrap; }

.status-badge, .degraded-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge { background: #edf0ed; color: #415149; }
.status-badge--inbox { background: #e5f2fa; color: #24577a; }
.status-badge--reviewed { background: #eee9fb; color: #59418a; }
.status-badge--validate { background: #fff0cd; color: #76500a; }
.status-badge--active { background: var(--primary-soft); color: #125131; }
.status-badge--archived { background: #eceeed; color: #59635e; }
.degraded-badge { background: var(--warning-bg); color: var(--warning); }

.empty-state {
  border: 1px dashed #b9c5bc;
  border-radius: 12px;
  padding: 38px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 { color: var(--text); }
.empty-state--compact { padding: 20px; }
.empty-state--compact p { margin: 0; }

.dashboard-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 20px;
}

.metric-card__value { font-size: 2rem; font-weight: 850; line-height: 1; }
.metric-card__label { color: var(--muted); font-size: .88rem; }

.work-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 1fr) 150px 120px auto;
  align-items: end;
  gap: 12px;
}

.work-form__notes { grid-column: 1 / -2; }
.work-form__notes + .button { align-self: end; }

.filters--work { grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) auto; }

.work-list { display: grid; gap: 10px; }

.work-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
}

.work-card--done { opacity: .68; }
.work-card--done h3 { text-decoration: line-through; }
.work-card__body { min-width: 0; }
.work-card__title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.work-card h3 { margin: 0; }
.work-card p { margin: 7px 0 0; color: var(--muted); }
.work-card__meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; color: var(--muted); font-size: .82rem; }
.work-card__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.work-card__actions form { margin: 0; }

.status-badge--todo { background: #e5f2fa; color: #24577a; }
.status-badge--doing { background: #fff0cd; color: #76500a; }
.status-badge--done, .status-badge--completed { background: var(--primary-soft); color: #125131; }
.status-badge--paused { background: #eee9fb; color: #59418a; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.project-card {
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  display: block;
  padding: 19px;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.project-card:hover { border-color: #a9b8ae; box-shadow: var(--shadow); transform: translateY(-1px); }
.project-card h3 { margin: 13px 0 7px; }
.project-card p { color: var(--muted); }
.project-card__meta { color: var(--muted); font-size: .82rem; }

.inline-create {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.back-link { display: inline-block; margin-bottom: 18px; font-weight: 700; text-decoration: none; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: start;
  gap: 20px;
}

.detail-card { padding: clamp(20px, 4vw, 30px); }
.stack { display: grid; gap: 18px; }
.idea-form .button[type="submit"] { justify-self: start; }

.status-panel { position: sticky; top: 82px; padding: 22px; }
.status-panel h2 { margin-bottom: 12px; }
.status-panel__date { margin: 14px 0 18px; color: var(--muted); font-size: .84rem; }
.transition-actions { display: grid; gap: 9px; }
.transition-actions form { margin: 0; }

.auth-card { width: min(100%, 430px); margin: 8vh auto 0; padding: clamp(24px, 6vw, 38px); }

.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: 760px) {
  .page-shell, .site-header__inner { width: min(100% - 24px, 1080px); }
  .page-shell { padding-top: 22px; }
  .capture-form, .filters, .detail-layout, .work-form, .project-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .work-form__notes { grid-column: auto; }
  .capture-form__submit, .filters__submit, .filters__clear { width: 100%; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-heading--ideas { flex-direction: row; align-items: flex-end; }
  .idea-card { align-items: flex-start; flex-direction: column; gap: 12px; }
  .idea-card__meta { width: 100%; justify-content: space-between; }
  .work-card { align-items: flex-start; flex-direction: column; }
  .work-card__actions { width: 100%; justify-content: flex-start; }
  .status-panel { position: static; grid-row: 1; }
  .idea-form .button[type="submit"] { width: 100%; }
}

@media (max-width: 430px) {
  .site-header__inner { align-items: flex-start; padding: 12px 0; }
  .site-nav { max-width: calc(100vw - 100px); overflow-x: auto; gap: 12px; }
  .site-nav > a { white-space: nowrap; }
  .site-nav form { display: none; }
  .capture-card, .detail-card { padding: 18px 16px; }
  .section-heading--ideas { align-items: flex-start; flex-direction: column; }
  .idea-card { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
