/* =====================================================================
   ContentCraft — styles
   Change the look by editing the variables in :root (light) and
   [data-theme="dark"] (dark). Everything else reads from them.
   ===================================================================== */

:root {
  --paper: #EDF0F4;        /* app background */
  --sheet: #FFFFFF;        /* panels and the manuscript page */
  --ink: #16213B;          /* main text, primary buttons, rail */
  --ink-2: #4A5675;        /* secondary text */
  --ink-3: #7C86A0;        /* hints, placeholders */
  --rule: #D5DBE5;         /* borders */
  --rule-2: #E7EBF1;       /* soft dividers, input fills */
  --hl: #FFE14D;           /* highlighter: AI-sounding sentences */
  --hl-soft: rgba(255, 225, 77, .6);
  --pass: #0E7A5C;  --pass-bg: #E1F2EA;
  --mid: #A86200;   --mid-bg: #FAEDD5;
  --fail: #C2334D;  --fail-bg: #FBE3E7;
  --rail: #16213B;  --rail-ink: #B9C3D9;  --rail-active: #26345A;
  --focus: #3B63F5;
  --shadow-sheet: 0 1px 2px rgba(22, 33, 59, .06), 0 8px 28px rgba(22, 33, 59, .07);
  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-doc: "Newsreader", Georgia, "Times New Roman", serif;
  --font-code: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
}

[data-theme="dark"] {
  --paper: #0D1322;
  --sheet: #151D31;
  --ink: #E6EAF3;
  --ink-2: #A9B3CB;
  --ink-3: #75819E;
  --rule: #29344F;
  --rule-2: #1D2740;
  --hl: #E8C21C;
  --hl-soft: rgba(232, 194, 28, .32);
  --pass: #3CC79A;  --pass-bg: #12322A;
  --mid: #F0A53A;   --mid-bg: #36290F;
  --fail: #FF7088;  --fail-bg: #3A1820;
  --rail: #090E1A;  --rail-ink: #8F9BB8;  --rail-active: #1A2440;
  --shadow-sheet: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-s);
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
  font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--focus)); border-color: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--rule-2); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--fail); }
.btn-danger:hover { border-color: var(--fail); }
.btn-lg { height: 46px; font-size: 15px; padding: 0 20px; border-radius: var(--r-m); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------- forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint, .hint { font-size: 12.5px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--rule); background: var(--sheet);
  border-radius: var(--r-s); padding: 8px 11px; min-height: 38px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.input-lg { font-size: 17px; min-height: 48px; padding: 10px 14px; font-weight: 500; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row > .field { margin-bottom: 16px; }
.char-count { font-size: 12px; color: var(--ink-3); justify-self: end; margin-top: -2px; }
.char-count.bad { color: var(--fail); }

/* segmented control */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--rule-2); border-radius: var(--r-s); padding: 3px; gap: 2px; width: 100%; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 5px; color: var(--ink-2); font-weight: 550; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 33, 59, .12); }

