/* KAI design system */
:root {
  --bg: #f5f6fa; --bg2: #eef0f6; --panel: #ffffff; --ink: #121624; --ink2: #3b4256; --muted: #6c7389; --line: #e5e7ef; --line2: #d7dae5;
  --accent: #4f46e5; --accent2: #7c3aed; --accent-soft: #eef0ff;
  --good: #0f9d68; --good-soft: #e3f7ee; --warn: #d97706; --warn-soft: #fff4e0; --bad: #e11d48; --bad-soft: #ffe8ee;
  --r: 16px; --r-sm: 10px;
  --sh: 0 1px 2px rgba(18, 22, 36, .04), 0 4px 16px rgba(18, 22, 36, .05);
  --sh-lg: 0 10px 40px rgba(18, 22, 36, .14);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  font-family: var(--font);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d0f17; --bg2: #141724; --panel: #161a28; --ink: #eceef6; --ink2: #c5c9d8; --muted: #8b91a7; --line: #262b3d; --line2: #333950;
    --accent: #8b85ff; --accent2: #a78bfa; --accent-soft: #1f2140; --good: #34d399; --good-soft: #10291f; --warn: #fbbf24; --warn-soft: #2d2410;
    --bad: #fb7185; --bad-soft: #321520; --sh: none; --sh-lg: 0 10px 40px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { font-size: 15px; line-height: 1.5; font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 8px 14px; font-weight: 500; transition: border-color .15s, background .15s, transform .05s; display: inline-flex; align-items: center; gap: 6px; }
button:hover { border-color: var(--line2); } button:active { transform: scale(.98); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
.linkbtn { border: 0; background: none; padding: 4px 0; color: var(--accent); font-size: 13px; font-weight: 600; }
input, textarea, select { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.5; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .spacer { flex: 1; }
.hidden { display: none !important; }
.ico { flex: none; }
.goodt { color: var(--good); } .badt { color: var(--bad); } .warnt { color: var(--warn); }
h1, h2, h3 { letter-spacing: -.01em; }

/* ---------- header ---------- */
header.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.brand { border: 0; background: none; padding: 0; gap: 8px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 40%, transparent); }
.brand .word { font-weight: 800; letter-spacing: .06em; font-size: 15px; }
.asel { width: auto; max-width: 46vw; padding: 6px 10px; font-size: 13px; font-weight: 600; border-radius: 99px; background: var(--panel); }
.iconbtn { border: 1px solid var(--line); background: var(--panel); padding: 7px 10px; border-radius: 99px; font-size: 13px; }
@media (max-width: 420px) { .iconbtn .lbl { display: none; } .brand .word { display: none; } .asel { max-width: 58vw; } }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 10px; font-weight: 700; }
.card h3 { font-size: 12px; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cardhead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; } .cardhead h2 { margin: 0; } .cardhead .ico { color: var(--accent); }

/* ---------- chips ---------- */
.chip, .chip-btn { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--bg2); color: var(--ink2); white-space: nowrap; border: 1px solid transparent; }
.chip-btn { cursor: pointer; } .chip-btn:hover { border-color: currentColor; }
.chip.good, .chip-btn.good { background: var(--good-soft); color: var(--good); }
.chip.warn, .chip-btn.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad, .chip-btn.bad { background: var(--bad-soft); color: var(--bad); }
.chip.acc, .chip-btn.acc { background: var(--accent-soft); color: var(--accent); }
.markpill { font-weight: 800; font-size: 18px; min-width: 50px; text-align: right; }
.delta.up { color: var(--good); font-weight: 700; } .delta.down { color: var(--bad); font-weight: 700; }

/* ---------- login ---------- */
.login { max-width: 360px; margin: 16vh auto; text-align: center; padding: 28px; }
.login .logo { font-size: 30px; font-weight: 800; letter-spacing: .08em; }
.login .logo span { color: var(--accent); }
.login input { margin: 20px 0 10px; text-align: center; font-size: 16px; }
.login button { width: 100%; justify-content: center; padding: 11px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 6px; }

