/* ApplyForge web app — system fonts, light/dark tokens, responsive to phone width. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16181d;
  --muted: #5f6672;
  --border: #e1e4ea;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefe;
  --ok: #18794e;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #c0392b;
  --bad-soft: #fbe7e5;
  --info: #2f5bea;
  --info-soft: #e8eefe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1e222a;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2a2f39;
    --accent: #6d8dff;
    --accent-ink: #0b0d12;
    --accent-soft: #1d2640;
    --ok: #4cc38a;
    --ok-soft: #12291e;
    --warn: #f0b350;
    --warn-soft: #2e2412;
    --bad: #ff7b6e;
    --bad-soft: #321a18;
    --info: #6d8dff;
    --info-soft: #1d2640;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 0 0 .25rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-size: .85rem; }
.warn-text { color: var(--warn); }
.error-text, .danger-text { color: var(--bad) !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------------------------------------- shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 800; }
.brand-lg { font-size: 1.4rem; margin-bottom: .25rem; }
.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.nav-link { padding: .4rem .75rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.view { max-width: 1440px; margin: 0 auto; padding: 1.5rem; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.head-actions, .row-end, .toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; margin-top: .5rem; }
.toolbar { margin: 1rem 0 .75rem; }
.back { display: inline-block; font-size: .9rem; margin-bottom: .25rem; }
.eyebrow { text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; color: var(--muted); margin: 0; font-weight: 600; }

/* ----------------------------------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .35rem .7rem; font-size: .88rem; }
.btn-xs { padding: .2rem .5rem; font-size: .8rem; border-radius: 6px; }
.btn-block { width: 100%; }
.input { width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
textarea.input { resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input-inline { width: auto; }
.input-search { max-width: 320px; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.field > span { font-weight: 500; }
.field .input { color: var(--text); font-size: .95rem; }
.field-wide { grid-column: 1 / -1; }
.check { display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; }
.form-error { color: var(--bad); min-height: 1.2em; font-size: .9rem; }
.pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-info { background: var(--info-soft); color: var(--info); }
.chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--surface-2); font-size: .78rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-on { background: var(--ok-soft); color: var(--ok); }
.chip-src { cursor: help; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
details.card > summary, details > summary { cursor: pointer; font-weight: 500; }
details.card[open] > summary { margin-bottom: .75rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.callout { padding: .75rem 1rem; border-radius: var(--radius); background: var(--warn-soft); color: var(--text); border: 1px solid var(--border); font-size: .92rem; margin-bottom: .9rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty .btn { margin-top: .75rem; }
.loading { display: flex; align-items: center; gap: .6rem; padding: 2rem; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.plain-list { margin: .25rem 0; padding-left: 1.1rem; }
.quote { padding: .6rem .8rem; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 6px; }
.quote-new { border-left-color: var(--accent); }
.md h3 { margin-top: .9rem; }
.md h4 { margin: .7rem 0 .3rem; font-size: .95rem; }
.md ul { padding-left: 1.2rem; margin: .3rem 0 .6rem; }
.md code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 0 .25rem; border-radius: 4px; }

/* ----------------------------------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; box-shadow: var(--shadow); }

/* ----------------------------------------------------------------------------------------- dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-weight: 600; }
.stat-hint { color: var(--muted); font-size: .8rem; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.cell-title { font-weight: 600; }
.actions { white-space: nowrap; }
.actions .btn { margin-left: .3rem; }

/* ----------------------------------------------------------------------------------------- editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.editor-pane { min-width: 0; }
.editor[data-layout="wide"] { grid-template-columns: minmax(300px, 2.7fr) minmax(0, 7.3fr); }
.editor[data-layout="preview"] { grid-template-columns: 44px minmax(0, 1fr); }
.editor[data-layout="preview"] .editor-pane { display: none; }
.view.view-wide { max-width: none; }
.tabs-row { display: flex; align-items: flex-end; gap: .4rem; }
.tabs-row .tabs { flex: 1; min-width: 0; }
.collapse-editor { flex: none; margin-bottom: .9rem; }
.editor-rail { display: none; }
.editor[data-layout="preview"] .editor-rail { position: sticky; top: 72px; display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 44px; height: calc(100vh - 150px); padding: .7rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); font: inherit; cursor: pointer; }
.editor-rail:hover, .editor-rail:focus-visible { color: var(--accent); border-color: var(--accent); }
.rail-arrow { font-size: 1.3rem; line-height: 1; }
.rail-label { writing-mode: vertical-rl; font-weight: 600; letter-spacing: .04em; }
.layout-seg button { font-size: .82rem; }
.tabs { display: flex; gap: .2rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: .9rem; }
.tabs button { background: none; border: none; padding: .55rem .8rem; font: inherit; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-body { padding-bottom: 5rem; }
.bullets { display: flex; flex-direction: column; gap: .6rem; margin-top: .8rem; }
.bullet .input { font-size: .95rem; }
.bullet-bar, .fact-bar { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
.source-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.grid-skill { display: grid; grid-template-columns: 180px 1fr auto; gap: .5rem; align-items: start; }
.keywords { margin-bottom: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem; }
.keywords .chips { margin: .5rem 0; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); z-index: 5; flex-wrap: wrap; }
.preview-pane { position: sticky; top: 72px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.preview-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
.pdf-frame { display: block; width: 100%; height: calc(100vh - 150px); border: 0; background: #525659; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: .3rem .7rem; border-radius: 6px; font: inherit; font-size: .88rem; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.jd { white-space: pre-wrap; font: .88rem/1.5 var(--font); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; max-height: 60vh; overflow: auto; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: .3rem; display: flex; flex-direction: column; }
.menu-item { padding: .45rem .7rem; border-radius: 6px; color: var(--text); }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }

/* ----------------------------------------------------------------------------------------- master profile */
.profile-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.entry-list { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; display: flex; flex-direction: column; gap: 1rem; padding-right: .25rem; }
.entry-group h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.entry-link { display: flex; flex-direction: column; padding: .45rem .6rem; border-radius: 8px; color: var(--text); }
.entry-link:hover { background: var(--surface-2); text-decoration: none; }
.entry-link.active { background: var(--accent-soft); }
.entry-link.dim { opacity: .65; }
.entry-link-title { font-weight: 500; line-height: 1.3; }
.conflict-banner { display: flex; align-items: center; gap: .4rem; padding: .6rem .7rem; border-radius: 8px; background: var(--warn-soft); color: var(--text); font-size: .88rem; }
.entry-detail { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.entry-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.fact { padding: .6rem 0; border-top: 1px solid var(--border); }
.fact:first-of-type { border-top: none; }
.fact-text { margin: 0; }
.assistant-pane { position: sticky; top: 72px; }
.assistant { display: flex; flex-direction: column; height: calc(100vh - 100px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.assistant-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.assistant-head > div { flex: 1; min-width: 0; }
.assistant-head h3 { margin: 0; }
.assistant-close, .assistant-toggle { display: none; }
.chat-log { flex: 1; overflow: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.chat-empty p { margin-bottom: .5rem; }
.msg { max-width: 92%; padding: .55rem .8rem; border-radius: 12px; font-size: .92rem; }
.msg p:last-child { margin-bottom: 0; }
.msg-user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.proposal { margin-top: .6rem; padding: .6rem .7rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.proposal-head { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.proposal-applied { border-color: var(--ok); }
.proposal-dismissed { opacity: .6; }
.chat-input { border-top: 1px solid var(--border); padding: .7rem; }
.chat-input .row-end { justify-content: space-between; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; }
.conflict .chips { margin-top: .3rem; }

/* ----------------------------------------------------------------------------------------- sources */
.sources-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.dropzone { display: block; text-align: center; padding: .9rem; border: 1.5px dashed var(--border); border-radius: 8px; cursor: pointer; color: var(--accent); font-weight: 500; margin: .5rem 0; }
.dropzone:hover { background: var(--accent-soft); }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.file-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.build { box-shadow: none; }
.build-head { display: flex; gap: .5rem; align-items: center; }

/* ----------------------------------------------------------------------------------------- overlays */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 12, 18, .45); padding: 1rem; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 14px; padding: 1.3rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-body { margin: .75rem 0 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .7rem 1rem; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .5s, transform .5s; font-size: .92rem; }
.toast-ok { background: var(--ok); color: #fff; }
.toast-error { background: var(--bad); color: #fff; }
.toast-hide { opacity: 0; transform: translateY(8px); }

/* ----------------------------------------------------------------------------------------- tracker */
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.stat:hover { border-color: var(--accent); }
.stat-warn { border-color: var(--warn); background: var(--warn-soft); }
.stat-bad { border-color: var(--bad); }
.stat-bad .stat-value { color: var(--bad); }
.funnel { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }
.funnel button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .25rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; }
.funnel button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.tracker td { font-size: .92rem; }
.stage-select { padding: .3rem .5rem; font-size: .85rem; font-weight: 600; max-width: 9rem; }
.stars { color: var(--warn); font-size: .85rem; letter-spacing: -1px; }
.score-chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; max-width: 15rem; }
.decide { margin-top: .35rem; }
.row-open td { border-bottom-color: transparent; background: var(--surface-2); }
.drawer-row > td { background: var(--surface-2); padding-top: 0; }
.drawer { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; padding: .75rem 0 .5rem; }
.drawer h3 { margin-bottom: .6rem; }
.drawer-form { display: flex; flex-direction: column; gap: .7rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem .75rem; }
.event-add { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.event-add .input:not(.input-inline) { flex: 1; min-width: 12rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; max-height: 320px; overflow: auto; font-size: .88rem; }
.timeline li { display: flex; gap: .45rem; align-items: baseline; flex-wrap: wrap; }
.timeline-date { color: var(--muted); font-size: .8rem; min-width: 4.5rem; }

/* ----------------------------------------------------------------------------------------- evaluation */
.head-scores { display: inline-flex; border: 0; background: none; padding: 0; margin-top: .3rem; cursor: pointer; }
.head-scores .score-chips { max-width: none; }
.eval-bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.eval-bar p { margin: 0; }
.report h4 { font-size: .9rem; margin: .4rem 0 .3rem; }
.report-head { display: flex; gap: 1rem; align-items: center; }
.report-summary p { margin: 0 0 .2rem; }
.score-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; }
.score-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem; background: var(--surface); min-width: 120px; }
.score-tile.tone-ok { border-color: var(--ok); }
.score-tile.tone-info { border-color: var(--info); }
.score-tile.tone-warn { border-color: var(--warn); }
.score-tile.tone-bad { border-color: var(--bad); }
.score-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.score-value small { font-size: .8rem; font-weight: 500; opacity: .75; margin-left: .1rem; }
.score-label { font-weight: 600; font-size: .9rem; color: var(--text); }
.score-sub { font-size: .78rem; opacity: .85; }
.meters { display: flex; flex-direction: column; gap: .35rem; margin: .4rem 0; }
.meter { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr) 2.5rem 3rem; gap: .6rem; align-items: center; font-size: .85rem; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--muted); border-radius: 999px; }
.bar > i.tone-ok { background: var(--ok); }
.bar > i.tone-info { background: var(--info); }
.bar > i.tone-warn { background: var(--warn); }
.bar > i.tone-bad { background: var(--bad); }
.meter-value { font-weight: 600; text-align: right; }
.meter-weight { font-size: .78rem; }
.callout-bad { background: var(--bad-soft); }
.grade-head { display: flex; align-items: center; gap: .6rem; }
.grade-head h3 { margin: 0; flex: 1; }
.grade { font-size: 1.3rem; font-weight: 800; padding: .1rem .6rem; border-radius: 8px; }
.criteria { display: flex; flex-direction: column; gap: .5rem; }
.criterion-head { display: flex; justify-content: space-between; gap: .5rem; font-weight: 500; font-size: .9rem; }
.chip-off { background: var(--bad-soft); color: var(--bad); }
.checks { margin: .5rem 0; }
.table-compact td, .table-compact th { padding: .45rem .7rem; font-size: .86rem; }
.modal:has(.report) { max-width: 880px; }

/* ----------------------------------------------------------------------------------------- improve */
.btn-improve { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.btn-improve:hover { background: var(--accent-soft); filter: brightness(1.05); }
.conflict h3 { margin: 0 0 .2rem; }
.conflict-actions .field { min-width: 11rem; }

/* ----------------------------------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .profile-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .assistant-pane { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 40; padding: .5rem; transform: translateX(105%); transition: transform .2s; }
  .show-assistant .assistant-pane { transform: none; }
  .assistant { height: 100%; }
  .assistant-close, .assistant-toggle { display: inline-flex; }
}
@media (max-width: 900px) {
  .editor, .editor[data-layout] { grid-template-columns: 1fr; }
  .editor[data-layout="preview"] .editor-pane { display: block; }
  .editor[data-layout="preview"] .editor-rail, .layout-seg, .collapse-editor { display: none; }
  .preview-pane { position: static; }
  .pdf-frame { height: 75vh; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sources-grid { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .drawer { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-list { position: static; max-height: 40vh; border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; background: var(--surface); }
}
@media (max-width: 640px) {
  .view { padding: 1rem; }
  .topbar { padding: .5rem 1rem; gap: .75rem; flex-wrap: wrap; }
  .topbar .nav { order: 3; flex-basis: 100%; }
  h1 { font-size: 1.35rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-skill { grid-template-columns: 1fr auto; }
  .grid-skill > textarea { grid-column: 1 / -1; grid-row: 2; }
  .table thead { display: none; }
  .table tr { display: block; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
  .table td { display: block; border: 0; padding: .2rem 0; }
  .table td.right { text-align: left; padding-top: .5rem; }
  .actions .btn { margin: 0 .3rem .3rem 0; }
  .source-note { max-width: 100%; flex-basis: 100%; }
  .input-search { max-width: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .meter { grid-template-columns: minmax(0, 1fr) 2.2rem 2.6rem; }
  .meter .bar { grid-column: 1 / -1; grid-row: 2; }
  .report-head, .eval-bar { flex-direction: column; align-items: stretch; }
  .table tr.drawer-row { padding: 0 .8rem; }
}
