/* Portal styles (dashboard, results, admin). */
:root {
  --brand: #1d4ed8;
  --brand-ink: #fff;
  --bg: #f4f6fb;
  --card: #fff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2, .h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 13px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 6px; background: #fff; padding: 8px 12px; z-index: 2000; border-radius: 6px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.container { max-width: 1160px; margin: 0 auto; padding: 22px 18px 40px; }
.container.wide { max-width: 1400px; }
.container.narrow { max-width: 640px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #cbd5e1; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* top nav */
.topnav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topnav-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 8px 18px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.08rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; letter-spacing: .5px; }
.mainnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.mainnav a { padding: 7px 12px; border-radius: 8px; color: #334155; text-decoration: none; font-weight: 600; font-size: .94rem; white-space: nowrap; }
.mainnav a:hover { background: #f1f5f9; }
.mainnav a.active { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
.navright { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.usermenu { position: relative; }
.usermenu-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.usermenu-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.usermenu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 60; }
.usermenu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-head small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.usermenu-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
.usermenu-pop button:hover { background: #f1f5f9; }
.sitefoot { border-top: 1px solid var(--line); background: #fff; }
.sitefoot-inner { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 18px; color: var(--muted); font-size: .86rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f8fafc; border-color: #94a3b8; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); border-color: transparent; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: .84rem; border-radius: 6px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.55rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .84rem; }
.stat.big b { font-size: 2rem; }
.stat.good b { color: var(--ok); }
.stat.bad b { color: var(--bad); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: #eef2f7; color: #334155; white-space: nowrap; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.blue { background: #dbeafe; color: #1e40af; }
.pill.purple { background: #ede9fe; color: #5b21b6; }
.callout { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.callout.success { border-color: #bbf7d0; background: #f0fdf4; }
.callout.danger { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.callout.warn { border-color: #fde68a; background: #fffbeb; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; color: #334155; }
label.check, .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, #fff); border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
textarea.code { font: 13px/1.5 ui-monospace, Consolas, monospace; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); }
input[type=color] { width: 60px; height: 36px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 8px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; }
legend { font-weight: 700; padding: 0 4px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.form-error { color: var(--bad); background: #fef2f2; border: 1px solid #fecaca; padding: 8px 10px; border-radius: 8px; font-size: .9rem; }
.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-fields > label { flex: 1 1 140px; }

/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { background: #f8fafc; font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; color: #475569; white-space: nowrap; }
.table tbody tr:hover { background: #fafcff; }
.table.compact th, .table.compact td { padding: 5px 8px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; text-align: right; }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px 14px; z-index: 1500; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; max-height: 88vh; }
.modal-wide { max-width: 1000px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.12rem; }
.modal-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #f8fafc; border-radius: 0 0 12px 12px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; max-width: min(420px, 92vw); }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .92rem; transition: opacity .3s, transform .3s; }
.toast-success { background: #166534; }
.toast-error { background: #b91c1c; }
.toast-warn { background: #b45309; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* landing */
.landing { padding: 0; }
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #000) 0%, var(--brand) 55%, color-mix(in srgb, var(--brand) 65%, #22d3ee) 100%); color: #fff; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.hero h1 { font-size: 2.6rem; margin-bottom: 10px; }
.hero .lead { font-size: 1.15rem; opacity: .95; max-width: 520px; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: .8rem; font-weight: 700; opacity: .85; margin-bottom: 8px; }
.hero-cta { display: flex; gap: 10px; margin: 20px 0 10px; flex-wrap: wrap; }
.hero .btn { border-color: rgba(255, 255, 255, .6); }
.hero .btn-primary { background: #fff; color: var(--brand); }
.hero .muted { color: rgba(255, 255, 255, .8); }
.hero-shot { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); color: var(--ink); }
.shot-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #1e3a6e; color: #fff; font-size: .8rem; }
.shot-bar span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.shot-bar b { margin-left: auto; }
.shot-body { display: grid; grid-template-columns: 1fr 150px; min-height: 210px; }
.shot-q { padding: 14px; display: flex; flex-direction: column; gap: 7px; }
.shot-q i { display: block; height: 9px; background: #e2e8f0; border-radius: 4px; }
.shot-q i.short { width: 60%; }
.shot-opt { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: #475569; padding: 4px 6px; border-radius: 4px; }
.shot-opt em { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #94a3b8; }
.shot-opt.sel { background: #e8f0ff; }
.shot-opt.sel em { border-color: #1d6fd6; background: radial-gradient(#1d6fd6 40%, transparent 45%); }
.shot-pal { background: #e8f1fb; padding: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; align-content: start; }
.shot-pal span { font-size: .66rem; font-weight: 700; text-align: center; padding: 4px 0; border-radius: 3px; background: #eceff3; }
.shot-pal .p1 { background: #e4572e; color: #fff; }
.shot-pal .p2 { background: #3ea33e; color: #fff; }
.shot-pal .p3, .shot-pal .p4 { background: #6c3fb5; color: #fff; border-radius: 50%; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.series-card ul.plain { list-style: none; padding: 0; margin: 0 0 14px; }
.series-card ul.plain li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }

/* auth */
.auth-wrap { padding-top: 40px; }
.auth-card { max-width: 440px; margin: 0 auto; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.auth-tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* dashboard */
.welcome { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.welcome h1 { margin: 0; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.test-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.test-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, #fff); }
.test-card h3 { margin: 0; font-size: 1.02rem; }
.test-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.test-meta b { color: var(--ink); }
.test-card .row { margin-top: auto; }
.test-card .best { font-size: .85rem; }
.series-block { margin-bottom: 26px; }
.series-block > .row { margin-bottom: 10px; }
.series-block h2 { margin: 0; }
.resume-list { display: flex; flex-direction: column; gap: 8px; }
.resume-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; flex-wrap: wrap; }
.side-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }

/* builder */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; }
.tpl:hover { border-color: var(--brand); }
.tpl.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, #fff); }
.tpl b { font-size: .95rem; }
.tpl small { color: var(--muted); }
.sec-table input, .sec-table select { padding: 5px 7px; font-size: .88rem; }
.sec-table td { vertical-align: middle; }
.sec-table .w-num { width: 82px; }
.sec-table .w-name { min-width: 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2f7; border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .8rem; font-weight: 600; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; }
.chip.add { padding: 0; }
.chip.add select { border: 0; background: transparent; font-size: .8rem; padding: 2px 6px; width: auto; }
.avail { font-size: .78rem; }
.avail.short { color: var(--bad); font-weight: 700; }

/* result */
.res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.res-head h1 { margin: 0 0 4px; }
.score-hero { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
.score-ring { width: 200px; height: 200px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .lbl b { font-size: 2.1rem; line-height: 1; }
.score-ring .lbl span { color: var(--muted); font-size: .85rem; }
.res-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.res-tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.res-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.bar { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.good i { background: var(--ok); }
.bar.bad i { background: var(--bad); }
.bar.mid i { background: var(--warn); }
.sol-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.sol-filters button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
.sol-filters button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.sol { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: #fff; overflow: hidden; }
.sol-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: .86rem; }
.sol-body { padding: 12px 16px; }
.sol-body p { margin: 0 0 .6em; }
.sol-body table, .qprev table { border-collapse: collapse; margin: 6px 0; }
.sol-body td, .sol-body th, .qprev td, .qprev th { border: 1px solid #cbd5e1; padding: 3px 8px; }
.sol-opts { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 5px; }
.sol-opts li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; }
.sol-opts li .k { font-weight: 700; color: var(--muted); min-width: 22px; }
.sol-opts li.right { border-color: #86efac; background: #f0fdf4; }
.sol-opts li.wrong { border-color: #fca5a5; background: #fef2f2; }
.sol-opts li .tag { margin-left: auto; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.sol-exp { background: #f8fafc; border-left: 3px solid var(--brand); padding: 8px 12px; margin-top: 8px; border-radius: 0 6px 6px 0; }
.sol details summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.passage-box { background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; max-height: 320px; overflow: auto; }
.desc-ans { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .95rem; max-height: 420px; overflow: auto; }
.lb-me { background: #eff6ff; }

/* charts */
.c-svg { width: 100%; height: auto; display: block; font-family: Arial, sans-serif; }
.c-grid { stroke: #e5e7eb; stroke-width: 1; }
.c-axisline { stroke: #64748b; stroke-width: 1.2; }
.c-tick { fill: #64748b; font-size: 11px; }
.c-lab { fill: #1f2937; font-size: 12px; }
.c-val { fill: #111827; font-size: 11px; font-weight: 700; }
.c-val.c-in { fill: #fff; }
.c-leg { fill: #1f2937; font-size: 12px; }
.c-axis { fill: #475569; font-size: 12px; font-weight: 700; }
.c-title { font-weight: 700; text-align: center; margin-bottom: 4px; font-size: .95rem; }
.c-title span { font-weight: 400; color: #64748b; }
.c-note { font-size: .85rem; color: #475569; margin-top: 4px; }
.c-tablewrap { overflow-x: auto; }
.c-table { border-collapse: collapse; margin: 6px auto; font-size: 14px; }
.c-table th, .c-table td { border: 1px solid #94a3b8; padding: 5px 12px; text-align: center; }
.c-table thead th { background: #eef2f7; }
.c-table tbody th { background: #f8fafc; text-align: left; }
.q-chart { margin: 10px 0; max-width: 720px; }

/* admin */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.admin-tabs a { padding: 9px 12px; border-radius: 8px; color: #334155; text-decoration: none; font-weight: 600; font-size: .93rem; }
.admin-tabs a:hover { background: #f1f5f9; }
.admin-tabs a.active { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.toolbar > label { flex: 0 1 170px; }
.toolbar > label.grow { flex: 1 1 220px; }
.qtext { max-width: 560px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; margin-bottom: 10px; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.method { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; }
.method:hover { border-color: var(--brand); }
.method.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, #fff); }
.method b { font-size: 1rem; }
.method small { color: var(--muted); }
.review-item { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.review-item.err { border-color: #fca5a5; }
.review-item.warn { border-color: #fcd34d; }
.review-item .ri-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #f8fafc; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: .85rem; }
.review-item .ri-head select, .review-item .ri-head input { width: auto; padding: 3px 6px; font-size: .84rem; }
.review-item .ri-body { padding: 10px 14px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
.review-item .ri-issues { color: #b91c1c; font-size: .82rem; font-weight: 600; }
.ri-opts { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ri-opts li { display: flex; gap: 6px; align-items: flex-start; font-size: .9rem; padding: 3px 6px; border-radius: 5px; cursor: pointer; }
.ri-opts li.right { background: #dcfce7; font-weight: 600; }
.ri-opts li .k { font-weight: 700; color: var(--muted); min-width: 20px; }
.qprev { font-size: .95rem; }
.qprev p { margin: 0 0 .5em; }
.qprev img { max-height: 260px; }
.drop { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 26px; text-align: center; background: #fafcff; cursor: pointer; }
.drop.over { border-color: var(--brand); background: #eff6ff; }
.pdf-viewer { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; }
.pdf-canvas-wrap { position: relative; overflow: auto; max-height: 68vh; border: 1px solid var(--line); background: #f1f5f9; user-select: none; }
.pdf-canvas-wrap canvas { display: block; margin: 0 auto; cursor: crosshair; }
.pdf-sel { position: absolute; border: 2px solid var(--brand); background: rgba(29, 78, 216, .12); pointer-events: none; }
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.editor-toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: .8rem; font-weight: 600; }
.editor-toolbar button:hover { background: #f1f5f9; }
.opt-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 6px; align-items: start; }
.opt-row .k { font-weight: 700; padding-top: 8px; text-align: center; }
.opt-row textarea { min-height: 40px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.steps span { font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef2f7; color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; }
.prompt-box { position: relative; }
.prompt-box textarea { min-height: 260px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.install-body .install { padding-top: 30px; }

@media (max-width: 960px) {
  .admin { grid-template-columns: 1fr; }
  .admin-tabs { position: static; flex-direction: row; overflow-x: auto; }
  .side-grid, .hero-inner, .score-hero, .pdf-viewer { grid-template-columns: 1fr; }
  .review-item .ri-body { grid-template-columns: 1fr; }
  .hero-shot { display: none; }
}
@media (max-width: 680px) {
  .grid2, .grid3, .grid4, .features { grid-template-columns: 1fr; }
  .usermenu-name { display: none; }
  .hero h1 { font-size: 2rem; }
  .container { padding: 16px 12px 30px; }
}
@media print {
  .topnav, .sitefoot, .res-tabs, .no-print, #toasts { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