/* switch */
.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--rule-2); }
.switch .s-text { display: grid; gap: 1px; }
.switch .s-title { font-weight: 550; }
.switch .s-sub { font-size: 12.5px; color: var(--ink-3); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .knob { width: 36px; height: 21px; border-radius: 99px; background: var(--rule); position: relative; flex: none; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .knob { background: var(--ink); }
[data-theme="dark"] .switch input:checked + .knob { background: var(--pass); }
.switch input:checked + .knob::after { transform: translateX(15px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--focus); outline-offset: 2px; }

/* range */
.range-wrap { display: grid; gap: 4px; }
.range-head { display: flex; justify-content: space-between; align-items: baseline; }
.range-value { font-weight: 650; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--ink); }
[data-theme="dark"] input[type="range"] { accent-color: var(--pass); }

/* chips input (secondary keywords) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet); min-height: 42px; cursor: text; }
.chips:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--rule-2); border-radius: 5px; padding: 3px 4px 3px 9px; font-size: 13px; }
.chip button { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; padding: 0; }
.chip button:hover { background: var(--rule); color: var(--ink); }
.chips input { border: 0; outline: 0; flex: 1; min-width: 120px; background: transparent; padding: 3px 4px; }

/* ---------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; }
.rail .mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; background: var(--hl); color: #16213B; }
.rail .mark svg { width: 27px; height: 27px; }
.rail a, .rail button.rail-btn { width: 62px; padding: 9px 0 7px; border-radius: 10px; display: grid; justify-items: center; gap: 4px; font-size: 11.5px; font-weight: 550; text-decoration: none; color: var(--rail-ink); border: 0; background: transparent; cursor: pointer; }
.rail a svg, .rail button.rail-btn svg { width: 20px; height: 20px; }
.rail a:hover, .rail button.rail-btn:hover { color: #fff; background: var(--rail-active); }
.rail a[aria-current="page"] { color: #fff; background: var(--rail-active); box-shadow: inset 3px 0 0 var(--hl); }
.rail .spacer { flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #3A4A75; color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; border: 0; cursor: pointer; }
.main { overflow: auto; min-width: 0; min-height: 0; }

.menu { position: fixed; z-index: 50; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); box-shadow: var(--shadow-sheet); padding: 6px; min-width: 220px; }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule-2); margin-bottom: 4px; }
.menu .menu-head strong { display: block; }
.menu .menu-head span { color: var(--ink-3); font-size: 12.5px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--rule-2); }
.menu svg { width: 16px; height: 16px; color: var(--ink-3); }

/* ---------------------------------------------------------- page scaffolding */
.page { padding: 28px clamp(20px, 2.6vw, 44px) 60px; max-width: 1960px; margin: 0 auto; }   /* uses the whole screen */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.page-head .grow { flex: 1; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-l); }
.panel-pad { padding: 20px 22px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.callout { border-left: 3px solid var(--ink); background: var(--sheet); padding: 12px 16px; border-radius: 0 var(--r-s) var(--r-s) 0; color: var(--ink-2); margin-bottom: 18px; }
.callout strong { color: var(--ink); }
.callout.warn { border-color: var(--mid); background: var(--mid-bg); color: var(--ink); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: color-mix(in srgb, var(--rule-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.t-title { font-weight: 600; }
.t-sub { font-size: 12.5px; color: var(--ink-3); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--rule-2); color: var(--ink-2); white-space: nowrap; }
.pill.pass { background: var(--pass-bg); color: var(--pass); }
.pill.mid { background: var(--mid-bg); color: var(--mid); }
.pill.fail { background: var(--fail-bg); color: var(--fail); }
.score-num { font-variant-numeric: tabular-nums; font-weight: 650; }
.score-num.pass { color: var(--pass); } .score-num.mid { color: var(--mid); } .score-num.fail { color: var(--fail); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* ---------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .mark { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--ink); color: var(--hl); }
.auth-brand .mark svg { width: 30px; height: 30px; }
.auth-brand strong { font-size: 20px; letter-spacing: -.01em; }
.auth h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.2; letter-spacing: -.015em; }
.auth p.lead { margin: 0 0 22px; color: var(--ink-2); }
.auth .panel { padding: 24px; }
.auth .switch-link { margin-top: 16px; text-align: center; color: var(--ink-2); }
.auth .switch-link button { border: 0; background: none; color: var(--ink); font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.form-error { color: var(--fail); background: var(--fail-bg); border-radius: var(--r-s); padding: 9px 12px; margin-bottom: 14px; font-size: 13.5px; }

/* ---------------------------------------------------------- writer */
.writer { display: grid; grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.brief { background: var(--sheet); border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; }
.brief-scroll { overflow: auto; padding: 24px 24px 12px; flex: 1; }
.brief h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.brief .lead { color: var(--ink-3); margin: 0 0 22px; }
.brief-group { padding: 4px 0 6px; }
.brief-group + .brief-group { border-top: 1px solid var(--rule-2); padding-top: 18px; }
.brief-group > h2 { font-size: 13px; font-weight: 650; margin: 0 0 12px; color: var(--ink-2); }
.brief-foot { border-top: 1px solid var(--rule); padding: 14px 24px 18px; background: var(--sheet); }
.brief-foot .hint { margin-top: 8px; text-align: center; }
.faq-count { display: flex; align-items: center; gap: 8px; padding: 0 0 8px 0; }
.faq-count .input { width: 70px; min-height: 32px; padding: 4px 8px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); list-style: none; padding: 4px 0 12px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; color: var(--ink-3); }
details.more[open] summary::before { content: "– "; }

.stage { overflow: auto; padding: 28px 36px 80px; min-width: 0; }
.stage-inner { max-width: 820px; margin: 0 auto; }

/* pipeline stepper (a real sequence, so it is numbered) */
.stepper { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; counter-reset: step; }
.stepper li { counter-increment: step; display: grid; gap: 6px; align-content: start; }
.stepper .bar { height: 4px; border-radius: 99px; background: var(--rule); overflow: hidden; position: relative; }
.stepper .s-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.stepper .s-label::before { content: counter(step); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--rule-2); color: var(--ink-3); flex: none; }
.stepper .s-detail { font-size: 12px; color: var(--ink-3); min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.done .bar { background: var(--ink); }
.stepper li.done .s-label { color: var(--ink); }
.stepper li.done .s-label::before { content: "✓"; background: var(--ink); color: var(--sheet); }
.stepper li.running .s-label { color: var(--ink); }
.stepper li.running .s-label::before { background: var(--hl); color: #16213B; }
.stepper li.running .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--hl); border-radius: 99px; animation: sweep 1.3s ease-in-out infinite; }
.stepper li.skipped .s-label::before { content: "–"; }
.stepper li.failed .bar { background: var(--fail); }
.stepper li.failed .s-label { color: var(--fail); }
.stepper li.failed .s-label::before { content: "!"; background: var(--fail); color: #fff; }
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.live-log { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; min-height: 22px; }
.live-log .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hl); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 35%, transparent); }
.log-list { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-3); max-height: 150px; overflow: auto; }
.log-list li { padding: 2px 0; }
.log-list .t { display: inline-block; width: 44px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- the manuscript sheet */
.sheet { background: var(--sheet); border-radius: 4px; box-shadow: var(--shadow-sheet); padding: 64px 72px 72px; min-height: 70vh; }
.doc { font-family: var(--font-doc); font-size: 18.5px; line-height: 1.68; color: var(--ink); max-width: 68ch; margin: 0 auto; }
.doc h1 { font-size: 36px; line-height: 1.15; font-weight: 600; margin: 0 0 26px; letter-spacing: -.015em; }
.doc h2 { font-size: 25px; line-height: 1.25; font-weight: 600; margin: 40px 0 12px; letter-spacing: -.01em; }
.doc h3 { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 28px 0 8px; }
.doc h4 { font-size: 18px; margin: 22px 0 6px; }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { margin: 0 0 18px; padding-left: 1.3em; }
.doc li { margin-bottom: 6px; }
.doc blockquote { margin: 0 0 18px; padding-left: 18px; border-left: 3px solid var(--rule); color: var(--ink-2); font-style: italic; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0 22px; font-family: var(--font-ui); font-size: 14px; line-height: 1.45; }
.doc th, .doc td { border: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--rule-2); font-weight: 600; }
.doc a { color: var(--focus); }
.doc hr { border: 0; border-top: 1px solid var(--rule); margin: 30px 0; }
.doc .h-tag { font-family: var(--font-ui); font-size: 10.5px; font-weight: 650; color: var(--ink-3); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 4px; margin-right: 8px; vertical-align: middle; position: relative; top: -2px; }

