:root {
  color-scheme: light;
  --ink: #2f211b;
  --muted: #705f55;
  --mocha: #6f4e37;
  --dark: #4a2f24;
  --caramel: #d47e30;
  --cream: #f5f5dc;
  --paper: #fffdf8;
  --line: #dfd4c9;
  --success: #22633f;
  --danger: #9b2c2c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(212, 126, 48, .17), transparent 34rem),
    linear-gradient(145deg, #f8f3e9, var(--cream));
}
.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.hero { display: flex; align-items: center; gap: 24px; margin-bottom: 30px; }
.brand {
  display: grid; place-items: center; flex: 0 0 92px; height: 92px; border-radius: 28px;
  color: white; background: var(--dark); font: 800 2rem/1 Georgia, serif;
  box-shadow: 0 16px 40px rgba(74, 47, 36, .2);
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font: 750 clamp(2rem, 5vw, 3.25rem)/1.04 Georgia, serif; }
h2 { margin-bottom: 10px; font-size: 1.45rem; }
.eyebrow { margin-bottom: 7px; color: var(--caramel); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.lead { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 1.08rem; }
.card {
  margin-top: 18px; padding: clamp(22px, 4vw, 34px); border: 1px solid rgba(111, 78, 55, .17);
  border-radius: 24px; background: rgba(255, 253, 248, .94); box-shadow: 0 14px 50px rgba(74, 47, 36, .09);
}
.login-card { max-width: 520px; margin-inline: auto; }
label { display: block; margin-bottom: 8px; font-weight: 750; }
input[type="password"] {
  width: 100%; min-height: 48px; margin-bottom: 16px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}
select {
  width: 100%; min-height: 50px; padding: 10px 42px 10px 13px;
  border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink);
  font: inherit;
}
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 20px;
  border: 0; border-radius: 12px; color: white; background: var(--dark); font: 750 1rem/1 inherit;
  text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
button:hover, .button:hover { background: var(--mocha); transform: translateY(-1px); }
button:focus-visible, .button:focus-visible, input:focus-visible { outline: 3px solid rgba(212, 126, 48, .45); outline-offset: 3px; }
.toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.toolbar form { margin: 0; }
.button-link { min-height: auto; padding: 4px; color: var(--mocha); background: transparent; font-size: .9rem; text-decoration: underline; }
.button-link:hover { color: var(--dark); background: transparent; transform: none; }
.step { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.step > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: white; background: var(--caramel); font-weight: 800; }
.step strong, .step small { display: block; }
.step small { margin-top: 3px; color: var(--muted); }
.dropzone {
  display: grid; place-items: center; min-height: 170px; padding: 28px; border: 2px dashed #c5ad98;
  border-radius: 18px; background: #fbf6ed; text-align: center; cursor: pointer;
}
.dropzone span { margin: 7px 0 18px; color: var(--muted); font-weight: 400; }
.dropzone input { max-width: 100%; }
.upload-form > button { margin-top: 18px; }
.section-intro { max-width: 720px; color: var(--muted); }
.stacked-form { display: grid; gap: 15px; }
.stacked-form button { justify-self: start; }
.selection-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin: 20px 0;
  padding: 14px 16px; border-radius: 12px; background: #f8f0e2;
}
.selection-summary span { color: var(--muted); overflow-wrap: anywhere; }
.editor-note { margin-bottom: 14px; color: var(--muted); }
.editor-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 7px;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px;
  background: #f5eee4; box-shadow: 0 4px 14px rgba(74, 47, 36, .08);
}
.editor-toolbar button {
  width: auto; min-height: 38px; padding: 7px 11px; border: 1px solid #cdb9a8;
  border-radius: 8px; color: var(--ink); background: white; font-size: .88rem;
}
.editor-toolbar button:hover { color: white; background: var(--mocha); }
.editor-toolbar .suit-button { min-width: 40px; font-size: 1.18rem; font-weight: 800; }
.editor-toolbar .suit-button--club { color: #2e7d32; }
.editor-toolbar .suit-button--diamond { color: #ff8c00; }
.editor-toolbar .suit-button--heart { color: #b22222; }
.editor-toolbar .suit-button--spade { color: #000; }
.fragment-editor {
  min-height: 360px; max-height: 68vh; overflow: auto; padding: 24px;
  border: 1px solid var(--line); border-radius: 0 0 14px 14px; background: white;
  line-height: 1.58;
}
.fragment-editor:focus { outline: 3px solid rgba(212, 126, 48, .35); outline-offset: 2px; }
.fragment-editor p { margin: 0 0 1em; }
.fragment-editor ul, .fragment-editor ol { margin: 0 0 1em; padding-left: 1.65em; }
.fragment-editor li { margin: .3em 0; }
.fragment-editor table { width: 100%; border-collapse: collapse; margin: 0 0 1em; }
.fragment-editor td, .fragment-editor th { padding: 8px; border: 1px solid #cfc4ba; }
.fragment-editor h1 { margin: 1.4em 0 .6em; font-size: 1.7rem; }
.fragment-editor h2 { margin: 1.35em 0 .55em; font-size: 1.42rem; }
.fragment-editor h3 { margin: 1.3em 0 .5em; font-size: 1.2rem; }
.fragment-editor h4 { margin: 1.35em 0 .55em; font-size: 1.08rem; }
.fragment-editor h1[data-toc-state="visual"],
.fragment-editor h2[data-toc-state="visual"],
.fragment-editor h3[data-toc-state="visual"] { padding: 5px 8px; outline: 2px dashed #c9863d; outline-offset: 2px; }
.fragment-editor h1[data-toc-state="menu"],
.fragment-editor h2[data-toc-state="menu"],
.fragment-editor h3[data-toc-state="menu"] { padding: 5px 8px; outline: 3px solid var(--success); outline-offset: 2px; }
.fragment-editor .jj-toc-block-pending,
.fragment-editor .jj-toc-block { outline: 3px solid var(--success); outline-offset: 3px; }
.toc-checker {
  display: grid; grid-template-columns: minmax(210px, .8fr) minmax(260px, 1.2fr); gap: 18px;
  margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf8;
}
.toc-checker h3 { margin: 0 0 10px; }
#toc-preview { display: grid; align-content: start; gap: 4px; max-height: 330px; overflow: auto; padding: 12px; border-radius: 10px; background: #eff7cf; }
.toc-preview__item { display: block; padding: 5px 7px; color: #420c14; font-size: .9rem; }
.toc-preview__level-2 { padding-left: 17px; }
.toc-preview__level-3 { padding-left: 32px; font-size: .84rem; }
.toc-preview__item--new { border-left: 4px solid var(--success); background: #e0f1df; font-weight: 750; }
.heading-warnings { grid-column: 1 / -1; }
.message--warning { color: #694c36; background: #fff7e8; border: 1px solid #e1b06e; }
.message--good { color: var(--success); background: #edf8f0; border: 1px solid #b9dbc3; }
.fragment-editor blockquote {
  margin: .5em 0 .8em 1cm; padding: 0; border: 0;
}
.multi-section-editor { display: grid; gap: 22px; margin-top: 14px; }
.editor-section { border-radius: 15px; box-shadow: 0 7px 24px rgba(74, 47, 36, .08); }
.locked-section-heading {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 14px;
  padding: 13px 16px; border: 1px solid #d6c2ad; border-bottom: 0;
  border-radius: 14px 14px 0 0; color: var(--ink); background: #f3e5d5;
}
.locked-section-heading > span { color: var(--caramel); font-size: .78rem; font-weight: 850; }
.locked-section-heading > small { color: var(--muted); }
.editor-section .fragment-editor { min-height: 180px; max-height: none; }
.field-note { margin: 0; padding: 12px 14px; border-radius: 10px; color: var(--muted); background: #f8f0e2; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.draft-status {
  margin: 16px 0 10px; padding: 12px 14px; border: 1px solid #cfc4ba;
  border-radius: 10px; color: var(--muted); background: #fffdf8;
}
.draft-status[data-state="saved"], .draft-status[data-state="restored"] {
  color: var(--success); border-color: #b9dbc3; background: #edf8f0;
}
.draft-status[data-state="saving"] { color: #694c36; border-color: #e1b06e; background: #fff7e8; }
.draft-status[data-state="warning"] { color: #641b1b; border-color: #e8b9b9; background: #fff1f1; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.cancel-form { margin-top: 10px; }
.button-secondary {
  min-height: 42px; padding: 8px 14px; border: 1px solid var(--mocha);
  color: var(--mocha); background: transparent;
}
.button-secondary:hover { color: white; background: var(--mocha); }
.message { margin: 18px 0; padding: 14px 16px; border-radius: 12px; }
.message--error, .status--danger { color: #641b1b; background: #fff1f1; border-color: #e8b9b9; }
.status--success { border-left: 6px solid var(--success); }
.status--success .button { margin-top: 8px; }
dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
dl > div { min-width: 0; padding: 15px; background: var(--paper); }
dt { margin-bottom: 4px; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; }
dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.good { color: var(--success); }
.mismatch-warning {
  margin: 0 0 20px; padding: 17px 18px; border: 1px solid #e1b06e;
  border-left: 5px solid var(--caramel); border-radius: 12px; background: #fff7e8;
}
.mismatch-warning h3 { margin: 0 0 7px; color: #7c451c; font-size: 1.05rem; }
.mismatch-warning p { margin: 0; color: #694c36; }
.confirmation {
  display: flex; align-items: flex-start; gap: 11px; margin: 0 0 18px; padding: 15px;
  border-radius: 12px; background: #fff7e8; cursor: pointer; font-weight: 650;
}
.confirmation input {
  flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0;
  accent-color: var(--caramel);
}
code { overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .shell { width: min(100% - 22px, 920px); padding-top: 28px; }
  .hero { align-items: flex-start; gap: 15px; }
  .brand { flex-basis: 62px; height: 62px; border-radius: 18px; font-size: 1.45rem; }
  dl { grid-template-columns: 1fr; }
  button, .button { width: 100%; }
  .button-link { width: auto; }
  .stacked-form button, .editor-toolbar button, .button-secondary { width: auto; }
  .fragment-editor { min-height: 300px; padding: 17px; }
  .locked-section-heading { grid-template-columns: 1fr; }
  .locked-section-heading > small { display: none; }
  .editor-section .fragment-editor { min-height: 160px; }
  .toc-checker { grid-template-columns: 1fr; }
  .heading-warnings { grid-column: auto; }
}

.toc-audit__details { margin-top: 14px; }
.toc-audit__details summary { cursor: pointer; font-weight: 800; color: var(--mocha); }
.toc-audit__list { display: grid; gap: 12px; margin-top: 14px; }
.toc-audit__page {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8;
}
.toc-audit__page > strong, .toc-audit__page > small { display: block; }
.toc-audit__page > small { margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.toc-audit__page ul { margin: 10px 0 0; padding-left: 1.4em; }
.toc-audit__page li { margin: .35em 0; }
.toc-audit__page code { margin-right: 6px; color: var(--caramel); font-weight: 800; }
