/* CAQAbot design system. Light-first, CAQA navy brand, four suggestion categories. */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/inter-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/inter-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Source Serif'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-wght-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif'; font-style: italic; font-display: swap; font-weight: 200 900; src: url(/assets/fonts/source-serif-4-latin-wght-italic.woff2) format('woff2'); }

:root {
  --navy: #193e99;
  --navy-600: #153585;
  --navy-700: #0f2766;
  --navy-900: #0a1a45;
  --navy-50: #f0f4fc;
  --navy-100: #dfe7f8;
  --navy-200: #c3d1f1;
  --red: #e51b27;
  --green: #018c0b;
  --green-600: #017109;
  --green-50: #ebf6ec;
  --grey-rule: #7e7e7e;
  --ink: #18202f;
  --ink-2: #364055;
  --muted: #5d687c;
  --faint: #8590a3;
  --line: #e2e6ee;
  --line-2: #eef1f6;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --c-correctness: #d42530;
  --c-clarity: #1f6feb;
  --c-engagement: #0b8a5a;
  --c-delivery: #7a3fd0;
  --t-correctness: rgba(212, 37, 48, 0.12);
  --t-clarity: rgba(31, 111, 235, 0.12);
  --t-engagement: rgba(11, 138, 90, 0.12);
  --t-delivery: rgba(122, 63, 208, 0.12);
  --ok: #0b8a5a;
  --warn: #b25e00;
  --bad: #d42530;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-2: 0 10px 30px rgba(16, 24, 40, 0.1), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-3: 0 24px 60px rgba(10, 26, 69, 0.18);
  --font-ui: 'Inter', Verdana, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-doc: 'Source Serif', Georgia, 'Times New Roman', serif;
  --topbar-h: 64px;
  --rail-w: 88px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
body { margin: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--surface); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
body.layout-tool { background: var(--bg); }
img, svg { display: block; max-width: 100%; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy-700); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; color: var(--ink); letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid rgba(31, 111, 235, 0.45); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 1000; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Icons (inline SVG injected by JS) ---------- */
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }

