/* AI & I Book Planner - Atelier identity (oat / ink-green / clay-rose) */
:root {
  --bg: #f4efe6;          /* oat */
  --surface: #fbf8f2;
  --surface-2: #f0e9dc;
  --ink: #23312b;         /* ink-green */
  --muted: #6b7a70;
  --faint: #9aa69d;
  --accent: #b9756a;      /* clay-rose */
  --accent-soft: rgba(185, 117, 106, 0.12);
  --line: rgba(35, 49, 43, 0.10);
  --line2: rgba(185, 117, 106, 0.32);
  --good: #5f8a6b;        /* strong */
  --mid: #c8924a;         /* in-progress */
  --low: #b9756a;         /* needs-work (clay) */
  --seal: #7a6f93;        /* sealed violet-grey */
  --shadow: 0 1px 2px rgba(35, 49, 43, 0.04), 0 8px 24px rgba(35, 49, 43, 0.05);
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #181d1a;
  --surface: #202622;
  --surface-2: #272e29;
  --ink: #ece5d8;
  --muted: #9aa69d;
  --faint: #6f7c73;
  --accent: #cf9389;
  --accent-soft: rgba(207, 147, 137, 0.14);
  --line: rgba(236, 229, 216, 0.10);
  --line2: rgba(207, 147, 137, 0.30);
  --good: #7fae89;
  --mid: #d6a865;
  --low: #cf9389;
  --seal: #a99fc0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 28px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 14px) 18px calc(120px + env(safe-area-inset-bottom, 0)) 18px;
}
.serif { font-family: Fraunces, Georgia, serif; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.tiny { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
a { color: inherit; }
button { font-family: inherit; }

.shell { max-width: 1180px; margin: 0 auto; }

/* header */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 8px 2px 18px; flex-wrap: wrap; }
.brand h1 { font-family: Fraunces, serif; font-weight: 500; font-size: 28px; margin: 0; line-height: 1.05; letter-spacing: 0.01em; }
.brand .sub { font-size: 13px; color: var(--muted); margin-top: 3px; max-width: 64ch; }
.top-right { display: flex; align-items: center; gap: 8px; }
.progress-line { font-size: 12.5px; color: var(--muted); }
.progress-line b { color: var(--ink); font-weight: 600; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 12.5px; letter-spacing: 0.01em; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--accent-soft); color: var(--accent);
  transition: 0.14s;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn.solid { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.btn.ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.btn.ghost:hover { color: var(--ink); border-color: var(--muted); background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.iconbtn:hover { color: var(--ink); border-color: var(--muted); }

/* thesis strip */
.thesis { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.topt { display: block; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--line); border-left: 2px solid var(--line2); background: var(--bg); border-radius: 9px; padding: 9px 12px; margin-bottom: 7px; color: var(--ink); font-size: 13.5px; line-height: 1.45; transition: 0.14s; }
.topt:last-child { margin-bottom: 0; }
.topt:hover { border-color: var(--line2); background: var(--accent-soft); }
.topt.chosen { border-color: var(--accent); background: var(--accent-soft); }
.topt .mk { color: var(--accent); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-right: 8px; }

/* part group */
.partgroup { margin-bottom: 26px; }
.partgroup > h2 { font-family: Fraunces, serif; font-weight: 500; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }

/* chapter card */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; cursor: pointer; transition: 0.15s; box-shadow: var(--shadow); position: relative; }
.card:hover { border-color: var(--line2); transform: translateY(-1px); }
.card .cnum { font-family: Fraunces, serif; font-size: 13px; color: var(--accent); }
.card .ctitle { font-family: Fraunces, serif; font-weight: 500; font-size: 19px; line-height: 1.15; margin: 3px 0 6px; color: var(--ink); }
.card .crole { font-size: 11px; color: var(--muted); margin-bottom: 10px; font-style: italic; }
.card.sealed { background: linear-gradient(160deg, var(--surface), var(--surface-2)); border-color: var(--line2); }
.card.sealed .ctitle::after { content: " \1F512"; font-size: 13px; opacity: 0.6; }
.card.parked { border-style: dashed; }

/* meter */
.meter { display: flex; gap: 4px; margin: 10px 0 8px; }
.seg { height: 6px; flex: 1; border-radius: 3px; background: var(--line); }
.seg.on { background: var(--accent); }
.health { font-size: 11px; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 6px; }
.health .dot { width: 8px; height: 8px; border-radius: 50%; }
.h-strong .dot, .dot.strong { background: var(--good); }
.h-in-progress .dot, .dot.in-progress { background: var(--mid); }
.h-needs-work .dot, .dot.needs-work { background: var(--low); }
.card .missing { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.ai-stamp { font-size: 10.5px; color: var(--faint); margin-top: 6px; }

/* status chip */
.chip { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.chip .sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.chip.s-seed .sdot { background: #a99; }
.chip.s-exploring .sdot { background: var(--mid); }
.chip.s-drafting .sdot { background: var(--accent); }
.chip.s-locked .sdot { background: var(--good); }
.chip.s-suggested .sdot { background: var(--faint); }
.decision { font-size: 12px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 11px; margin-top: 10px; line-height: 1.5; }
.decision::before { content: "Decision pending - "; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }

/* rail (suggested) */
.rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.rail .card { min-width: 250px; }

/* chapter workspace */
.back { font-size: 12.5px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.back:hover { color: var(--accent); }
.ch-head { margin-bottom: 18px; }
.ch-head h1 { font-family: Fraunces, serif; font-weight: 500; font-size: 30px; line-height: 1.1; margin: 4px 0 8px; }
.ch-head h1 .n { color: var(--accent); margin-right: 10px; }
.ch-premise { font-size: 14px; color: var(--muted); font-style: italic; max-width: 72ch; margin: 0 0 12px; }
.ch-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.zone { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.zone.sacred { border-left: 3px solid var(--accent); }
.zone.claude { border-left: 3px solid var(--good); }
.z-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.z-name { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.z-by { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }

.note { font-size: 14px; color: var(--ink); line-height: 1.6; padding: 11px 13px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); margin-bottom: 8px; }
.note:last-child { margin-bottom: 0; }
.note .src { display: block; font-size: 10.5px; color: var(--faint); margin-top: 7px; letter-spacing: 0.03em; }
.note.mine { border-left: 2px solid var(--accent); }
.note .mtag { display: inline-block; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line2); border-radius: 999px; padding: 2px 7px; margin-bottom: 7px; }

textarea, input[type="text"], input[type="password"] {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink); font-family: inherit; font-size: 14px; line-height: 1.55; padding: 11px 13px; resize: vertical;
}
textarea:focus, input:focus { outline: none; border-color: var(--line2); }
.draft-editor { min-height: 220px; font-size: 15px; line-height: 1.7; }
.brief-editor { min-height: 150px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.savestate { font-size: 11px; color: var(--faint); }
.savestate.saving { color: var(--mid); }
.savestate.saved { color: var(--good); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.spacer { flex: 1; }

/* questions */
.q { padding: 11px 0; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: none; padding-bottom: 0; }
.q .qt { font-size: 14px; color: var(--ink); line-height: 1.5; margin-bottom: 8px; display: flex; gap: 9px; }
.q .qmark { color: var(--accent); font-family: Fraunces, serif; font-size: 18px; line-height: 1; }
.q .ans { font-size: 13.5px; color: var(--ink); background: var(--accent-soft); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; margin-bottom: 8px; line-height: 1.55; }
.q .ans .mtag { display: block; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 5px; }

/* revisions / compare */
.revlist { display: flex; flex-direction: column; gap: 8px; }
.revrow { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; }
.revrow:hover { border-color: var(--line2); }
.revrow.sel { border-color: var(--accent); background: var(--accent-soft); }
.revrow .who { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.who.filipp { color: var(--accent); border: 1px solid var(--line2); }
.who.claude { color: var(--good); border: 1px solid var(--good); }
.revrow .rlabel { flex: 1; font-size: 13px; color: var(--ink); }
.revrow .rdate { font-size: 11px; color: var(--faint); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }
.pane { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 13px; }
.pane h4 { margin: 0 0 9px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pane .body { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }

.empty { font-size: 13px; color: var(--faint); font-style: italic; padding: 12px 2px; line-height: 1.6; }

/* capture FAB + modal */
.fab { position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom, 0)); z-index: 40; background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 13px 20px; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: 0 8px 24px rgba(185, 117, 106, 0.4); display: inline-flex; gap: 8px; align-items: center; }
.fab:hover { filter: brightness(1.05); }
.modal-host { position: fixed; inset: 0; z-index: 60; background: rgba(35, 49, 43, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 18px; }
.modal { background: var(--surface); border: 1px solid var(--line2); border-radius: 16px; padding: 18px; width: 100%; max-width: 560px; max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal h2 { font-family: Fraunces, serif; font-weight: 500; font-size: 21px; margin: 0 0 5px; }
.modal p { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.modal .row { justify-content: flex-end; margin-top: 14px; }
select { font-family: inherit; font-size: 13px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); border-radius: 11px; padding: 10px 16px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