/* highlighter marks for AI-sounding sentences: the signature element */
mark.ai {
  color: inherit; padding: 0 1px; margin: 0 -1px; border-radius: 2px; cursor: help;
  background: linear-gradient(100deg, transparent 0, var(--hl-soft) 3px, var(--hl-soft) calc(100% - 3px), transparent 100%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.no-marks mark.ai { background: none; cursor: inherit; }
mark.ai.pulse { animation: pulse 1.2s ease-out 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--hl); } 100% { box-shadow: 0 0 0 10px transparent; } }

.empty-sheet { display: grid; place-items: center; text-align: center; min-height: 60vh; color: var(--ink-3); }
.empty-sheet h2 { font-family: var(--font-doc); font-weight: 500; font-size: 30px; color: var(--ink); margin: 0 0 10px; letter-spacing: -.01em; }
.empty-sheet p { max-width: 42ch; margin: 0 auto 26px; }
.flow { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: 10px; text-align: left; max-width: 380px; counter-reset: f; }
.flow li { counter-increment: f; display: grid; grid-template-columns: 26px 1fr; gap: 10px; color: var(--ink-2); }
.flow li::before { content: counter(f); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); display: grid; place-items: center; font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.flow li strong { color: var(--ink); font-weight: 600; }

/* skeleton lines while the first part is being written */
.skeleton { display: grid; gap: 12px; margin-top: 30px; }
.skeleton span { height: 12px; border-radius: 6px; background: var(--rule-2); }
.skeleton span:nth-child(3n) { width: 72%; } .skeleton span:nth-child(4n) { width: 88%; }

/* ---------------------------------------------------------- article view */
.article { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.stage, .inspector, .brief { min-height: 0; }
.article .stage { padding-top: 0; }
.a-bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); display: flex; align-items: center; gap: 10px; padding: 14px 0; margin-bottom: 8px; flex-wrap: wrap; }
.a-bar .grow { flex: 1; min-width: 20px; }
.a-bar .seg { width: auto; }
.a-bar .stale { font-size: 12.5px; color: var(--mid); }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor-grid .sheet { padding: 36px 34px; min-height: 0; }
.editor-grid .doc { font-size: 16.5px; }
.editor-grid .doc h1 { font-size: 28px; }
.editor-grid .doc h2 { font-size: 21px; }
.md-editor { width: 100%; min-height: calc(100vh - 150px); border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); padding: 22px 24px; font: 14px/1.7 var(--font-code); color: var(--ink); resize: none; outline: none; box-shadow: var(--shadow-sheet); }
.md-editor:focus { border-color: var(--focus); }
.md-help { font-size: 12.5px; color: var(--ink-3); margin: 0 0 8px; }
.md-help code { font-family: var(--font-code); background: var(--rule-2); padding: 1px 5px; border-radius: 4px; color: var(--ink-2); }