/* ---------- home ---------- */
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; } @media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.drop { border: 2px dashed var(--line2); border-radius: var(--r); padding: 26px 18px; text-align: center; transition: .15s; background: var(--bg); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.busy { opacity: .6; pointer-events: none; }
.drop strong { display: block; margin-bottom: 4px; font-size: 16px; }
.drop button { margin-top: 12px; }
.drafts { list-style: none; margin: 0; padding: 0; }
.drafts li { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.drafts li + li { border-top: 1px solid var(--line); }
.drafts li:hover { background: var(--bg); }
.drafts li.static { cursor: default; } .drafts li.static:hover { background: none; }
.trend svg { width: 100%; height: auto; display: block; }
.smalls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.smalls .sm { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg); }
.smalls .sm .t { font-size: 12px; color: var(--muted); line-height: 1.3; min-height: 32px; }
.smalls .sm .v { font-weight: 800; font-size: 16px; }
.heatwrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: 13px; }
table.heat th { font-weight: 600; font-size: 11px; color: var(--muted); }
table.heat .hname { white-space: nowrap; padding-right: 6px; font-size: 12px; font-weight: 500; }
table.heat .hcell { text-align: center; color: #fff; font-weight: 800; border-radius: 8px; padding: 7px 0; cursor: pointer; min-width: 40px; background: var(--line); transition: transform .1s; }
table.heat .hcell:hover { transform: scale(1.06); }
.upbar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; } .upbar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- submission hero ---------- */
.hero { position: relative; border-radius: 22px; padding: 14px 16px 16px; margin-bottom: 14px; color: #fff; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #6d5dfc 0%, #4f46e5 45%, #3b2fb8 100%); box-shadow: 0 12px 34px color-mix(in srgb, #4f46e5 35%, transparent); }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); pointer-events: none; }
.hero.plain { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--sh); }
.hero.plain .heroback, .hero.plain .hbtn { color: var(--ink2); background: var(--bg); }
.herotop { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; position: relative; z-index: 1; }
.heroback { border: 0; background: rgba(255,255,255,.14); color: #fff; padding: 5px 10px 5px 6px; border-radius: 99px; font-size: 13px; gap: 2px; }
.heroact { margin-left: auto; display: flex; gap: 6px; }
.hbtn { border: 0; background: rgba(255,255,255,.14); color: #fff; width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; }
.hbtn:hover, .heroback:hover { background: rgba(255,255,255,.24); }
.heromain { display: flex; gap: 14px; align-items: center; position: relative; z-index: 1; }
.heroring .ring { width: 100px; height: 100px; }
.heroring .ring circle:first-child { stroke: rgba(255,255,255,.2); }
.heroring .ring text { fill: #fff !important; }
.herotext h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.hero.plain h1 { margin: 6px 0 2px; }
.herosub { color: var(--muted); }
.herochips { display: flex; flex-wrap: wrap; gap: 6px; }
.hchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.16); color: #fff; border: 0; }
.hchip.btn { cursor: pointer; } .hchip.btn:hover { background: rgba(255,255,255,.26); }
.hchip.up { background: rgba(52, 211, 153, .25); } .hchip.down { background: rgba(251, 113, 133, .3); } .hchip.warn { background: rgba(251, 191, 36, .32); }
.herosum { margin: 12px 0 0; font-size: 14px; line-height: 1.5; opacity: .95; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; position: relative; z-index: 1; }
.herosum.open { -webkit-line-clamp: unset; }
.herocrit { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; position: relative; z-index: 1; }
.hc { min-width: 0; } .hcl { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcb { height: 5px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; margin: 3px 0; } .hcb i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.hcv { font-size: 12px; font-weight: 800; }
@media (max-width: 420px) { .herocrit { gap: 5px; } .hcl { font-size: 10px; } .heroring .ring { width: 86px; height: 86px; } .herotext h1 { font-size: 19px; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg2); border-radius: 14px; margin-bottom: 14px; position: sticky; top: 62px; z-index: 10; width: fit-content; }
.tabs button { border: 0; background: none; padding: 8px 14px; color: var(--muted); border-radius: 10px; font-weight: 600; }
.tabs button.on { background: var(--panel); color: var(--ink); box-shadow: var(--sh); }
.tabs .count, .tabbar .count { font-size: 11px; background: var(--bad); color: #fff; border-radius: 99px; padding: 0 6px; line-height: 17px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; padding: 6px 6px max(8px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; flex-direction: column; gap: 2px; border: 0; background: none; padding: 6px 0 2px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; border-radius: 10px; }
.tabbar button.on { color: var(--accent); }
.tabbar .count { position: absolute; top: 0; left: calc(50% + 6px); }
.subpage.hasbar { padding-bottom: 76px; }

.layout { display: grid; gap: 14px; grid-template-columns: 1fr; }
.layout > div, main { min-width: 0; }
@media (min-width: 1100px) { .layout.withchat { grid-template-columns: minmax(0, 1fr) 390px; } .layout.withchat .side { position: sticky; top: 124px; height: calc(100vh - 140px); display: flex; flex-direction: column; } }

/* ---------- report ---------- */
.ring { width: 120px; height: 120px; flex: none; } .ring text { font-weight: 800; fill: var(--ink); }
.donext .steps { list-style: none; padding: 0; margin: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.donext .steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.stepn { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.thesis { margin: 10px 0; padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; font-size: 15px; font-weight: 500; }
.flow { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.flowstep { flex: 0 0 160px; scroll-snap-align: start; border: 1px solid var(--line); border-top: 4px solid var(--line2); border-radius: 12px; padding: 9px; cursor: pointer; background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.flowstep.good { border-top-color: var(--good); } .flowstep.warn { border-top-color: var(--warn); } .flowstep.bad { border-top-color: var(--bad); }
.flowstep .fname { font-weight: 700; font-size: 12px; } .flowstep .fclaim { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.contra { margin-top: 8px; padding: 12px; background: var(--bad-soft); border-radius: 12px; color: var(--ink); }
.contra > .row strong { color: var(--bad); }
.contra-item { margin-top: 10px; font-size: 14px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--bad) 20%, transparent); } .contra-item .row { margin-bottom: 4px; }

.map { display: flex; flex-direction: column; gap: 8px; }
.secrow { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); scroll-margin-top: 130px; transition: box-shadow .2s, border-color .2s; position: relative; overflow: hidden; }
.secrow::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line2); }
.secrow.g-excellent::before, .secrow.g-good::before { background: var(--good); } .secrow.g-adequate::before { background: var(--warn); } .secrow.g-weak::before, .secrow.g-missing::before { background: var(--bad); }
.secrow.open { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 12%, transparent); }
.sechead { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; border: 0; border-radius: 0; padding: 12px 12px 12px 16px; background: none; }
.sechead:active { transform: none; background: var(--bg); }
.secmain { flex: 1; min-width: 0; }
.secname { display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 15px; }
.secname .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secprev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.secrow.open .secprev { display: none; }
.secmeta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.wmeter { width: 54px; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; display: inline-block; } .wmeter i { display: block; height: 100%; background: var(--accent); }
.wmeter.over i { background: var(--warn); }
.chev { color: var(--muted); transform: rotate(-90deg); transition: transform .2s; display: inline-flex; } .chev.up { transform: rotate(90deg); }
.secdetail { padding: 0 16px 16px 20px; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateY(-4px); } }
.verdict-line { margin: 4px 0 6px; font-size: 15px; font-weight: 500; }
.trendline { display: flex; gap: 10px; align-items: center; margin: 8px 0; } .trendline svg { width: 110px !important; }
.since { margin: 10px 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 14px; }
.marker { margin: 14px 0; padding: 14px 16px; background: linear-gradient(135deg, var(--accent-soft), transparent); border: 1px solid var(--line); border-radius: 12px; font-style: italic; font-size: 14.5px; color: var(--ink2); }
.marker .mlabel { display: block; font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
ul.tight { margin: 4px 0; padding-left: 20px; } ul.tight li { margin: 4px 0; }
ul.ask { list-style: none; padding-left: 0; } ul.ask li { padding: 8px 10px 8px 34px; background: var(--bg); border-radius: 10px; position: relative; font-size: 14px; }
ul.ask li::before { content: '?'; position: absolute; left: 10px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
ul.probs li { margin: 6px 0; }
.secactions { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; gap: 10px; padding: 8px 0; } .check + .check { border-top: 1px solid var(--line); }
.ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.ic.met { background: var(--good-soft); color: var(--good); } .ic.partial { background: var(--warn-soft); color: var(--warn); } .ic.missing { background: var(--bad-soft); color: var(--bad); }
.figcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 8px 0; background: var(--bg); }
.figchecks { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; } @media (min-width: 700px) { .figchecks { grid-template-columns: 1fr 1fr; } }
.fc { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; } .fc .ic { width: 18px; height: 18px; font-size: 10px; }
.crit { margin-bottom: 14px; } .crit .head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: visible; margin: 6px 0; position: relative; } .bar i { display: block; height: 100%; border-radius: 99px; }
.bar .prevmark { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); opacity: .5; border-radius: 2px; }
details.checklist summary { cursor: pointer; list-style: none; } details.checklist summary::-webkit-details-marker { display: none; }
details.checklist[open] summary { margin-bottom: 8px; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin-top: 4px; gap: 2px; } .stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; } .legend .lg { display: inline-flex; align-items: center; gap: 5px; } .legend .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- issues ---------- */
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.filters button { border-radius: 99px; white-space: nowrap; }
.filters button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.issue { border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px 18px; margin-bottom: 10px; background: var(--panel); position: relative; overflow: hidden; box-shadow: var(--sh); }
.issue::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line2); }
.issue.high::before { background: var(--bad); } .issue.medium::before { background: var(--warn); } .issue.low::before { background: var(--accent); }
.issue.st-fixed { opacity: .62; } .issue.st-fixed .problem { text-decoration: line-through; }
.issue .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.issue blockquote { margin: 6px 0 8px; padding: 8px 12px; border-left: 3px solid var(--line2); color: var(--ink2); font-style: italic; background: var(--bg); border-radius: 0 8px 8px 0; font-size: 14px; }
.issue .problem { font-weight: 600; margin: 4px 0; line-height: 1.45; }
.fix { margin: 8px 0; padding: 10px 12px; background: var(--good-soft); border-radius: 10px; font-size: 14px; } .fix b { color: var(--good); }
.issue .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.issue .actions button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.issue textarea { margin-top: 8px; font-size: 14px; min-height: 56px; }
.issue.flash { animation: flash 1.6s; } @keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--sh); } }
label.sim { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; margin-left: auto; cursor: pointer; padding: 4px 8px; border-radius: 99px; border: 1px dashed var(--line2); }
label.sim input { width: auto; margin: 0; accent-color: var(--good); } label.sim.on { color: var(--good); border-color: var(--good); background: var(--good-soft); font-weight: 700; }
.whatif { background: linear-gradient(160deg, var(--panel), var(--bg)); }
.wi { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.wi .big { font-size: 28px; font-weight: 800; line-height: 1.05; } .wi-proj { text-align: right; }
.wi-bar .track { position: relative; height: 12px; background: var(--line); border-radius: 99px; }
.wi-bar .base { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 99px 0 0 99px; }
.wi-bar .gain { position: absolute; top: 0; bottom: 0; border-radius: 0 99px 99px 0; transition: width .35s cubic-bezier(.2,.8,.2,1); background: repeating-linear-gradient(45deg, var(--good), var(--good) 6px, color-mix(in srgb, var(--good) 65%, white) 6px, color-mix(in srgb, var(--good) 65%, white) 12px); }
.wi-bar .tick { position: absolute; top: -3px; width: 1px; height: 18px; background: var(--muted); opacity: .45; }

/* ---------- document ---------- */
.dochead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg { display: inline-flex; padding: 3px; background: var(--bg2); border-radius: 12px; gap: 2px; }
.seg button { border: 0; border-radius: 9px; padding: 6px 12px; font-size: 13px; background: none; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--sh); }
.pdfwrap { position: relative; } .pdfwrap iframe { width: 100%; height: 78vh; border: 0; border-radius: 10px; background: #fff; }
.annwrap { margin-bottom: 16px; }
.annpage { position: relative; width: 100%; background: #fff; border-radius: 8px; overflow: visible; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.annpage img { width: 100%; height: 100%; display: block; border-radius: 8px; }
.hl { position: absolute; padding: 0; border: 0; border-radius: 2px; mix-blend-mode: multiply; cursor: pointer; }
.hl.high { background: rgba(225, 29, 72, .22); box-shadow: inset 0 -2px 0 #e11d48; } .hl.medium { background: rgba(217, 119, 6, .22); box-shadow: inset 0 -2px 0 #d97706; }
.hl.low { background: rgba(79, 70, 229, .16); box-shadow: inset 0 -2px 0 #4f46e5; } .hl.fixed { background: rgba(15, 157, 104, .12); box-shadow: inset 0 -2px 0 #0f9d68; }
.sectag { position: absolute; right: 4px; transform: translateY(-100%); font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 99px; border: 0; background: #eef0ff; color: #4f46e5; box-shadow: 0 1px 4px rgba(0,0,0,.12); opacity: .92; }
.sectag.good { background: #e3f7ee; color: #0f9d68; } .sectag.warn { background: #fff4e0; color: #b45309; } .sectag.bad { background: #ffe8ee; color: #e11d48; }
.annpop { position: absolute; left: 10px; right: 10px; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--sh-lg); }
.diff p { margin: 4px 0; }
.dblock { padding: 10px 12px; margin: 8px 0; border-radius: 10px; font-size: 14px; line-height: 1.6; }
.dblock.add { background: var(--good-soft); } .dblock.del { background: var(--bad-soft); text-decoration: line-through; opacity: .8; } .dblock.chg { background: var(--bg); border: 1px solid var(--line); }
.dtag { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; text-decoration: none; }
ins { background: var(--good-soft); color: var(--good); text-decoration: none; border-radius: 3px; padding: 0 2px; font-weight: 600; }
del { background: var(--bad-soft); color: var(--bad); border-radius: 3px; padding: 0 2px; }
details.same { margin: 4px 0; }
.secdeltas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; } .sd { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; text-align: left; }

/* ---------- tools ---------- */
.recheck { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); } .recheck ul { margin: 2px 0 6px; }
.reqchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.excard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 8px 0; }
.excard blockquote { margin: 4px 0; padding-left: 8px; border-left: 3px solid var(--line2); color: var(--muted); }
.viva { position: relative; } .vq { font-size: 16px; font-weight: 700; margin: 8px 0 10px; line-height: 1.4; }

/* ---------- processing ---------- */
.progress { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--bg); border-radius: 10px; padding: 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
.spinner.tiny { width: 11px; height: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }
.stepper { display: flex; gap: 2px; margin-bottom: 18px; }
.step { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--muted); position: relative; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 14px; left: calc(50% + 17px); right: calc(-50% + 17px); height: 2px; background: var(--line); }
.step.done:not(:last-child)::after { background: var(--good); }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 800; font-size: 13px; z-index: 1; }
.step.done .dot { background: var(--good); color: #fff; } .step.now .dot { background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); } .step.now .lbl { color: var(--ink); font-weight: 700; }
@media (max-width: 500px) { .step { font-size: 11px; } .step .dot { width: 26px; height: 26px; } .step:not(:last-child)::after { top: 12px; } }
.activity { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; }
.now-line { font-weight: 700; }
.pulse { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 20%, transparent); } }
.indet { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; } .indet i { display: block; height: 100%; width: 35%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; animation: indet 1.6s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.typing { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; } .typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; } @keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
.skel { height: 14px; border-radius: 7px; margin: 10px 0; background: linear-gradient(90deg, var(--line), var(--bg), var(--line)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skel.w60 { width: 60%; height: 20px; } .skel.w80 { width: 80%; } @keyframes shimmer { to { background-position: -200% 0; } }
details summary { cursor: pointer; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chatcard .chat { min-height: calc(100vh - 330px); }
.msgs { flex: 1; overflow-y: auto; padding: 4px 2px; }
.msg { margin: 10px 0; max-width: 90%; padding: 10px 13px; border-radius: 18px; font-size: 14.5px; overflow-wrap: anywhere; line-height: 1.5; }
.msg.user { margin-left: auto; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.assistant code { background: var(--panel); padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.msg.assistant h4 { margin: 10px 0 4px; font-size: 14.5px; }
.msg .ref { display: block; font-size: 11px; opacity: .85; margin-bottom: 2px; font-weight: 600; }
.msg .tool { font-size: 12px; color: var(--muted); font-style: italic; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; }
.quick button { white-space: nowrap; font-size: 13px; padding: 6px 12px; border-radius: 99px; background: var(--bg); }
.quick button.ctxq { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding-top: 6px; }
.composer textarea { min-height: 44px; max-height: 160px; border-radius: 22px; padding: 11px 16px; }
.composer button { border-radius: 22px; height: 44px; }
.ctxbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin-top: 8px; background: var(--accent-soft); border-radius: 12px; }

/* ---------- sheets / toast ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); backdrop-filter: blur(2px); z-index: 60; display: flex; justify-content: center; align-items: flex-end; animation: fade .15s; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--panel); width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); animation: up .22s cubic-bezier(.2,.8,.2,1); box-shadow: var(--sh-lg); }
@media (min-width: 700px) { .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.sheet h2 { margin-top: 0; } .sheet .close { float: right; }
.kv { margin: 8px 0; } .kv b { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.files li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 99; box-shadow: var(--sh-lg); }

/* ---------- print ---------- */
#print { display: none; }
@media print {
  body.printing > *:not(#print) { display: none !important; }
  body.printing #print { display: block; color: #000; background: #fff; font: 11pt/1.45 Georgia, serif; }
  #print h1 { font-size: 20pt; margin: 0; } #print h2 { font-size: 14pt; border-bottom: 1px solid #999; margin-top: 18pt; }
  #print h3 { font-size: 11.5pt; margin: 10pt 0 2pt; } #print .pmeta { color: #555; }
  #print .pbox { display: flex; gap: 16pt; align-items: center; border: 1px solid #999; padding: 10pt; border-radius: 6pt; } #print .pmark { font-size: 32pt; font-weight: 700; }
  #print table { border-collapse: collapse; width: 100%; } #print td, #print th { border: 1px solid #bbb; padding: 4pt; vertical-align: top; text-align: left; }
  #print .psec { break-inside: avoid; }
}
.hero.compact { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 16px; }
.hero.compact .cmid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.hero.compact .cmid strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.hero.compact .heroact { margin-left: 0; }
.secname .nm { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
@media (max-width: 420px) { .hero.compact .hbtn:not(:last-child) { display: none; } .hero.compact .heroback { padding: 5px 8px 5px 4px; font-size: 0; } .hero.compact .heroback .ico { width: 18px; height: 18px; } }
.hero.home .herotop { gap: 6px; }
.hero.home h1 { font-size: 21px; line-height: 1.2; }
.homeact { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.hbig { flex: 1; justify-content: center; border: 0; background: #fff; color: #3b2fb8; font-weight: 800; padding: 12px; border-radius: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.hbig:hover { background: #f3f2ff; }
.homeact .hbtn { width: 46px; height: 46px; border-radius: 14px; }
.drafts li .mini { flex: none; }
.heroring .ring circle:nth-of-type(2) { stroke: #fff; }
.issue .problem { font-weight: 500; font-size: 15px; color: var(--ink); }
.issue .meta strong { color: var(--ink); }

/* ---------- diagram studio ---------- */
.presets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; } .presets button { border-radius: 99px; white-space: nowrap; }
.dgallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dthumb { flex-direction: column; align-items: stretch; text-align: left; padding: 8px; border-radius: 12px; gap: 4px; }
.dthumb img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.dtt { font-weight: 700; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dws { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .dws { grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); align-items: start; } .dchat { position: sticky; top: 124px; height: calc(100vh - 140px); display: flex; flex-direction: column; } .dchat .chat { min-height: 0; } }
@media (max-width: 999px) { .dchat .chat { min-height: 60vh; } }
.dtitle { font-size: 15px; }
.vers { display: flex; gap: 4px; margin: 8px 0 4px; overflow-x: auto; }
.ver { padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.ver.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.vchange { font-size: 13px; padding: 8px 10px; background: var(--accent-soft); border-radius: 10px; margin: 6px 0; }
.dstage { position: relative; background: #fff; border-radius: 12px; border: 1px solid var(--line); margin-top: 8px; overflow: hidden; user-select: none; }
.dstage img { width: 100%; display: block; }
.dstage.pinning { cursor: crosshair; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.pin { position: absolute; transform: translate(-50%, -100%); background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; width: 22px; height: 22px; border-radius: 50% 50% 50% 0; rotate: -45deg; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); pointer-events: none; }
.pin { line-height: 1; } .pin::after { content: ''; }
.dsteps { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ddots { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.ddot { width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.ddot.past { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ddot.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.dcap { margin-top: 10px; } .dcap p { margin: 4px 0 0; font-size: 14px; }
.dtools { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.dtools button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
pre.tex { max-height: 320px; overflow: auto; background: #0f1220; color: #d8dcf0; font-size: 11.5px; padding: 12px; border-radius: 10px; white-space: pre; }
.skelcheck { margin-top: 10px; } .lblchk { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 14px; } .lblchk input { width: auto; accent-color: var(--good); }
.msg .vtag { margin-top: 6px; }
.cmpgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .cmpgrid { grid-template-columns: 1fr; } }
.cmpcol { margin: 0; min-width: 0; } .cmpcol figcaption { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.cmpcol .dstage { margin-top: 0; }
.cmpimg { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; } .cmpimg img { width: 100%; display: block; }
.cmpflip { position: relative; } .flipbtn { position: absolute; right: 10px; bottom: 10px; }

/* ---------- decluttered issues / folds ---------- */
.wibar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; background: var(--panel); box-shadow: var(--sh); }
.wibar .linkbtn { flex: none; }
.ifilters { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.catsel { width: auto; max-width: 48%; padding: 7px 10px; font-size: 13px; border-radius: 12px; margin-left: auto; }
.ilist { padding: 6px; }
.ilabel { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.irow { border-radius: 12px; transition: background .15s; }
.irow + .irow { border-top: 1px solid var(--line); }
.irow.open { background: var(--bg); border-top-color: transparent; }
.irow.open + .irow { border-top-color: transparent; }
.irowhead { width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; border: 0; background: none; padding: 11px 10px; border-radius: 12px; }
.irowhead:active { transform: none; }
.sev { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--line2); }
.sev.high { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); } .sev.medium { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); } .sev.low { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ititle { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.irow.open .ititle { -webkit-line-clamp: unset; }
.isub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.istake { flex: none; font-weight: 800; font-size: 13px; color: var(--good); background: var(--good-soft); border-radius: 99px; padding: 2px 8px; margin-top: 1px; }
.irow.st-fixed .ititle { color: var(--muted); text-decoration: line-through; }
.ibody { padding: 0 12px 12px 30px; }
.ibody .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ibody blockquote { margin: 6px 0 8px; padding: 8px 12px; border-left: 3px solid var(--line2); color: var(--ink2); font-style: italic; background: var(--panel); border-radius: 0 8px 8px 0; font-size: 14px; }
.ibody .problem { font-size: 14px; color: var(--ink2); margin: 4px 0; }
.ibody .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.ibody .actions button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ibody textarea { margin-top: 8px; font-size: 14px; min-height: 56px; }
details.more > summary { list-style: none; padding: 10px; font-size: 13px; font-weight: 700; color: var(--accent); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '+ '; } details.more[open] > summary::before { content: '− '; }
details.secmore { margin-top: 10px; border-top: 1px solid var(--line); } details.secmore > summary { padding: 10px 0; }
.folds { padding: 4px 6px; }
.fold + .fold { border-top: 1px solid var(--line); }
.foldhead { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 12px 10px; border-radius: 12px; }
.foldhead:active { transform: none; background: var(--bg); }
.foldt { flex: 1; display: flex; flex-direction: column; gap: 1px; } .foldt strong { font-size: 15px; }
.foldbody { padding: 0 10px 14px; animation: slide .2s ease-out; }
.secmeta .badt::before { content: '⚠ '; }
