/* Editorial workspace: shared visual language for every material and workflow page. */
:root {
  --bg: #f5f5f1;
  --panel: #ffffff;
  --ink: #21342f;
  --muted: #65726c;
  --line: #dce3dc;
  --nav: #203c33;
  --nav-ink: #e2ebe5;
  --nav-active: #34574a;
  --accent: #286449;
  --accent-soft: #edf4ed;
  --warn: #855a17;
  --warn-soft: #fbf3e1;
  --danger: #a43e38;
  --danger-soft: #faece9;
  --ok: #336344;
  --ok-soft: #edf5ec;
  --radius: 12px;
  --shadow: 0 2px 5px rgb(25 50 36 / 3%);
}

body { font-size: 15px; line-height: 1.6; }
::selection { background: #dbe8ce; color: #14271c; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #47876b;
  outline-offset: 3px;
}
a { text-underline-offset: 3px; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, .btn { transition: background-color .14s, border-color .14s, box-shadow .14s; }
button:disabled { opacity: .58; }
h1 { font-size: clamp(1.5rem, 1.4rem + .3vw, 1.85rem); line-height: 1.3; font-weight: 650; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.12rem; line-height: 1.4; font-weight: 650; letter-spacing: -.015em; }
h3 { font-size: 1rem; line-height: 1.5; }
h4 { font-size: .78rem; line-height: 1.5; letter-spacing: .065em; }
p { margin-bottom: .8rem; }
.small { font-size: .84rem; line-height: 1.55; }
.grow { flex: 1; min-width: 0; }
.main > h1, .main > .row.between { margin-bottom: 18px; }
.main > h1 + .note, .main > .row.between + p { margin-top: -6px; margin-bottom: 22px; }
.page-heading { gap: 16px; margin-bottom: 22px !important; align-items: flex-end; }
.page-heading h1 { margin-bottom: 4px; }
.page-heading p { margin: 0; max-width: 70ch; }
.page-eyebrow { display: block; color: var(--muted); font-size: .71rem; font-weight: 650; letter-spacing: .085em; text-transform: uppercase; margin-bottom: 7px; }

/* Navigation stays compact, with one clear current location. */
.shell { grid-template-columns: 244px minmax(0, 1fr); }
.nav { padding: 24px 16px 16px; gap: 4px; scrollbar-width: thin; scrollbar-color: #5b7467 transparent; }
.nav .brand { padding: 0 10px 19px; margin-bottom: 12px; font-size: 1.06rem; line-height: 1.5; border-color: #496056; }
.nav .brand small { color: #c1d1c6; font-size: .71rem; margin-top: 7px; letter-spacing: .025em; }
.nav button.navlink, .nav a { padding: 10px 12px; border-radius: 8px; line-height: 1.4; font-size: .88rem; min-height: 41px; }
.nav button.navlink:hover, .nav a:hover { background: #2c4a3f; }
.nav button.navlink.active, .nav a.active { background: #e9f0e5; color: #203d30; font-weight: 650; box-shadow: inset 3px 0 #b5cea8; }
.nav .group { color: #c1d1c6; font-size: .66rem; padding: 24px 12px 7px; letter-spacing: .1em; }
.nav .book { background: #1b342c; border-color: #496056; padding: 12px; border-radius: 9px; margin-bottom: 9px; }
.nav .book .title { font-size: .84rem; line-height: 1.5; overflow-wrap: anywhere; }
.nav .book .small { margin-top: 5px !important; color: #bacbbc !important; font-size: .71rem; }
.nav .book select { margin-top: 10px; min-height: 36px; background: #29453a; border-color: #58715f; padding: 6px 8px; font-size: .78rem; }
.nav details { margin: 13px 0 5px; border-top: 1px solid #496056; padding-top: 7px; }
.nav details summary { font-size: .77rem; line-height: 1.5; padding: 10px 12px; color: #c8d7cc; }
.nav details[open] summary { margin-bottom: 5px; }
.nav details button.navlink { font-size: .82rem; min-height: 37px; padding-block: 8px; }
.nav .user { padding: 16px 5px 0; margin-top: 24px; border-color: #496056; font-size: .77rem; }
.nav .user strong { font-size: .86rem; margin-bottom: 3px; }
.nav .user .row { gap: 5px; margin-top: 12px !important; }
.nav .user .btn { background: transparent; border-color: #5e7869; color: #e4ede6; font-size: .7rem; padding: 5px 7px; min-height: 30px; }
.nav .user .btn:hover { background: #355647; }
.nav .badge { background: #c7d9b8; color: #203d30; }
.nav button.portal-navlink { font-size: .8rem; font-weight: 650; letter-spacing: .035em; }
.cabinet-nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.cabinet-nav .btn { white-space: normal; border-color: transparent; }
.cabinet-nav .badge { margin-left: 4px; background: #d9e6ce; color: #203d30; }
.main { padding: 26px clamp(22px, 3vw, 46px) 64px; max-width: 1840px; width: 100%; margin-inline: auto; }
.topbar { margin-bottom: 29px; }
.topbar .search-wrap { max-width: 760px; }
.topbar input[type=search] { background: #fff; border-color: #dde3da; padding: 11px 14px; min-height: 44px; font-size: .84rem; box-shadow: var(--shadow); }
.search-results { border-radius: 12px; padding: 12px; box-shadow: 0 12px 35px rgb(30 55 39 / 14%); }
.search-results a { text-decoration: none; }

/* Reusable content blocks and controls. */
.card { padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card.compact { padding: 16px 18px; }
.card > h2, .card > .row > h2 { margin-bottom: 12px; }
.card .card { box-shadow: none; }
.card > p:last-child { margin-bottom: 0; }
.grid { gap: 20px; }
.grid > *, .split > *, .field { min-width: 0; }
.split { grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; }
.split .side .card { padding: 19px; }
.split .side { top: 20px; max-height: calc(100vh - 40px); padding-bottom: 2px; }
.row { gap: 10px; }
.stack { gap: 12px; }
.field { margin-bottom: 8px; }
label { color: #455a4e; font-size: .8rem; font-weight: 550; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
  border-radius: 8px; border-color: #ccd7cc; padding: 9px 11px; background: #fff; line-height: 1.5; min-height: 40px;
}
input::placeholder, textarea::placeholder { color: #778377; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 3px solid #e1eddc; border-color: #518165; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
select.inline { max-width: 100%; }
textarea { line-height: 1.7; }
textarea[readonly] { background: #f8faf6; color: #4c5d50; }
.btn { padding: 9px 14px; border-radius: 8px; min-height: 40px; font-weight: 550; font-size: .84rem; line-height: 1.4; }
.btn:hover { background: #f1f5ed; border-color: #b3c5b4; }
.btn.primary { box-shadow: 0 1px 2px rgb(26 58 34 / 12%); }
.btn.primary:hover { background: #1f513b; border-color: #1f513b; }
.btn.sm { padding: 6px 10px; min-height: 32px; font-size: .77rem; }
.btn.link { min-height: 30px; box-shadow: none; }
.btn.block { white-space: normal; }
.note { border-radius: 8px; border-left-width: 3px; padding: 12px 15px; font-size: .84rem; line-height: 1.6; margin-bottom: 16px; }
.tag { padding: 3px 8px; border-radius: 5px; font-size: .69rem; line-height: 1.5; font-weight: 650; background: #eef0ea; color: #53624f; }
.tag.dim { color: #606c5d; background: #f0f2ec; }
.empty { padding: 30px 24px; background: #fafbf8; border-style: solid; line-height: 1.7; }
hr { margin: 20px 0; }
details > summary { font-weight: 550; color: #405848; padding: 8px 0; line-height: 1.5; }
details[open] > summary { margin-bottom: 12px; }
details > summary::marker { color: #71816c; }
dl { margin-block: 10px; } dt { margin-top: 13px; } dd { margin: 4px 0 0; overflow-wrap: anywhere; }

/* Projects are navigable cards; progress remains a count of accepted chapters. */
.project-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)) !important; align-items: stretch; }
.project-card { position: relative; display: flex; flex-direction: column; padding: 24px; border-top: 3px solid #95ac8b; }
.project-card h2 { font-size: 1.1rem; line-height: 1.45; margin: 13px 0 12px; overflow-wrap: anywhere; }
.project-card .project-description { margin: 14px 0 20px; }
.project-card .project-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.project-stat strong { display: block; font-size: 1.1rem; font-weight: 650; color: #354e3d; }
.project-stat span { font-size: .72rem; color: var(--muted); }
.project-progress { margin: 17px 0 19px; }
.project-progress .row { font-size: .72rem; color: var(--muted); margin-bottom: 5px; }
.project-progress progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 4px; background: #e8eee3; accent-color: #6e9561; }
.project-progress progress::-webkit-progress-bar { background: #e8eee3; border-radius: 4px; }
.project-progress progress::-webkit-progress-value { background: #6e9561; border-radius: 4px; }
.project-progress progress::-moz-progress-bar { background: #6e9561; border-radius: 4px; }
.project-card .project-actions { padding-top: 16px; border-top: 1px solid var(--line); gap: 8px; }
.kpis { gap: 12px; margin-bottom: 22px; }
.kpi { padding: 17px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi .v { font-size: 1.7rem; font-weight: 600; line-height: 1.25; letter-spacing: -.045em; margin-bottom: 7px; }
.kpi .l { font-size: .74rem; line-height: 1.5; }

/* Tables and outline share steady alignment and comfortable reading density. */
table { font-size: .85rem; line-height: 1.55; }
th, td { padding: 11px 12px; }
th { background: #f6f8f2; font-size: .7rem; font-weight: 650; text-transform: none; letter-spacing: .015em; color: #687562; }
td { overflow-wrap: break-word; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcf8; }
tr.clickable:hover { background: #eef4e9; }
.table-wrap { border: 1px solid var(--line); border-radius: 9px; overscroll-behavior-x: contain; }
.table-wrap table { margin: 0; }
.table-wrap table.outline-table { min-width: 930px; }
.outline-table td:nth-child(3) { min-width: 260px; max-width: 380px; }
.outline-table td:nth-child(n+4), .outline-table th { white-space: nowrap; }
.table-wrap td:last-child .row { flex-wrap: wrap; }
.chapter-board .table-wrap { max-height: 530px; margin: 16px 0; }
.chapter-board td:first-child { max-width: 650px; }
.chapter-board th { background: #f5f8f0; }
.chapter-board > .row { align-items: flex-end; }
.chapter-board > .row > input[type=search] { flex: 1 1 250px; }
.tree .node { min-height: 38px; padding: 7px 8px; gap: 8px; border-radius: 7px; cursor: pointer; }
.tree .node .title { white-space: normal; line-height: 1.5; overflow-wrap: anywhere; font-size: .83rem; }
.tree .node .num { font-size: .71rem; }
.tree .node .tag { font-size: .64rem; }
.tree .node.volume { background: #f3f6ef; border: 0; margin-top: 12px; padding-block: 11px; }
.tree .node.part { padding-top: 12px; }
.tree .node.selected { background: #e7f0df; box-shadow: inset 3px 0 #6e9561; }
.tree .children { border-left: 1px solid #e1e8dc; margin-left: 17px; padding-left: 8px; }
.tree .toggle { width: 25px; height: 25px; flex: 0 0 25px; border-radius: 4px; }
.tree .toggle:hover { background: #e0ead7; }
.outline-toolbar { background: #f8faf5; padding: 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 16px; }
.list li { padding-block: 12px; }
.list li .row { row-gap: 6px; }
.comment { padding: 16px 18px; background: #fff; border-radius: 10px; margin-bottom: 12px; }
.comment.resolved { opacity: 1; background: #f7f9f4; color: #6a7565; }
.reply { padding: 10px 13px; margin-top: 12px; border-radius: 7px; }
.tabs { gap: 2px; margin-bottom: 20px; }
.tabs button { padding: 10px 13px; font-size: .8rem; line-height: 1.4; }
.tabs button:hover { background: #f5f8f0; }
.tabs button.active { color: var(--accent); border-bottom-width: 3px; }
.status-strip { margin: 4px 0 20px; gap: 6px; }
.status-strip .step { font-size: .72rem; padding: 6px 11px; border-radius: 6px; background: #eaeee5; color: #62705a; }
.status-strip .step.current { background: #286449; color: #fff; }

/* Preparation windows form a clear route into the manuscript. */
.draft-launch { border: 1px solid #bccfb2; background: #f8faf4; padding: 23px 25px; }
.draft-launch > .row:first-child { gap: 18px; padding-bottom: 16px; border-bottom: 1px solid #dbe5d4; margin-bottom: 16px; }
.draft-launch h2 { font-size: 1.2rem; }
.draft-launch > .row:first-child > div:first-child { flex: 1; min-width: 250px; }
.draft-launch > .row:first-child { gap: 12px; padding-bottom: 10px; margin-bottom: 10px; }
.draft-launch > details { margin-top: 2px; }
.draft-launch > details > summary { padding: 5px 0; }
.draft-launch > p:last-child { margin-top: 9px; }
.draft-config[open] { margin-bottom: 14px; }
.draft-plan-panel.single-plan-panel { margin: 14px 0; border: 0; padding: 0; background: transparent; }
.single-plan-panel h3 label { font-size: 1rem; color: var(--ink); font-weight: 650; }
.single-plan-panel .draft-plan-text { min-height: 250px; max-height: 520px; background: var(--panel); }
.purpose-panel[open] { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.purpose-report { margin-top: 14px; }
.purpose-report ul { margin-bottom: 0; padding-left: 20px; }
.manuscript-rich-editor { overflow: visible; }
.manuscript-toolbar { position: sticky; top: 8px; z-index: 5; border-radius: 8px 8px 0 0; box-shadow: 0 1px 3px #213c2412; }
.manuscript-rich-content { overflow-x: auto; }
.manuscript-rich-content tbody tr:last-child td { border-bottom: 1px solid #b9c7cc; }
.draft-primary { font-size: .9rem; padding: 11px 17px; }
.draft-launch #ai-status { display: inline-block; color: #536b45; background: #eef3e6; border-radius: 6px; padding: 7px 11px; font-size: .79rem; }
.author-brief-panel { margin: 18px 0; border: 1px solid #dce5d4; padding: 18px; border-radius: 10px; background: #fff; }
.author-brief-text { background: #fcfdf9; min-height: 270px; font-size: .88rem; }
.draft-plan-panel { margin: 18px 0; padding: 20px; border-radius: 10px; box-shadow: none; }
.draft-plan-panel h3 { font-size: 1rem; }
.draft-plan-text { min-height: 330px; font-size: .89rem; line-height: 1.8; background: #fcfdf9; }
.candidate { padding: 15px; border-radius: 9px; border: 1px solid #d5dfcd; background: #fff; }
.brief-grid { line-height: 1.7; row-gap: 10px; }
.plan-scope { line-height: 1.7; }
.dirty { color: #855a17; }.saved { color: #386946; }

/* Modal and entry screens keep the same editorial tone. */
.modal-bg { background: rgb(23 41 31 / 48%); backdrop-filter: blur(3px); }
.modal { padding: 28px; border-radius: 15px; box-shadow: 0 20px 80px rgb(20 41 28 / 22%); }
.modal > h2 { font-size: 1.3rem; margin-bottom: 15px; }
.modal form { margin-top: 18px; }
.modal textarea { min-height: 95px; }
.toast { border-radius: 10px; padding: 13px 17px; line-height: 1.55; box-shadow: 0 7px 24px rgb(22 42 28 / 18%); }
.auth { max-width: 490px; margin: 7vh auto; padding: 0 16px; }
.auth .card { padding: 30px; }
.auth .brand { color: #284736; font-size: 1.6rem; letter-spacing: -.04em; margin-bottom: 12px; }
.auth .tabs { margin-top: 22px; }
.auth form { margin-top: 17px; }
.auth .caps { margin-top: 14px; }

@media (min-width: 1600px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr) 350px; }
}
@media (max-width: 1180px) {
  .shell { grid-template-columns: 224px minmax(0, 1fr); }
  .main { padding-inline: 24px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split .side { position: static; max-height: none; }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .manuscript-toolbar { position: static; }
  .manuscript-rich-content table { min-width: 460px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { width: 86vw; max-width: 310px; padding-top: 20px; }
  .main { padding: 18px 16px 50px; }
  .topbar { margin-bottom: 24px; flex-wrap: nowrap; gap: 8px; }
  .topbar .menu-toggle { min-height: 42px; padding-inline: 10px; }
  .topbar input[type=search] { min-width: 0; font-size: .8rem; }
  .page-heading { align-items: flex-start; }
  .page-heading > .row { width: 100%; }
  .grid.three, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .card, .draft-launch { padding: 17px 16px; border-radius: 10px; }
  .author-brief-panel, .draft-plan-panel { padding: 14px; }
  .card.compact { padding: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 1.45rem; }
  .btn { max-width: 100%; white-space: normal; }
  .table-wrap { max-width: 100%; }
  .table-wrap table { min-width: 470px; }
  .tree .children { margin-left: 9px; padding-left: 4px; }
  .tree .node { gap: 5px; }
  .tree .node .tag { white-space: normal; max-width: 110px; font-size: .6rem; }
  .tabs { gap: 0; }
  .tabs button { padding: 9px 10px; }
  .draft-launch > .row:first-child .row { width: 100%; }
  .author-brief-text, .draft-plan-text { min-height: 250px; }
  .modal-bg { padding: 9px; }
  .modal { padding: 20px 17px; max-height: 94vh; }
  .auth { margin: 25px auto; }
  .auth .card { padding: 24px; }
  .brief-grid { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .nav, .topbar, .toasts, .modal-bg, .btn, .status-strip { display: none !important; }
  .shell, .split, .grid { display: block; }
  .main { width: 100%; max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table-wrap { overflow: visible; }
}
.project-workspace-nav{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin:2px 0 24px;padding-bottom:16px;border-bottom:1px solid var(--line,#dae4df)}
.project-tools{font-size:13px;margin-left:auto;max-width:100%}
.project-tools summary{cursor:pointer;color:var(--muted,#64786e);padding:8px 0}
.project-tools[open]{flex-basis:100%;margin:0}
.project-tools nav{padding-top:10px}
.project-summary{display:flex;gap:8px 26px;flex-wrap:wrap;margin:0 0 24px;color:var(--muted,#64786e);font-size:13px}
.project-summary strong{font-size:22px;color:var(--ink,#20392e);font-weight:600;margin-right:4px}
.workspace-ai-settings{margin-top:16px}
.progress-table input[type=checkbox]{width:18px;height:18px;accent-color:#34574a;margin:4px;cursor:pointer}
.progress-table input[type=checkbox]:disabled{opacity:1;cursor:default}
.manuscript-main{display:grid;gap:18px;min-width:0}
.manuscript-workspace .side{display:grid;gap:18px}
.ai-draft-launch{border:1px solid #b3c6a9;background:#f5f8ef}
.ai-draft-launch h2{margin:5px 0 10px}
.ai-draft-launch .draft-primary{margin-top:16px;white-space:normal;line-height:1.5;font-size:.88rem;padding:13px 10px}
.ai-draft-launch select,.ai-draft-launch input{width:100%;min-width:0}
.ai-custom-model{margin-top:12px}
.ai-custom-model[hidden]{display:none}
.ai-draft-launch #ai-status{padding:10px;background:#e9f0e0;border-radius:8px;color:#365332;overflow-wrap:anywhere}
.ai-draft-launch>.btn:not(.draft-primary){margin-top:8px;white-space:normal}
.ai-draft-launch details{border-top:1px solid #d8e1ce;padding-top:12px;margin-top:16px}
.manuscript-plan .single-plan-panel{margin:0;padding:0;border:0;background:none}
.manuscript-main>.candidate{margin:0}
@media(max-width:1180px){.manuscript-workspace .side{grid-row:1}.manuscript-workspace .side>.card:not(.ai-draft-launch){grid-row:auto}.manuscript-workspace .side{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.manuscript-workspace .side{grid-template-columns:minmax(0,1fr)}}
@media(max-width:700px){.project-tools{margin-left:0}.project-workspace-nav{gap:8px}.project-summary{gap:8px 16px}}

/* Stable project identity colors; title, ordering and filtering do not affect the hue. */
.project-card{border-top:5px solid hsl(var(--project-hue,145) 38% 48%);background:linear-gradient(145deg,hsl(var(--project-hue,145) 55% 94%),hsl(var(--project-hue,145) 40% 98%));border-color:hsl(var(--project-hue,145) 28% 82%);border-top-color:hsl(var(--project-hue,145) 38% 48%)}
.project-card .tag.accent{background:hsl(var(--project-hue,145) 40% 88%);color:hsl(var(--project-hue,145) 35% 24%)}
.project-card .project-actions .btn.primary{background:hsl(var(--project-hue,145) 30% 31%);border-color:hsl(var(--project-hue,145) 30% 31%);color:white}
.project-card .project-actions .btn.primary:hover{background:hsl(var(--project-hue,145) 35% 25%)}
.project-card progress::-webkit-progress-value{background:hsl(var(--project-hue,145) 35% 39%)}
.project-card progress::-moz-progress-bar{background:hsl(var(--project-hue,145) 35% 39%)}