.inspector { border-left: 1px solid var(--rule); background: var(--sheet); overflow: auto; }
.i-sec { padding: 20px 22px; border-bottom: 1px solid var(--rule-2); }
.i-sec > h2 { font-size: 13px; font-weight: 650; color: var(--ink-2); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.i-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* human score meter */
.meter-head { display: flex; align-items: baseline; gap: 10px; }
.meter-big { font-size: 44px; line-height: 1; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.meter-of { color: var(--ink-3); font-weight: 550; }
.meter-verdict { margin-left: auto; }
.meter { height: 12px; border-radius: 3px; background: var(--rule-2); margin: 12px 0 6px; position: relative; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; transform: skewX(-12deg); transform-origin: left; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.meter.pass i { background: var(--pass); } .meter.mid i { background: var(--mid); } .meter.fail i { background: var(--fail); }
.meter .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
.meter-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }
.history { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; flex-wrap: wrap; }
.history b { font-variant-numeric: tabular-nums; }
.parts { margin-top: 12px; display: grid; gap: 7px; }
.part { display: grid; grid-template-columns: 1fr 34px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.part .ptrack { grid-column: 1 / -1; height: 4px; background: var(--rule-2); border-radius: 99px; overflow: hidden; margin-top: -4px; }
.part .ptrack i { display: block; height: 100%; background: var(--ink-3); }
.part .pval { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.checklist li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 5px 0; font-size: 13px; align-items: start; }
.checklist .ic { width: 16px; height: 16px; margin-top: 1px; }
.checklist .ok .ic { color: var(--pass); }
.checklist .no .ic { color: var(--fail); }
.checklist .detail { display: block; font-size: 12px; color: var(--ink-3); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--rule-2); border-radius: var(--r-s); padding: 9px 11px; }
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-3); }

.flag-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.flag-list li button { text-align: left; width: 100%; border: 1px solid var(--rule-2); background: var(--sheet); border-radius: var(--r-s); padding: 9px 11px; cursor: pointer; font-size: 13px; line-height: 1.45; }
.flag-list li button:hover { border-color: var(--hl); }
.flag-list .f-sent { font-family: var(--font-doc); font-size: 14.5px; display: block; }
.flag-list .f-reason { font-size: 12px; color: var(--ink-3); display: block; margin-top: 4px; }
.flag-list .unmatched .f-sent { opacity: .7; }
.tips { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.verdict { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; }

/* ---------------------------------------------------------- admin */
.prov-list { display: grid; }
.prov { display: grid; grid-template-columns: auto auto 1fr auto; gap: 16px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--rule-2); }
.prov:last-child { border-bottom: 0; }
.prov .order { display: grid; gap: 2px; }
.prov .order button { width: 26px; height: 20px; padding: 0; }
.prov .p-name { font-weight: 600; }
.prov .p-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.prov .p-meta code { font-family: var(--font-code); font-size: 12px; color: var(--ink-2); }
.prov .p-actions { display: flex; gap: 6px; align-items: center; }
.prov.off .p-name { color: var(--ink-2); }
.prov .switch { padding: 0; }
.prov .test-result { grid-column: 3 / -1; font-size: 12.5px; padding: 8px 10px; border-radius: var(--r-s); }
.prov .test-result.ok { background: var(--pass-bg); color: var(--pass); }
.prov .test-result.err { background: var(--fail-bg); color: var(--fail); word-break: break-word; }

.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.settings-grid:first-of-type { padding-top: 0; }
.settings-grid h2 { font-size: 15px; margin: 0 0 4px; }
.settings-grid p { margin: 0; color: var(--ink-3); font-size: 13px; }
.settings-save { position: sticky; bottom: 0; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); padding: 14px 0; display: flex; gap: 10px; align-items: center; }

