:root {
  --bg: #141a17;
  --bg-raise: rgba(244, 239, 230, 0.04);
  --line: rgba(244, 239, 230, 0.12);
  --paper: #f6f1e6;
  --paper-2: #efe7d8;
  --ink: #1c1915;
  --muted: #6d675c;
  --faint: rgba(244, 239, 230, 0.62);
  --copper: #d26a32;
  --gold: #e0b15c;
  --moss: #2f7a52;
  --review: #35598a;
  --danger: #9c3b2e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --ui: "Manrope", "Segoe UI", sans-serif;
  --display: "Fraunces", Palatino, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100%;
  font-family: var(--ui);
  color: #f4efe6;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(210, 106, 50, 0.18), transparent 55%),
    radial-gradient(800px 500px at 100% 0%, rgba(47, 122, 82, 0.16), transparent 50%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #e7c4a4; color: #1c1915; }

.boot { padding: 48px; color: var(--faint); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.gate-card {
  width: min(440px, 100%);
  background: var(--paper);
  color: var(--ink);
  border-radius: 28px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.mark {
  font-family: var(--display);
  font-weight: 650;
  letter-spacing: -0.03em;
  font-size: 42px;
  margin: 0;
}
.lede { margin: 8px 0 22px; color: var(--muted); line-height: 1.45; }
label { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.gate input, .field input:not([type="checkbox"]), .field textarea, .field select, .search, .composer input, .note-row input {
  width: 100%;
  border: 1px solid rgba(28, 25, 21, 0.14);
  background: #fffdf8;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
}
.gate input:focus, .field input:focus, .field textarea:focus, .field select:focus, .search:focus, .composer input:focus, .note-row input:focus {
  outline: 2px solid var(--copper);
  border-color: transparent;
}
.primary, .ghost, .danger, .chip, .text-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
}
.primary { background: #1c1915; color: #f6f1e6; }
.primary:hover { background: #3a3128; }
.ghost, .text-btn { background: transparent; color: inherit; }
.ghost { border: 1px solid var(--line); }
.danger { background: transparent; color: var(--danger); border: 1px solid rgba(156, 59, 46, 0.35); }
.full { width: 100%; margin-top: 14px; }
.fine { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px 1fr;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--line);
  background: rgba(12, 16, 14, 0.45);
  backdrop-filter: blur(8px);
}
.brand { padding: 0 8px; }
.brand h1 {
  font-family: var(--display);
  font-size: 32px;
  line-height: 0.95;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.brand p { margin: 6px 0 0; color: var(--faint); font-size: 13px; }
.side-scroll { overflow: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; }
.project {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 8px;
  color: inherit;
}
.project:hover { background: var(--bg-raise); }
.project.active { background: rgba(210, 106, 50, 0.14); }
.seal {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 18px;
  color: #fffaf3;
}
.seal[data-hue="0"] { background: #8d4328; }
.seal[data-hue="1"] { background: #1f6a45; }
.seal[data-hue="2"] { background: #35598a; }
.seal[data-hue="3"] { background: #8a6232; }
.seal[data-hue="4"] { background: #5c4d86; }
.seal[data-hue="5"] { background: #6e4a3a; }
.project b { display: block; font-weight: 650; }
.project small { color: var(--faint); font-size: 12px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(224, 177, 92, 0.15);
}
.side-foot { display: flex; justify-content: space-between; gap: 8px; }
.new-project, .settings {
  margin: 0 8px 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.new-project { display: grid; gap: 8px; }
.new-project input, .settings input, .settings textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: #f4efe6;
  padding: 10px 12px;
}
.settings summary { cursor: pointer; color: var(--faint); }
.settings .row { display: flex; gap: 8px; margin-top: 8px; }

.main { min-width: 0; padding: 22px 22px 28px; display: flex; flex-direction: column; gap: 16px; }
.top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; }
.kicker { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin: 0 0 4px; }
.top h2 { font-family: var(--display); font-size: 40px; line-height: 0.95; margin: 0; font-weight: 650; letter-spacing: -0.03em; }
.summary { margin: 8px 0 0; color: var(--faint); max-width: 62ch; }
.search { width: min(280px, 40vw); background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: #f4efe6; }

.next {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(210, 106, 50, 0.2), rgba(255,255,255,0.03) 42%);
  border: 1px solid rgba(210, 106, 50, 0.28);
}
.next strong { font-size: 16px; }
.next span.meta { color: var(--faint); font-size: 13px; }
.next .primary { margin-left: auto; }

.board-wrap { overflow-x: auto; padding-bottom: 8px; }
.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  align-items: start;
  min-width: 1100px;
}
.column {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 240px;
  padding: 10px;
}
.column.drop { border-color: var(--gold); background: rgba(224, 177, 92, 0.08); }
.column[data-status="doing"] {
  background:
    radial-gradient(280px 120px at 50% 0%, rgba(224, 177, 92, 0.18), transparent 70%),
    rgba(255,255,255,0.03);
}
.col-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 4px 6px 10px; }
.col-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.col-head h3 i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  margin-right: 6px;
}
.column[data-status="inbox"] h3 i { background: #8d8478; }
.column[data-status="ready"] h3 i { background: var(--moss); }
.column[data-status="doing"] h3 i { background: var(--gold); }
.column[data-status="check"] h3 i { background: var(--copper); }
.column[data-status="review"] h3 i { background: #7ea2d6; }
.column[data-status="done"] h3 i { background: #8ea194; }
.count { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.hint { margin: -4px 6px 8px; color: var(--faint); font-size: 12px; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 80px; }

.card {
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-radius: 14px;
  padding: 11px 12px 10px;
  text-align: left;
  width: 100%;
  box-shadow: 0 1px 0 rgba(255,255,255,0.65) inset, 0 10px 20px rgba(0,0,0,0.16);
  cursor: grab;
}
.card:hover { transform: translateY(-1px); }
.card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.pid { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pip { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }
.pip[data-p="0"] { background: var(--danger); }
.pip[data-p="1"] { background: var(--copper); }
.pip[data-p="2"] { background: #b7a48a; }
.pip[data-p="3"] { background: #d9d0c2; }
.card h4 { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; }
.intent {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--paper-2);
  color: #4e493f;
}
.tag.wait { background: #f3d7cc; color: #6e2e1c; }
.card.is-blocked { outline: 1px dashed rgba(156, 59, 46, 0.45); }
.card[data-status="done"] { background: #e7e2d6; }
.empty { color: var(--faint); font-size: 13px; padding: 8px; }

.composer { display: flex; gap: 6px; margin-top: 8px; }
.composer input {
  background: rgba(0,0,0,0.18);
  border: 1px dashed var(--line);
  color: #f4efe6;
  border-radius: 12px;
  padding: 8px 10px;
}
.composer button, .icon-btn {
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: #f4efe6;
  padding: 0 10px;
}

.backdrop { position: fixed; inset: 0; background: rgba(8, 10, 9, 0.46); z-index: 20; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(460px, 100%);
  background: var(--paper);
  color: var(--ink);
  z-index: 21;
  overflow: auto;
  padding: 22px 22px 28px;
  box-shadow: -24px 0 60px rgba(0,0,0,0.35);
}
.drawer-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-top .pid { color: var(--muted); }
.icon-btn.dark { background: rgba(28,25,21,0.06); color: var(--ink); width: 36px; height: 36px; }
.drawer h3 { font-family: var(--display); font-size: 32px; line-height: 1.05; margin: 12px 0; font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { background: transparent; color: var(--ink); border: 1px solid rgba(28,25,21,0.16); padding: 7px 10px; }
.chip.on { background: #1c1915; color: #f6f1e6; border-color: #1c1915; }
.field { margin: 12px 0; }
.field textarea { min-height: 84px; resize: vertical; }
.field .hint-line {
  margin: -2px 0 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.checks { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.checks .wait-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(28, 25, 21, 0.045);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
}
.checks input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #1c1915;
}
.checks .wait-title { min-width: 0; }
.checks .wait-status {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.journal { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.journal li { font-size: 13px; color: #3e3a33; }
.journal time { display: block; color: var(--muted); font-size: 11px; }
.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding-top: 12px;
  background: linear-gradient(transparent, var(--paper) 20%);
}
.note-row { display: flex; gap: 8px; align-items: center; }
.note-row input { flex: 1; min-width: 0; }
.note-row .primary { flex: 0 0 auto; }
#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: #1c1915;
  color: #f6f1e6;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-scroll { flex-direction: row; overflow-x: auto; }
  .project { min-width: 210px; }
  .top { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
  .top h2 { font-size: 32px; }
  .next { align-items: flex-start; flex-direction: column; }
  .next .primary { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