/* ---------- Buttons and controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(15, 39, 102, 0.3); }
.btn-primary:hover { background: var(--navy-600); color: #fff; }
.btn-secondary { border-color: var(--line); background: var(--surface); }
.btn-secondary:hover { border-color: var(--navy-200); background: var(--navy-50); color: var(--navy-700); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(212, 37, 48, 0.3); }
.btn-danger:hover { background: rgba(212, 37, 48, 0.06); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 16px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; border-radius: 10px; }
.btn-icon.btn-sm { width: 30px; min-height: 30px; border-radius: 8px; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(25, 62, 153, 0.15); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d687c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.select-sm { min-height: 34px; padding: 4px 30px 4px 10px; font-size: 13.5px; border-radius: 999px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #c9d0dc; position: relative; cursor: pointer; transition: background 0.2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch input:checked { background: var(--navy); }
.switch input:checked::after { transform: translateX(16px); }

.range { width: 100%; accent-color: var(--navy); }
.slider-wrap { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.slider-wrap input { width: 120px; accent-color: var(--navy); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--line-2); font-size: 13px; color: var(--ink-2); border: 1px solid transparent; }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; }
.chip button:hover { color: var(--bad); }
.chip-btn { cursor: pointer; background: var(--surface); border-color: var(--line); }
.chip-btn:hover { border-color: var(--navy-200); background: var(--navy-50); }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; border: 0; background: none; padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tab:hover { color: var(--ink); background: var(--line-2); }
.tab[aria-selected='true'] { color: var(--navy); }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--navy); }
.tab .badge { margin-left: 6px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--line-2); border-radius: 999px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-1); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--line-2); color: var(--ink-2); }
.badge-navy { background: var(--navy); color: #fff; }
.badge-new { background: var(--green-50); color: var(--green-600); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--navy-50); color: var(--ink-2); font-size: 14px; border: 1px solid var(--navy-100); }
.notice-warn { background: #fff7ec; border-color: #f6dcb6; }
.notice-bad { background: #fff1f1; border-color: #f7caca; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { height: var(--topbar-h); display: flex; align-items: center; gap: 22px; padding: 0 20px; max-width: 1480px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-logo { height: 46px; width: auto; }
.brand-logo-footer { height: 60px; width: auto; }
.topnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.topnav > a, .menu-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.topnav > a:hover, .menu-btn:hover, .menu-btn[aria-expanded='true'] { background: var(--line-2); color: var(--ink); }
.chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
.menu-btn[aria-expanded='true'] .chev { transform: rotate(225deg) translateY(-1px); }
.menu { position: relative; }
.menu-panel { position: absolute; top: calc(100% + 10px); left: 0; width: min(880px, calc(100vw - 40px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); padding: 14px; animation: drop 0.16s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.menu-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.menu-item:hover { background: var(--navy-50); color: var(--ink); }
.menu-item b { display: block; font-size: 14.5px; }
.menu-item small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.menu-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); flex: none; }
.menu-item:hover .menu-ico { background: var(--navy); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.engine { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--line-2); display: inline-flex; align-items: center; gap: 6px; }
.engine::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.engine.is-off::before { background: var(--bad); }
.burger { display: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer; padding: 10px 9px; flex-direction: column; justify-content: space-between; }
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.2s, opacity 0.2s; }
.burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
.drawer { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 49; background: rgba(10, 26, 69, 0.35); }
.drawer-in { background: var(--surface); max-height: 100%; overflow-y: auto; padding: 12px 12px 30px; display: grid; gap: 2px; border-bottom: 1px solid var(--line); }

/* ---------- Page layouts ---------- */
.page { display: block; }
.layout-tool .page { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.rail { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; scrollbar-width: thin; background: var(--surface); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.rail-link { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; }
.rail-link:hover { background: var(--line-2); color: var(--ink); }
.rail-link.is-active { background: var(--navy-50); color: var(--navy); }
.rail-ico { display: grid; place-items: center; width: 34px; height: 30px; }
.rail-link.is-active .rail-ico { color: var(--navy); }
.rail-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.main { min-width: 0; outline: none; }
.layout-tool .main { padding: 24px 28px 48px; }

/* ---------- Tool scaffolding ---------- */
.tool { max-width: 1320px; margin: 0 auto; }
.tool-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tool-head h1 { font-size: 26px; margin: 0; display: flex; align-items: center; gap: 10px; }
.tool-head h1 .ico { color: var(--navy); width: 26px; height: 26px; }
.tool-head p { margin: 4px 0 0; color: var(--muted); max-width: 720px; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1); overflow: hidden; }
.tool-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 14px 0; border-bottom: 1px solid var(--line); }
.tool-bar .tabs { border-bottom: 0; flex: 1; min-width: 0; }
.tool-bar-right { display: flex; align-items: center; gap: 12px; padding: 6px 0; flex-wrap: wrap; }
.tool-bar-right .select { width: auto; }
.panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 460px; }
.pane { display: flex; flex-direction: column; min-width: 0; position: relative; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-body { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; }
.pane-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line-2); min-height: 58px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.counter { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plain-area { flex: 1; width: 100%; min-height: 380px; border: 0; padding: 18px 20px; resize: none; background: transparent; font-family: var(--font-doc); font-size: 17px; line-height: 1.65; color: var(--ink); }
.plain-area:focus { outline: none; }
.plain-area::placeholder, .hl-input::placeholder { color: #9aa3b4; font-family: var(--font-ui); font-size: 15px; }
.output { flex: 1; padding: 18px 20px; font-family: var(--font-doc); font-size: 17px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; min-height: 380px; }
.output:empty::before { content: attr(data-placeholder); color: #9aa3b4; font-family: var(--font-ui); font-size: 15px; }
.output .w-changed { color: #b54708; }
.output .w-changed.is-clickable, .output .w-word { cursor: pointer; border-radius: 3px; }
.output .w-word:hover, .output .w-changed:hover { background: var(--navy-50); }
.output .w-longest { text-decoration: underline; text-decoration-color: var(--c-clarity); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.output .sent { border-radius: 3px; }
.output .sent:hover { background: rgba(31, 111, 235, 0.06); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.empty-cta { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.empty-cta > div { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.drop-active { outline: 2px dashed var(--navy); outline-offset: -8px; background: var(--navy-50); }

.cursor-blink::after { content: ''; display: inline-block; width: 2px; height: 1.1em; background: var(--navy); margin-left: 2px; vertical-align: -0.2em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.skeleton { display: grid; gap: 10px; padding: 20px; }
.skeleton i { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef1f6 0%, #f7f9fc 50%, #eef1f6 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton i:nth-child(3n) { width: 70%; }
.skeleton i:nth-child(4n) { width: 85%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Highlight editor (textarea over a highlight backdrop) ---------- */
.hl { position: relative; flex: 1; display: flex; min-height: 0; }
.hl-backdrop, .hl-input { margin: 0; border: 0; padding: 18px 20px; font-family: var(--font-doc); font-size: 17px; line-height: 1.65; letter-spacing: normal; word-spacing: normal; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; tab-size: 4; text-rendering: auto; font-kerning: normal; }
.hl-backdrop { position: absolute; inset: 0; overflow: hidden; color: transparent; pointer-events: none; z-index: 0; }
.hl-input { position: relative; z-index: 1; width: 100%; min-height: 380px; resize: none; background: transparent; color: var(--ink); caret-color: var(--navy); overflow-y: auto; }
.hl-input:focus { outline: none; }
.hl-auto .hl-input { overflow: hidden; }
.hl-backdrop mark { color: transparent; background: none; border-radius: 2px; border-bottom: 2px solid transparent; padding-bottom: 1px; transition: background 0.12s; }
.hl-backdrop mark.c-correctness { border-bottom-color: var(--c-correctness); }
.hl-backdrop mark.c-clarity { border-bottom-color: var(--c-clarity); }
.hl-backdrop mark.c-engagement { border-bottom-color: var(--c-engagement); }
.hl-backdrop mark.c-delivery { border-bottom-color: var(--c-delivery); }
.hl-backdrop mark.c-soft { border-bottom: 0; background: rgba(31, 111, 235, 0.06); }
.hl-backdrop mark.is-active.c-correctness { background: var(--t-correctness); }
.hl-backdrop mark.is-active.c-clarity { background: var(--t-clarity); }
.hl-backdrop mark.is-active.c-engagement { background: var(--t-engagement); }
.hl-backdrop mark.is-active.c-delivery { background: var(--t-delivery); }
.hl-backdrop mark.m-ai_generated { background: rgba(229, 140, 20, 0.22); border: 0; }
.hl-backdrop mark.m-ai_refined { background: rgba(229, 180, 20, 0.2); border: 0; }
.hl-backdrop mark.m-human_refined { background: rgba(31, 111, 235, 0.1); border: 0; }
.hl-backdrop mark.m-human { background: none; border: 0; }
.hl-backdrop mark.m-match { background: rgba(212, 37, 48, 0.14); border-bottom: 2px solid rgba(212, 37, 48, 0.55); }
.hl-backdrop mark.m-claim { background: rgba(122, 63, 208, 0.1); border-bottom: 2px dashed rgba(122, 63, 208, 0.6); }
.hl-backdrop mark.m-tone { background: rgba(11, 138, 90, 0.1); border: 0; }
.hl-backdrop mark.a-pasted { background: rgba(229, 140, 20, 0.2); border: 0; }
.hl-backdrop mark.a-ai { background: rgba(122, 63, 208, 0.16); border: 0; }
.hl-backdrop mark.a-suggestion { background: rgba(11, 138, 90, 0.16); border: 0; }
.hl-backdrop mark.a-imported { background: rgba(31, 111, 235, 0.1); border: 0; }
.hl-backdrop mark.is-focus { outline: 2px solid var(--navy); outline-offset: 1px; }

/* ---------- Suggestion cards ---------- */
.side { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.side-head { padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.side-body { padding: 0 12px 16px; display: grid; gap: 8px; align-content: start; overflow-y: auto; }
.cat-filter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px 12px; }
.cat-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 8px 7px; text-align: left; cursor: pointer; display: grid; gap: 2px; position: relative; overflow: hidden; }
.cat-btn::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--cat, var(--navy)); }
.cat-btn b { font-size: 18px; line-height: 1; }
.cat-btn span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cat-btn[aria-pressed='true'] { border-color: var(--cat); box-shadow: 0 0 0 1px var(--cat) inset; }
.cat-btn.c-correctness { --cat: var(--c-correctness); }
.cat-btn.c-clarity { --cat: var(--c-clarity); }
.cat-btn.c-engagement { --cat: var(--c-engagement); }
.cat-btn.c-delivery { --cat: var(--c-delivery); }
.sug { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s; border-left: 3px solid var(--cat, var(--line)); }
.sug:hover { box-shadow: var(--shadow-1); }
.sug.is-active { box-shadow: var(--shadow-2); border-color: var(--navy-200); border-left-color: var(--cat); cursor: default; }
.sug.c-correctness { --cat: var(--c-correctness); }
.sug.c-clarity { --cat: var(--c-clarity); }
.sug.c-engagement { --cat: var(--c-engagement); }
.sug.c-delivery { --cat: var(--c-delivery); }
.sug-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sug-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); flex: none; }
.sug-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.sug-preview { font-size: 14px; margin-top: 6px; line-height: 1.5; }
.sug-preview del { color: var(--c-correctness); text-decoration-thickness: 1.5px; }
.sug-preview ins { text-decoration: none; background: rgba(11, 138, 90, 0.12); color: #075e3e; padding: 0 3px; border-radius: 4px; font-weight: 600; }
.sug-detail { display: none; margin-top: 8px; }
.sug.is-active .sug-detail { display: block; }
.sug-expl { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; }
.sug-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sug-opt { border: 1px solid var(--line); background: var(--navy); color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sug-opt.alt { background: var(--surface); color: var(--navy); border-color: var(--navy-200); }
.sug-opt:hover { filter: brightness(1.08); }
.sug-dismiss { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 5px 6px; }
.sug-dismiss:hover { color: var(--ink); text-decoration: underline; }
.all-clear { text-align: center; padding: 34px 16px; color: var(--muted); }
.all-clear .ico { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--ok); }

.popover { position: absolute; z-index: 60; width: min(340px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 12px; animation: drop 0.14s ease-out; }
.popover .sug { border: 0; padding: 0; box-shadow: none; cursor: default; }
.popover .sug-detail { display: block; }
.pop-list { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.pop-list button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.pop-list button:hover { background: var(--navy-50); }
.pop-list small { color: var(--muted); font-size: 12px; }

/* ---------- Score ring ---------- */
.score { display: flex; align-items: center; gap: 12px; }
.ring { --p: 0; --c: var(--navy); width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line-2) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: ''; grid-area: 1 / 1; width: 50px; height: 50px; border-radius: 50%; background: var(--surface); }
.ring b { grid-area: 1 / 1; font-size: 18px; font-weight: 800; z-index: 1; font-variant-numeric: tabular-nums; }
.ring-lg { width: 120px; height: 120px; }
.ring-lg::before { width: 96px; height: 96px; }
.ring-lg b { font-size: 30px; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 13.5px; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--navy); width: 0; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* ---------- Results panels ---------- */
.result-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1); }
.panel-head { padding: 16px 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-body { padding: 14px 18px 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.list-clean { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.source { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.source a { font-weight: 600; word-break: break-word; }
.source .url { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.pct { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Modal and toasts ---------- */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(10, 26, 69, 0.42); display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-3); animation: drop 0.18s ease-out; }
.modal-head { padding: 18px 20px 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 19px; margin: 0; }
.modal-body { padding: 8px 20px 18px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); }
.toasts { position: fixed; z-index: 100; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-2); animation: drop 0.18s ease-out; max-width: calc(100vw - 32px); }
.toast.is-error { background: #a3121b; }

/* ---------- Editor (Write) ---------- */
.writer { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 0; min-height: calc(100vh - var(--topbar-h)); }
.layout-tool .main:has(.writer) { padding: 0; }
.writer-main { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border-right: 1px solid var(--line); }
.writer-top { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; position: sticky; top: var(--topbar-h); background: rgba(255, 255, 255, 0.96); z-index: 5; }
.doc-title { border: 0; font-weight: 700; font-size: 16px; padding: 6px 8px; border-radius: 8px; min-width: 90px; flex: 1 1 140px; background: transparent; text-overflow: ellipsis; }
.writer-top > * { flex-shrink: 0; }
.writer-top > .doc-title { flex-shrink: 1; }
@media (max-width: 1360px) { .writer-top .lbl { display: none; } }
.doc-title:hover { background: var(--line-2); }
.doc-title:focus { outline: none; background: var(--line-2); }
.writer-page { max-width: 820px; width: 100%; margin: 0 auto; padding: 28px 24px 120px; flex: 1; }
.writer-page .hl-backdrop, .writer-page .hl-input { padding: 6px 4px; font-size: 18.5px; line-height: 1.75; }
.writer-page .hl-input { min-height: 60vh; }
.writer-side { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.writer-side .tabs { background: var(--surface); padding: 0 8px; }
.side-scroll { flex: 1; overflow-y: auto; }
.assist-bar { position: sticky; bottom: 16px; margin: 0 auto; max-width: 760px; width: calc(100% - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2); padding: 8px; display: flex; gap: 8px; align-items: center; z-index: 6; }
.assist-bar input { flex: 1; border: 0; padding: 8px 10px; min-width: 0; }
.assist-bar input:focus { outline: none; }
.assist-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 2px 8px; max-width: 760px; margin: 0 auto; width: calc(100% - 32px); position: sticky; bottom: 76px; z-index: 6; }
.assist-chips .chip { white-space: nowrap; }
.doc-list { display: grid; gap: 6px; }
.doc-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.doc-item:hover { border-color: var(--navy-200); }
.doc-item.is-current { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy) inset; }
.doc-item b { display: block; font-size: 14px; }
.doc-item small { color: var(--muted); font-size: 12px; }
.goal-grid { display: grid; gap: 14px; }
.goal-grid .seg { flex-wrap: wrap; border-radius: 14px; }
.ai-preview { border: 1px solid var(--navy-200); background: var(--navy-50); border-radius: 14px; padding: 12px 14px; font-family: var(--font-doc); font-size: 16px; line-height: 1.6; white-space: pre-wrap; }

/* ---------- Chat ---------- */
.chat { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h) - 72px); }
.chat-log { flex: 1; display: grid; gap: 18px; align-content: start; padding: 8px 0 24px; }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.msg-av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); font-weight: 800; font-size: 13px; }
.msg-user .msg-av { background: var(--line-2); color: var(--ink-2); }
.msg-body { min-width: 0; line-height: 1.65; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 0 0 1em; padding-left: 22px; }
.msg-body code { background: var(--line-2); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }
.msg-tools { display: flex; gap: 4px; margin-top: 6px; }
.composer { position: sticky; bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; border: 0; resize: none; padding: 8px 10px; max-height: 220px; min-height: 44px; line-height: 1.5; }
.composer textarea:focus { outline: none; }
.starter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
.starter { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; text-align: left; cursor: pointer; display: grid; gap: 4px; }
.starter:hover { border-color: var(--navy-200); background: var(--navy-50); }
.starter b { font-size: 14px; }
.starter span { font-size: 13px; color: var(--muted); }

/* ---------- Citation list ---------- */
.cite-entry { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cite-entry:last-child { border-bottom: 0; }
.cite-text { font-family: var(--font-doc); font-size: 16px; line-height: 1.6; padding-left: 2em; text-indent: -2em; word-break: break-word; }
.cite-intext { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cite-actions { display: flex; gap: 2px; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Home ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hero { position: relative; overflow: hidden; background: radial-gradient(1100px 520px at 85% -10%, rgba(31, 111, 235, 0.1), transparent 60%), radial-gradient(800px 420px at -10% 10%, rgba(1, 140, 11, 0.07), transparent 60%), linear-gradient(180deg, #f7f9ff 0%, #fff 100%); border-bottom: 1px solid var(--line-2); }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 80px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--navy); background: var(--navy-50); border: 1px solid var(--navy-100); padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.04; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--navy), #3b6fe0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { font-size: 19px; color: var(--ink-2); max-width: 560px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 26px; color: var(--muted); font-size: 14px; }
.hero-points span { display: inline-flex; align-items: center; gap: 7px; }
.hero-points .ico { color: var(--ok); width: 18px; height: 18px; }
.demo { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-3); overflow: hidden; }
.demo-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.demo-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.demo-tabs { display: flex; gap: 6px; margin-left: auto; }
.demo-tabs span { padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.demo-tabs span.on { background: var(--navy-50); color: var(--navy); }
.demo-body { display: grid; grid-template-columns: 1fr 210px; min-height: 300px; }
.demo-text { padding: 22px 22px 26px; font-family: var(--font-doc); font-size: 18px; line-height: 1.75; }
.demo-text .dm { border-bottom: 2px solid transparent; transition: border-color 0.4s, background 0.4s, color 0.4s; border-radius: 2px; }
.demo-text .dm.on { border-bottom-color: var(--cat); }
.demo-text .dm.fixing { background: color-mix(in srgb, var(--cat) 14%, transparent); }
.demo-text .dm.fixed { border-bottom-color: transparent; color: #075e3e; background: rgba(11, 138, 90, 0.08); }
.demo-side { border-left: 1px solid var(--line-2); background: var(--bg); padding: 14px; display: grid; gap: 8px; align-content: start; }
.demo-card { background: var(--surface); border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--cat); padding: 8px 10px; font-size: 12.5px; opacity: 0; transform: translateY(6px); transition: opacity 0.35s, transform 0.35s; }
.demo-card.show { opacity: 1; transform: none; }
.demo-card.done { opacity: 0.45; }
.demo-card b { display: block; font-size: 12px; color: var(--muted); }
.demo-score { display: flex; align-items: center; gap: 10px; padding: 4px 2px 8px; font-size: 12.5px; color: var(--muted); }
.demo-score .ring { width: 46px; height: 46px; }
.demo-score .ring::before { width: 36px; height: 36px; }
.demo-score .ring b { font-size: 14px; }
.cat-correctness { --cat: var(--c-correctness); }
.cat-clarity { --cat: var(--c-clarity); }
.cat-engagement { --cat: var(--c-engagement); }
.cat-delivery { --cat: var(--c-delivery); }

.section { padding: 84px 0; }
.section-alt { background: var(--bg); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.section-head { max-width: 720px; margin: 0 auto 40px; text-align: center; }
.section-head h2 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.025em; }
.section-head p { color: var(--muted); font-size: 17px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool-tile { display: grid; gap: 8px; padding: 20px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.tool-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--navy-200); color: var(--ink); }
.tool-tile .menu-ico { width: 44px; height: 44px; border-radius: 12px; }
.tool-tile:hover .menu-ico { background: var(--navy); color: #fff; }
.tool-tile b { font-size: 16px; }
.tool-tile span { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.feature + .feature { margin-top: 88px; }
.feature.flip .feature-copy { order: 2; }
.feature-copy h3 { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -0.02em; }
.feature-copy p { color: var(--ink-2); font-size: 16.5px; }
.ticks { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks .ico { color: var(--ok); margin-top: 2px; }
.mock { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-2); padding: 18px; }
.mock-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.mock-modes span { padding: 4px 11px; border-radius: 999px; background: var(--line-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mock-modes span.on { background: var(--navy); color: #fff; }
.mock-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-family: var(--font-doc); font-size: 15.5px; line-height: 1.6; }
.mock-cols > div { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.mock-cols .chg { color: #b54708; font-weight: 600; }
.mock-detect { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.step { padding: 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 800; margin-bottom: 14px; }
.step h3 { font-size: 17px; }
.step p { color: var(--muted); margin: 0; font-size: 14.5px; }
.privacy-band { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 28px 32px; border-radius: 22px; background: linear-gradient(120deg, var(--navy-700), var(--navy)); color: #fff; }
.privacy-band h3 { color: #fff; margin: 0 0 4px; font-size: 22px; }
.privacy-band p { margin: 0; color: #d6e0f7; }
.privacy-band .ico { width: 44px; height: 44px; color: #fff; }
.privacy-band .btn { background: #fff; color: var(--navy); }
.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 18px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 22px; line-height: 1; color: var(--navy); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); margin: 0 0 16px; }
.cta-band { text-align: center; padding: 80px 0; }
.cta-band h2 { font-size: clamp(28px, 3.6vw, 44px); letter-spacing: -0.03em; }

/* ---------- Documents (about and policies) ---------- */
.doc { max-width: 820px; margin: 0 auto; padding: 56px 24px 80px; }
.doc h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -0.03em; }
.doc h2 { font-size: 22px; margin-top: 1.8em; }
.doc h3 { font-size: 17px; margin-top: 1.4em; color: var(--navy); }
.doc p, .doc li { color: var(--ink-2); font-size: 16px; }
.doc .updated { color: var(--muted); font-size: 14px; }
.doc table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14.5px; }
.doc th { background: var(--navy); color: #fff; text-align: left; padding: 8px 10px; }
.doc td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }

/* ---------- Footer ---------- */
.footer { background: #0b1736; color: #c5cee3; }
.footer-in { max-width: 1200px; margin: 0 auto; padding: 56px 24px 36px; display: grid; grid-template-columns: 1.5fr 1fr 1fr 0.8fr; gap: 36px; }
.footer h2 { color: #fff; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 14px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.footer a { color: #c5cee3; text-decoration: none; font-size: 14px; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer-brand p { font-size: 14px; margin-top: 14px; max-width: 380px; }
.footer-note { color: #93a1c2; font-size: 13px !important; }
.footer-legal { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-legal p { max-width: 1200px; margin: 0 auto; padding: 18px 24px; font-size: 12.5px; color: #93a1c2; }
.layout-tool .footer-in { padding-top: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .topnav > a:nth-of-type(n + 4) { display: none; }
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .writer { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 980px) {
  .topnav { display: none; }
  .burger { display: inline-flex; }
  .engine { display: none !important; }
  .hero-in, .feature { grid-template-columns: 1fr; gap: 36px; }
  .feature.flip .feature-copy { order: 0; }
  .result-grid { grid-template-columns: 1fr; }
  .footer-in { grid-template-columns: 1fr 1fr; }
  .writer { grid-template-columns: 1fr; }
  .writer-side { position: static; height: auto; max-height: none; border-top: 1px solid var(--line); }
  .steps { grid-template-columns: 1fr; }
  .privacy-band { grid-template-columns: 1fr; text-align: left; }
}
@media (max-width: 860px) {
  .layout-tool .page { grid-template-columns: 1fr; }
  .rail { position: sticky; top: var(--topbar-h); z-index: 20; height: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; gap: 2px; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail-link { min-width: 68px; padding: 6px 4px; }
  .rail-sep { width: 1px; height: auto; margin: 6px 4px; }
  .panes { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .menu-grid { grid-template-columns: 1fr; }
  .writer-top { top: calc(var(--topbar-h) + 62px); }
}
@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  body { font-size: 15px; }
  .topbar-in { padding: 0 16px; gap: 12px; }
  .topbar-cta { display: none; }
  .brand-logo { height: 34px; }
  .layout-tool .main { padding: 16px 16px 40px; }
  .wrap { padding: 0 16px; }
  .hero-in { padding-top: 44px; padding-bottom: 52px; }
  .hero-lead { font-size: 17px; }
  .demo-body { grid-template-columns: 1fr; }
  .demo-side { border-left: 0; border-top: 1px solid var(--line-2); grid-template-columns: 1fr 1fr; }
  .demo-score { grid-column: 1 / -1; }
  .section { padding: 60px 0; }
  .tool-grid { grid-template-columns: 1fr; }
  .mock-cols { grid-template-columns: 1fr; }
  .footer-in { grid-template-columns: 1fr; gap: 28px; }
  .cat-filter { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .starter-grid { grid-template-columns: 1fr; }
  .plain-area, .output, .hl-backdrop, .hl-input { font-size: 16px; padding: 14px 16px; }
  .hl-input, .plain-area, .output { min-height: 260px; }
  .panes { min-height: 0; }
  .tool-head h1 { font-size: 22px; }
  .writer-page { padding: 18px 16px 120px; }
  .writer-page .hl-backdrop, .writer-page .hl-input { font-size: 17px; }
  .slider-wrap input { width: 90px; }
}