.prompt-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
.prompt-nav { display: grid; gap: 2px; position: sticky; top: 20px; }
.prompt-nav button { text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: var(--r-s); cursor: pointer; }
.prompt-nav button:hover { background: var(--rule-2); }
.prompt-nav button[aria-current="true"] { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); font-weight: 600; }
.prompt-nav small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; margin-top: 2px; font-weight: 400; }
.code-editor { width: 100%; min-height: 520px; font: 13.5px/1.65 var(--font-code); border: 1px solid var(--rule); border-radius: var(--r-s); padding: 16px 18px; background: var(--sheet); color: var(--ink); resize: vertical; outline: none; tab-size: 2; }
.code-editor:focus { border-color: var(--focus); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 14px 16px; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi span { color: var(--ink-3); font-size: 12.5px; }
.err-list { list-style: none; margin: 0; padding: 0; }
.err-list li { padding: 10px 14px; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.err-list li:last-child { border-bottom: 0; }
.err-list .e-head { color: var(--ink-3); font-size: 12px; }
.err-list .e-msg { word-break: break-word; }

/* ---------------------------------------------------------- modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(13, 19, 34, .45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--sheet); border-radius: var(--r-l); width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { padding: 20px 22px 4px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--ink-3); }
.modal-body { padding: 16px 22px 6px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-foot .left { margin-right: auto; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--sheet); padding: 11px 16px; border-radius: var(--r-m); box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 380px; font-size: 13.5px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--fail); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; min-height: 60vh; color: var(--ink-3); }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty h2 { color: var(--ink); font-size: 18px; margin: 0 0 6px; }
.empty p { margin: 0 0 18px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .article { grid-template-columns: minmax(0, 1fr) 320px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-grid .preview-pane { display: none; }
}
@media (max-width: 980px) {
  .writer, .article { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
  .shell { grid-template-rows: auto; }
  .stage { overflow: visible; }
  .brief { border-right: 0; border-bottom: 1px solid var(--rule); }
  .brief-scroll { overflow: visible; }
  .inspector { border-left: 0; border-top: 1px solid var(--rule); }
  .shell { height: auto; min-height: 100vh; }
  .main { overflow: visible; }
  .settings-grid, .prompt-layout { grid-template-columns: 1fr; gap: 14px; }
  .sheet { padding: 36px 26px; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { flex-direction: row; padding: 8px 10px; position: sticky; top: 0; z-index: 20; }
  .rail .mark { margin: 0 8px 0 0; width: 34px; height: 34px; }
  .rail a, .rail button.rail-btn { width: auto; padding: 6px 10px; }
  .rail a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--hl); }
  .page, .stage { padding: 20px 16px 60px; }
  .row { grid-template-columns: 1fr; }
  .doc { font-size: 17px; }
  .doc h1 { font-size: 28px; }
  .prov { grid-template-columns: auto 1fr; }
  .prov .order { display: none; }
  .prov .p-actions { grid-column: 1 / -1; }
  .table th:nth-child(n+3):not(:last-child), .table td:nth-child(n+3):not(:last-child) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------- small alignment fixes */
.row { align-items: start; }
.table .actions .btn { vertical-align: middle; }


/* ---------------------------------------------------------- remote access */
.remote-card + .remote-card { margin-top: 16px; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rc-head h2 { font-size: 16px; margin: 0; }
.rc-lead { color: var(--ink-2); margin: 0 0 4px; max-width: 70ch; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.rc-notes { margin: 16px 0 0; padding-left: 18px; color: var(--ink-3); font-size: 12.5px; display: grid; gap: 4px; max-width: 75ch; }
.rc-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); }
.remote-card code { font-family: var(--font-code); font-size: 13px; background: var(--rule-2); padding: 2px 6px; border-radius: 4px; color: var(--ink); word-break: break-all; }
.share-link { display: flex; gap: 10px; align-items: center; background: var(--rule-2); border-radius: var(--r-m); padding: 12px 14px; margin: 14px 0 8px; flex-wrap: wrap; }
.share-link a { flex: 1; min-width: 200px; font-weight: 650; font-size: 16px; color: var(--ink); text-decoration: none; word-break: break-all; }
.share-link a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- v2 additions */
.live-log .live-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-log .live-time { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12.5px; }
.live-log .live-prov { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.btn-stop { border-color: var(--fail); color: var(--fail); }
.btn-stop:hover { background: var(--fail-bg); border-color: var(--fail); }
.btn-stop svg { width: 12px; height: 12px; }
.history b.best { color: var(--pass); text-decoration: underline; text-underline-offset: 3px; }
.sec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sec-list li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.sec-list li:last-child { border-bottom: 0; }
.sec-list .sec-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sec-list .detail, .img-list .detail { display: block; font-size: 12px; color: var(--ink-3); }
.img-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; color: var(--ink-2); }
.img-list strong { display: block; color: var(--ink); font-weight: 600; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--rule); border-radius: var(--r-s); padding: 10px 12px; cursor: pointer; }
.action-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.action-opt input { margin-top: 3px; accent-color: var(--ink); }
.action-opt strong { display: block; font-size: 13.5px; }
.action-opt small { display: block; color: var(--ink-3); font-size: 12px; }
.role-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prov .roles .pill { height: 20px; font-size: 11.5px; }
pre.notes { white-space: pre-wrap; font: 12.5px/1.6 var(--font-code); background: var(--rule-2); border-radius: var(--r-s); padding: 12px 14px; color: var(--ink-2); max-height: 300px; overflow: auto; }
@media (max-width: 640px) { .action-grid, .role-row { grid-template-columns: 1fr; } }
.job-head { position: sticky; top: -28px; z-index: 6; background: var(--paper); padding: 28px 0 2px; margin-top: -28px; }
.stepper li.stopped .bar { background: var(--ink-3); }
.stepper li.stopped .s-label::before { content: "■"; font-size: 8px; background: var(--ink-3); color: var(--sheet); }

/* ---------------------------------------------------------- v2.1 modules */
.quick { padding: 20px 22px; margin-bottom: 18px; }
.quick-label { display: block; font-weight: 650; font-size: 15px; margin-bottom: 10px; }
.quick-row { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-row .input { flex: 1; min-width: 240px; }
.quick-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.quick-links a { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); text-decoration: none; }
.quick-links a:hover { color: var(--ink); text-decoration: underline; }
.quick-links svg { width: 15px; height: 15px; }
.home-card { margin-bottom: 18px; }
.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--rule-2); }
.home-card-head h2 { font-size: 14px; margin: 0; }
.prov-status { list-style: none; margin: 0; padding: 6px 16px; }
.prov-status li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule-2); align-items: start; }
.prov-status li:last-child { border-bottom: 0; }
.prov-status strong { display: block; font-size: 13.5px; font-weight: 600; }
.dotc { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--ink-3); }
.dotc.pass { background: var(--pass); } .dotc.mid { background: var(--mid); } .dotc.fail { background: var(--fail); }
.home-queue { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--rule-2); font-size: 13px; color: var(--ink-2); }
.home-queue svg { width: 15px; height: 15px; }
.p-problem { grid-column: 3 / -1; font-size: 12.5px; color: var(--fail); background: var(--fail-bg); border-radius: var(--r-s); padding: 7px 10px; word-break: break-word; }
.inline-check { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.inline-check input { accent-color: var(--ink); }
.ideas-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.ideas-head .grow { flex: 1; }
.kw-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.kw-list { list-style: none; margin: 0; padding: 6px 10px 10px; max-height: 360px; overflow: auto; }
.kw-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 4px; border-radius: 6px; font-size: 13.5px; }
.kw-list li:hover { background: var(--rule-2); }
.kw-list label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; flex: 1; }
.kw-list input { margin-top: 3px; accent-color: var(--ink); }
.kw-list .btn { opacity: 0; }
.kw-list li:hover .btn, .kw-list .btn:focus { opacity: 1; }
.hz-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.hz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hz-text { width: 100%; min-height: 60vh; border: 1px solid var(--rule); border-radius: var(--r-s); padding: 16px 18px; font: 15px/1.65 var(--font-doc); color: var(--ink); background: var(--sheet); resize: vertical; outline: none; }
.hz-text:focus { border-color: var(--focus); }
.hz-side { position: sticky; top: 20px; }
.q-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.q-h { font-size: 15px; margin: 0 0 14px; }
.q-progress { height: 4px; background: var(--rule-2); border-radius: 99px; overflow: hidden; margin: 6px 0 3px; max-width: 320px; }
.q-progress span { display: block; height: 100%; background: var(--hl); }
.preset-bar { display: flex; gap: 8px; margin: 0 0 18px; }
.preset-bar .select { flex: 1; min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; background-position: calc(100% - 16px) 14px, calc(100% - 11px) 14px; }
.foot-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
@media (max-width: 980px) { .home-grid, .hz-grid, .q-grid { grid-template-columns: 1fr; } .hz-side { position: static; } }

