/* Appearance only: existing layout, manuscript settings and custom person colors remain intact. */
:root {
  color-scheme:light;
  --muted:#626e60;--sidebar:#eeeee5;--soft:#f2f3eb;--selected:#e2eadb;
  --accent-ink:#3f5945;--accent-hover:#425d48;--on-accent:#ffffff;
  --danger:#9a4035;--danger-bg:#fbece6;--warning:#754b22;--warning-bg:#fff1db;
  --field:#fcfcf6;--focus:#526b57;--grid:#dce3d0;
}
:root[data-theme="sky"] {
  --bg:#edf6fc;--paper:#f8fcff;--white:#ffffff;--ink:#233d50;--muted:#506b7d;
  --line:#cedeea;--sidebar:#e4f0f9;--soft:#f1f7fc;--selected:#d6eaf8;
  --sage:#25668d;--sage-light:#e0eff9;--accent-ink:#205b7e;--accent-hover:#1d5273;
  --field:#f7fbfe;--focus:#25668d;--grid:#cadfeb;--shadow:0 12px 45px #22496910;
}
:root[data-theme="sepia"] {
  --bg:#f3eadb;--paper:#faf3e7;--white:#fff9ef;--ink:#493a2c;--muted:#74614f;
  --line:#ded0ba;--sidebar:#eae0ce;--soft:#f3eadb;--selected:#e7dac2;
  --sage:#785531;--sage-light:#eee0c9;--accent-ink:#684724;--accent-hover:#614321;
  --field:#fbf4e8;--focus:#785531;--grid:#ddcbb0;--shadow:0 12px 45px #57402312;
}
:root[data-theme="forest"] {
  --bg:#eaf1ec;--paper:#f5f9f5;--white:#fbfdf9;--ink:#2b4137;--muted:#536e5f;
  --line:#cdded1;--sidebar:#dfeae1;--soft:#edf4ed;--selected:#d3e4d6;
  --sage:#39664a;--sage-light:#dfeddf;--accent-ink:#305b40;--accent-hover:#2d523b;
  --field:#f5faf3;--focus:#39664a;--grid:#c8dccd;--shadow:0 12px 45px #25462f12;
}
:root[data-theme="night"] {
  color-scheme:dark;
  --bg:#171d25;--paper:#202833;--white:#242e3a;--ink:#e6eaf0;--muted:#b1bfce;
  --line:#435264;--sidebar:#1c242e;--soft:#293542;--selected:#354958;
  --sage:#a5cbb7;--sage-light:#31483e;--accent-ink:#bfdfce;--accent-hover:#bfddcd;
  --on-accent:#15271e;--field:#202a36;--focus:#b2d9f2;--grid:#3a495a;
  --danger:#ffb8aa;--danger-bg:#4b3030;--warning:#f4d59e;--warning-bg:#433a2b;
  --shadow:0 12px 45px #00000026;
}
body{background:var(--bg);color:var(--ink)}
.sidebar{background:var(--sidebar)}
.topbar{background:var(--paper);height:auto;min-height:79px;flex-wrap:wrap;padding-top:12px;padding-bottom:12px}
.top-actions{flex-wrap:wrap;justify-content:flex-end;min-width:0}
.crumb{flex:1;min-width:120px}
.theme-control{position:relative;display:flex;align-items:center;gap:7px}
.theme-control label{font-size:11px;white-space:nowrap;color:var(--muted)}
.theme-control select{max-width:160px;min-height:40px;border:1px solid var(--line);border-radius:7px;padding:7px 9px;background:var(--white);color:var(--ink);font-size:12px;cursor:pointer}
.theme-notice{position:absolute;right:0;top:100%;width:230px;padding:8px 10px;background:var(--warning-bg);color:var(--warning);border:1px solid var(--line);border-radius:6px;z-index:25;font-size:11px;line-height:1.6}
.brand small,.project-btn,.nav-btn,.storage-note,.subtle-btn,.save-state,.eyebrow,
.chapter-pane .pane-title,.chapter-btn,.chapter-btn small,.chapter-bottom,.editor-toolbar,
.toolbar-group select,.chapter-kicker,.editor-status,.note-box summary,.note-box textarea,
.bottom-caption,.check-intro,.check-card .reason,.check-card .context,.record-card small,
.profile-header p,.field>span,.hint,.empty p,.map-top,.map-node small,.relation-row p,
.dialog-body p,.outline-reference p,.storyline-actions p,.storyline-board-intro,
.storyline-card-foot,.relation-help,.relation-pair-arrow,.relation-pick-status,
.relation-group-title,.world-categories-head span,.world-category-item small,.trash-item small,
.chapter-item>.icon-btn,.record-item>.icon-btn,.storyline-card-foot .icon-btn,
.world-category-item>.icon-btn{color:var(--muted)}
.project-btn.active{background:var(--white);color:var(--accent-ink)}
.nav-btn.active,.chapter-btn.active,.record-card.active,.relation-choice.selected,.direction-choice.selected{background:var(--selected);color:var(--accent-ink);border-color:var(--sage)}
.relation-choice.selected,.direction-choice.selected{box-shadow:inset 0 0 0 1px var(--sage)}
.icon-btn:hover,.btn:hover,.storyline-add:hover{background:var(--selected);border-color:var(--line)}
.btn.primary,.settings-tabs button.active,.brand-symbol{background:var(--sage);color:var(--on-accent);border-color:var(--sage)}
.btn.primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.badge,.sample-banner,.chapter-pane,.editor-status,.note-box,.check-panel,.record-card,
.empty,.map-wrapper,.dialog-body .info,.sync-strip,.sync-choice,.outline-reference,
.storyline-add,.relation-choice,.direction-choice,.world-categories{background:var(--soft);border-color:var(--line)}
.badge,.sample-banner,.sample-banner button,.editor-status strong,.empty-check,.correct,
.dialog-body .help-title,.dialog-body .info,.sync-strip,.outline-reference,
.storyline-board-intro strong,.storyline-number,.storyline-add,.relation-choice,
.direction-choice,.world-categories-head strong,.world-category-item>button:first-child{color:var(--accent-ink)}
.profile-header{background:linear-gradient(115deg,var(--soft),var(--white));border-color:var(--line)}
.field input,.field textarea,.field select,.storyline-card-outline{background:var(--field);border-color:var(--line)}
.field input::placeholder,.field textarea::placeholder,input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}
.section-nav,.editor-toolbar,.editor-status,.check-card,.empty-check,.storyline-card-title,.storyline-add{border-color:var(--line)}
.relation-panel,.map-node-delete,.world-category-item,.trash-item{background:var(--white);border-color:var(--line)}
.map-node-delete{color:var(--muted)}
.map-stage{background-image:radial-gradient(var(--grid) 1px,transparent 1px)}
.map-lines text{fill:var(--ink);stroke:var(--soft)}
.map-node:not(.custom-person){background:var(--white)}
.botanical{stroke:var(--muted)}
.relation-tag,.world-icon{background:var(--selected);color:var(--accent-ink)}
:root[data-theme="night"] .avatar{color:var(--ink)}
.nav-btn em{opacity:1;color:var(--muted)}
.btn.danger,.wrong,.save-state.error,.relation-error{color:var(--danger)}
.btn.danger{border-color:var(--danger)}
.settings-error{color:var(--danger)!important}
.chapter-item>.icon-btn:hover,.record-item>.icon-btn:hover,.map-node-delete:hover{background:var(--danger-bg);color:var(--danger)}
.warning-banner,.migration-banner,.sync-strip[data-state=error],.sync-strip[data-state=conflict]{background:var(--warning-bg);color:var(--warning);border-color:var(--line)}
.dialog-body .info a{color:var(--accent-ink)}
.pro-status{color:var(--accent-ink)!important}
#toast{background:var(--sage);color:var(--on-accent)}
input:focus,textarea:focus,select:focus,button:focus-visible,a:focus-visible,.storyline-card:focus-visible{outline-color:var(--focus)}
::selection{background:var(--selected);color:var(--ink)}
@media(max-width:900px){.topbar{min-height:68px}.theme-control label{font-size:10px}}
@media(max-width:600px){
  .topbar{gap:9px;padding-top:10px;padding-bottom:10px}.crumb{flex-basis:100%}
  .top-actions{width:100%;gap:6px;justify-content:flex-start}.top-actions .save-state{margin-left:auto}
  .theme-control{gap:5px}.theme-control select{font-size:16px;max-width:170px;min-height:44px}
  .theme-notice{left:0;right:auto}.focus .top-actions{flex-wrap:wrap}
  .editor-layout{grid-template-columns:minmax(0,1fr)}.chapter-pane{min-width:0}
  .editor-status{flex-wrap:wrap}.toolbar-group{min-width:0}
}