/* ---- v2.3.2: sign-in password reveal */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  color: var(--ink-3); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 8px; border-radius: var(--r-s); cursor: pointer; }
.pw-eye:hover { color: var(--ink); background: var(--rule-2); }
.pw-eye:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ---- v2.3.2: two-tone navigation icons (a highlighter shape behind the line drawing) */
svg.duo .acc { fill: currentColor; stroke: none; opacity: .16; }
.rail svg.duo .acc { fill: var(--hl); opacity: .22; transition: opacity .18s ease, transform .18s ease; transform-origin: center; transform-box: fill-box; }
.rail a:hover svg.duo .acc, .rail button.rail-btn:hover svg.duo .acc { opacity: .55; }
.rail a[aria-current="page"] svg.duo .acc { opacity: 1; }
.rail a[aria-current="page"] svg.duo { color: #fff; }
.rail a svg.duo, .rail button.rail-btn svg.duo { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { .rail svg.duo .acc { transition: none; } }

/* ---- v2.4: roles. Hide what the person's role can't do (the server checks it too). */
.article.no-edit #mode, .article.no-edit #save-btn, .article.no-edit #recheck, .article.no-edit #humanize,
.article.no-edit [data-sec], .article.no-edit #meta-form button[type="submit"], .article.no-edit #strength,
.article.no-edit label[for="strength"], .article.no-delete #del, .article.no-export #dl, .article.no-export #dl-top { display: none !important; }
.article.no-edit #meta-form .input, .article.no-edit #meta-form .textarea { pointer-events: none; background: var(--rule-2); }

/* ---- v2.4: roles page */
.role-pill { font-weight: 650; }
.role-pill.role-admin { background: var(--ink); color: var(--hl); }
.role-pill.role-manager { background: #E4E9FF; color: #2A3FA8; }
.role-pill.role-writer { background: var(--pass-bg); color: var(--pass); }
.role-pill.role-reviewer { background: var(--mid-bg); color: var(--mid); }
[data-theme="dark"] .role-pill.role-admin { background: var(--hl); color: #16213B; }
[data-theme="dark"] .role-pill.role-manager { background: #24305F; color: #C5D0FF; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 12px 14px; }
.role-card p { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.pm-wrap { overflow-x: auto; }
.perm-matrix { min-width: 760px; }
.perm-matrix th.pm-first { text-align: left; width: 38%; min-width: 260px; position: sticky; left: 0; background: var(--sheet); z-index: 1; font-weight: 500; }
.perm-matrix thead th { vertical-align: bottom; }
.perm-matrix .pm-role { text-align: center; min-width: 118px; }
.perm-matrix .pm-sub { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 4px; }
.perm-matrix .pm-tools { display: flex; gap: 2px; justify-content: center; margin-top: 4px; }
.btn-xs { padding: 2px 7px; font-size: 12px; min-height: 0; height: auto; }
.perm-matrix tr.pm-group th { background: var(--rule-2); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); padding: 7px 14px; text-align: left; position: static; }
.perm-matrix .pm-cell { text-align: center; vertical-align: middle; }
.pm-check { display: inline-grid; place-items: center; cursor: pointer; position: relative; width: 26px; height: 26px; }
.pm-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pm-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--sheet); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.pm-check input:checked + .pm-box { background: var(--ink); border-color: var(--ink); }
.pm-check input:checked + .pm-box::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--hl); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.pm-check input:focus-visible + .pm-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.pm-check.locked { cursor: default; } .pm-check.locked input { cursor: default; }
.pm-check.locked input:checked + .pm-box { opacity: .55; }
.pm-limit { width: 84px; text-align: center; margin: 0 auto; }
[data-theme="dark"] .pm-check input:checked + .pm-box { background: var(--hl); border-color: var(--hl); }
[data-theme="dark"] .pm-check input:checked + .pm-box::after { border-color: #16213B; }
.perm-matrix th.pm-first .t-title { color: var(--ink); font-weight: 600; }
.perm-matrix th.pm-first .t-sub { font-weight: 400; }
.perm-matrix .pm-tools { min-height: 24px; align-items: center; }
.home-grid > :only-child { grid-column: 1 / -1; }

/* ---- v2.4.2: team links and invites */
.team-links { margin-bottom: 16px; }
.team-links .rc-head { flex-wrap: wrap; margin-bottom: 10px; }
.tl-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule-2); flex-wrap: wrap; }
.tl-text { display: grid; gap: 2px; min-width: 230px; flex: 1; }
.tl-text span { color: var(--ink-3); font-size: 12.5px; }
.tl-url { font-family: var(--font-code); font-size: 13.5px; background: var(--rule-2); padding: 6px 10px; border-radius: var(--r-s); color: var(--ink); user-select: all; word-break: break-all; }
.invite-text { font-family: var(--font-code); font-size: 13px; line-height: 1.55; min-height: 210px; }
.extra-sec summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.extra-sec[open] summary { color: var(--ink); }

/* ---- v2.4.3: greeting follows the team's time zone */
.greet-head { align-items: baseline; }
.team-clock { color: var(--ink-3); font-size: 13.5px; font-weight: 500; }

/* ---- v2.6: Briefs */
.brief-new { margin-bottom: 22px; }
.brief-new-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.list-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.list-head h2 { font-size: 15px; margin: 0; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--rule-2); }
.brief-head { align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.brief-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.bchip { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--rule-2); color: var(--ink-2); }
.brief-q { margin-top: 8px; } .brief-q ul { margin: 4px 0 0 18px; padding: 0; }
.brief-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.3fr); gap: 18px; align-items: start; }
.brief-src { position: sticky; top: 16px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.brief-src h2 { font-size: 14px; margin: 0 0 10px; }
.brief-raw { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); overflow: auto; }
.brief-pieces { display: grid; gap: 16px; }
.bp { padding: 18px 20px; }
.bp-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.bp-n { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.bp-head h3 { margin: 2px 0 2px; font-size: 18px; }
.bp-meta { font-size: 13px; color: var(--ink-3); }
.bp-plan { margin-top: 14px; border-top: 1px solid var(--rule-2); padding-top: 12px; }
.bp-plan > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.bp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; margin-top: 12px; align-items: start; }
.bp-grid .span2 { grid-column: span 2; } .bp-grid .span4 { grid-column: 1 / -1; }
.bp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.bp-live:not(:empty) { margin-top: 12px; }
.bv-wait { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; margin-top: 12px; }
.bv { margin-top: 16px; border-top: 1px solid var(--rule-2); padding-top: 14px; }
.bv-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.bv-head p { margin: 0; color: var(--ink-2); }
.bv-score { display: grid; place-items: center; min-width: 84px; padding: 8px 10px; border-radius: var(--r-m); background: var(--rule-2); }
.bv-score b { font-size: 22px; line-height: 1.1; } .bv-score span { font-size: 11.5px; color: var(--ink-3); }
.bv-score.ok { background: var(--pass-bg); color: var(--pass); } .bv-score.bad { background: var(--fail-bg, #FDECEC); color: var(--fail, #B42318); }
.bv-group { margin-top: 10px; }
.bv-group h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.bv-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bv-group li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 6px 8px; border-radius: var(--r-s); }
.bv-group li.miss { background: var(--fail-bg, #FDECEC); } .bv-group li.warn { background: var(--mid-bg); }
.bv-ic { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 800; }
li.ok .bv-ic { background: var(--pass-bg); color: var(--pass); } li.miss .bv-ic { background: var(--fail, #B42318); color: #fff; } li.warn .bv-ic { background: var(--mid); color: #fff; }
.bv-t { display: grid; gap: 2px; } .bv-d { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 1100px) { .brief-grid { grid-template-columns: 1fr; } .brief-src { position: static; max-height: 280px; } .bp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- v2.6: Internal links */
.lk-bar { display: flex; gap: 10px; align-items: center; margin: 14px 0 10px; flex-wrap: wrap; }
.lk-search { position: relative; min-width: 280px; flex: 0 1 380px; }
.lk-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.lk-search .input { padding-left: 34px; }
.lk-url { display: block; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); text-decoration: none; }
.lk-url:hover { text-decoration: underline; }
.inline-row { display: flex; gap: 8px; align-items: center; } .inline-row .select { flex: 1; }
.lprev { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.lprev li { display: grid; font-size: 13px; padding: 6px 8px; background: var(--rule-2); border-radius: var(--r-s); }
.lprev li span { color: var(--ink-3); font-size: 12px; word-break: break-all; }

/* ---- v2.7: Audit */
.au-new { margin-bottom: 22px; }
.au-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; }
.au-label { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.au-src { margin-bottom: 10px; }
.au-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; align-items: start; }
.au-grid .span2 { grid-column: 1 / -1; }
.au-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; border-top: 1px solid var(--rule-2); padding-top: 14px; }
.au-ready b { font-size: 15px; }
.au-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 18px; }
.au-tile { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 4px; }
.au-tile > span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.au-tile b { font-size: 24px; line-height: 1.15; } .au-tile b small { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.au-tile em { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.au-sec { margin-bottom: 22px; }
.au-sec h3 { font-size: 15px; margin: 0 0 8px; }
.au-sec h4 { font-size: 13px; margin: 0 0 4px; color: var(--ink-2); }
.au-lead { font-size: 15.5px; line-height: 1.6; margin: 0 0 12px; max-width: 900px; }
.au-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.au-two p { margin: 0; color: var(--ink-2); }
.au-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.au-items td { vertical-align: top; }
.au-claims { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.au-claims li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; background: var(--rule-2); padding: 8px 10px; border-radius: var(--r-s); }
.au-copybar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.au-copy { line-height: 1.65; min-width: 0; }
.au-copy p { margin: 0 0 12px; }
.tc-h { display: flex; gap: 10px; align-items: baseline; margin: 18px 0 8px; }
.tc-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 6px; border-radius: 5px; background: var(--ink); color: var(--hl); flex: none; vertical-align: middle; }
[data-theme="dark"] .tc-tag { background: var(--hl); color: #16213B; }
.tc-cta, .tc-meta, .tc-block { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.tc-btn { background: var(--ink); color: #fff; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; }
[data-theme="dark"] .tc-btn { background: #fff; color: #16213B; }
.tc-dest { font-size: 12.5px; color: var(--ink-3); }
.tc-meta { background: var(--rule-2); padding: 8px 10px; border-radius: var(--r-s); font-size: 14px; }
.tc-len { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.tc-block { color: var(--ink-3); font-size: 13px; }
.tc-ph { background: var(--mid-bg); color: var(--mid); padding: 0 4px; border-radius: 4px; }
.au-diff { font-size: 14.5px; }
.au-diff del { background: var(--fail-bg); color: var(--fail); text-decoration: line-through; }
.au-diff ins { background: var(--pass-bg); color: var(--pass); text-decoration: none; }
@media (max-width: 1100px) { .au-cols, .au-two { grid-template-columns: 1fr; } .au-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.au-copywrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.au-copy > * { max-width: 860px; }
.au-side { position: sticky; top: 16px; display: grid; gap: 6px; }
.au-side h3 { margin: 0 0 6px; font-size: 15px; }
.au-side h4 { margin: 12px 0 4px; font-size: 13px; color: var(--ink-2); }
.au-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 4px 0; border-bottom: 1px solid var(--rule-2); }
.au-kv span { color: var(--ink-3); } .au-kv b.pass { color: var(--pass); } .au-kv b.mid { color: var(--mid); } .au-kv b.fail { color: var(--fail); }
.au-kvd { margin: 2px 0 4px; }
.au-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.au-mini .pill { margin-right: 4px; }
.au-copybar .seg { width: auto; min-width: 260px; }
.au-new .au-col:first-child { display: flex; flex-direction: column; }
.au-new [data-pane="paste"]:not([hidden]) { flex: 1; display: flex; }
.au-new #ad { flex: 1; min-height: 300px; }
@media (max-width: 1100px) { .au-copywrap { grid-template-columns: 1fr; } .au-side { position: static; } }
.au-foot .grow, .au-copybar .grow, .list-head .grow { flex: 1; }

/* ---- v2.7.1: fixed link */
.fixed-card { border-color: color-mix(in srgb, var(--hl) 55%, var(--rule)); }
.fx-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.fx-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: var(--ink-3); }
.fx-step.now, .fx-step.done { color: var(--ink); }
.fx-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 1.5px solid var(--rule); background: var(--sheet); }
.fx-step.now .fx-n { border-color: var(--hl); background: var(--hl); color: #16213B; }
.fx-step.done .fx-n { border-color: var(--pass); color: var(--pass); }
.fx-step strong { display: block; line-height: 28px; }
.fx-body { margin-top: 4px; }
.fx-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fx-name label { font-weight: 600; font-size: 13.5px; }
.fx-name .input { width: 240px; font-family: var(--mono, ui-monospace, monospace); }
.fx-name .grow { flex: 1; }
.fx-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-m);
  background: var(--rule-2); }
.fx-url a { font-size: 17px; font-weight: 700; word-break: break-all; margin-right: auto; }
.cf-old > summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.cf-old > summary::-webkit-details-marker { display: none; }
.cf-sum-t { font-weight: 700; font-size: 15px; }
.cf-sum-t::before { content: "▸ "; color: var(--ink-3); }
.cf-old[open] .cf-sum-t::before { content: "▾ "; }
#fixed-slot { margin-bottom: 16px; }
.fixed-card .rc-lead { margin-bottom: 14px; }
