:root {
  --bg: #f6f5f2; --panel: #ffffff; --panel2: #faf9f7; --ink: #1d1f23; --ink2: #555b66; --ink3: #8a909b;
  --line: #e4e2dd; --line2: #efede9; --accent: #d9661f; --accent-ink: #fff; --accent-soft: #fdf0e6;
  --good: #1f8a4c; --good-soft: #e5f4ea; --warn: #b7791f; --warn-soft: #fbf2df; --bad: #c2392b; --bad-soft: #fbe9e7;
  --info: #2563a8; --info-soft: #e7f0fa; --shadow: 0 1px 2px rgba(20,20,30,.05), 0 4px 16px rgba(20,20,30,.05);
  --r: 10px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --s1: #c2392b; --s2: #e07b39; --s3: #c9b037; --s4: #6aa84f; --s5: #1f8a4c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --panel: #1d2024; --panel2: #23272c; --ink: #e8e9eb; --ink2: #aab0ba; --ink3: #7b828d;
    --line: #2f343a; --line2: #282c31; --accent: #ef8a45; --accent-ink: #1a1206; --accent-soft: #3a2719;
    --good: #4cc27f; --good-soft: #1b3326; --warn: #e3ad55; --warn-soft: #3a2f1a; --bad: #ef6b5e; --bad-soft: #3b201d;
    --info: #6ea8e8; --info-soft: #1b2a3c; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --panel: #1d2024; --panel2: #23272c; --ink: #e8e9eb; --ink2: #aab0ba; --ink3: #7b828d;
  --line: #2f343a; --line2: #282c31; --accent: #ef8a45; --accent-ink: #1a1206; --accent-soft: #3a2719;
  --good: #4cc27f; --good-soft: #1b3326; --warn: #e3ad55; --warn-soft: #3a2f1a; --bad: #ef6b5e; --bad-soft: #3b201d;
  --info: #6ea8e8; --info-soft: #1b2a3c; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.boot { padding: 60px 20px; text-align: center; color: var(--ink3); }
.muted { color: var(--ink3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hide { display: none !important; }

/* каркас */
.top { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in { position: relative; max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; display: block; flex: none; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: 7px 11px; border-radius: 8px; color: var(--ink2); white-space: nowrap; font-size: 14px; }
.nav a:hover { background: var(--panel2); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 8px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; text-align: center; font-weight: 700; vertical-align: 1px; }
.icon-btn { position: relative; background: none; border: 1px solid transparent; color: var(--ink2); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--panel2); color: var(--ink); }
.icon-btn .badge { position: absolute; top: -3px; right: -4px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 8px; border: none; background: none; color: var(--ink); font: inherit; }
.user-chip:hover { background: var(--panel2); }
.ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--info-soft); color: var(--info); font-weight: 700; font-size: 12px; flex: none; }
.main { max-width: 1240px; margin: 0 auto; padding: 22px 16px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.menu { position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 240px; padding: 6px; z-index: 40; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--panel2); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 5px 0; }
.menu.notif { display: flex; flex-direction: column; width: min(420px, calc(100% - 24px)); min-width: 0; padding: 0; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.notif-head h2 { margin: 0; font-size: 16px; }
.notif-head .notif-close { width: auto; min-height: 44px; padding-inline: 12px; font-weight: 600; color: var(--info); }
.notif-list { display: grid; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.notif-list > p { margin: 4px 6px; }
.notif-list .notif-read { width: fit-content; color: var(--info); }
.notif-list .notif-item { overflow-wrap: anywhere; }
.notif-list .notif-item.unread { background: var(--accent-soft); }
.notif-item { padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.notif-item:hover { background: var(--panel2); }
.notif-item.unread { background: var(--accent-soft); }

/* элементы */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; }
.card + .card { margin-top: 14px; }
.layout-2 > div, .form-grid > .sticky { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.layout-2 > div > :empty, .form-grid > .sticky > :empty { display: none; }
.layout-2 > div > .card, .form-grid > .sticky > .card, .cols-2 > .card { margin-top: 0; }
.main > .cols-2 + .card, .main > .cols-2 + .btn { margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn:hover { background: var(--panel2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink2); }
.btn.ghost:hover { background: var(--panel2); color: var(--ink); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.f { display: block; margin-bottom: 14px; }
label.f > span.l { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
label.f > span.l .req { color: var(--accent); }
.hint { font-size: 13px; color: var(--ink3); margin: -2px 0 6px; }
.counter { font-size: 11px; color: var(--ink3); text-align: right; margin-top: 2px; }
.check { display: flex; gap: 9px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 12px; font-size: 12px; background: var(--panel2); color: var(--ink2); border: 1px solid var(--line2); white-space: nowrap; }
.chip.pick { cursor: pointer; padding: 6px 12px; font-size: 14px; }
.chip.pick.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.st { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-draft { background: var(--panel2); color: var(--ink3); }
.st-submitted { background: var(--warn-soft); color: var(--warn); }
.st-discussion, .st-expertise { background: var(--info-soft); color: var(--info); }
.st-rework { background: var(--warn-soft); color: var(--warn); }
.st-validation, .st-pilot { background: var(--accent-soft); color: var(--accent); }
.st-implemented { background: var(--good-soft); color: var(--good); }
.st-on_hold, .st-merged { background: var(--panel2); color: var(--ink2); }
.st-rejected { background: var(--bad-soft); color: var(--bad); }
.alert { padding: 11px 14px; border-radius: 8px; background: var(--info-soft); color: var(--ink); border-left: 3px solid var(--info); margin-bottom: 12px; font-size: 14px; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.alert.bad { background: var(--bad-soft); border-color: var(--bad); }
.alert.good { background: var(--good-soft); border-color: var(--good); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 9px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-size: 14px; }
.toast.err { background: var(--bad); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,15,.45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; padding: 22px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink3); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.t tr:hover td { background: var(--panel2); }
.tbl-wrap { overflow-x: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; font: inherit; color: var(--ink2); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* вход */
html:has(.auth) { scrollbar-gutter: stable; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-side { background: linear-gradient(150deg, #2a1d14 0%, #4a2a16 55%, #d9661f 140%); color: #fbeee3; padding: 56px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 34px; line-height: 1.15; color: #fff; margin: 26px 0 14px; }
.auth-side p { color: #f0d9c6; max-width: 460px; }
.auth-side ul { padding-left: 18px; color: #f0d9c6; max-width: 460px; }
.auth-side li { margin-bottom: 6px; }
.auth-form { display: grid; place-items: center; padding: 32px 18px; }
.auth-box { width: min(420px, 100%); }
.auth-box .tabs { margin-bottom: 20px; }
.auth-copy { display: grid; min-width: 0; }
.auth-copy > span { grid-area: 1 / 1; }
html:lang(ru) .auth-copy > [lang="en"],
html:lang(en) .auth-copy > [lang="ru"] { visibility: hidden; }

/* лента */
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=text] { flex: 1; min-width: 200px; }
.filters select { width: auto; min-width: 150px; }
.idea-card { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; cursor: pointer; transition: border-color .15s; }
.idea-card:hover { border-color: var(--accent); }
.idea-card h3 { font-size: 16px; margin: 4px 0 4px; }
.idea-card .meta { font-size: 13px; color: var(--ink3); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.idea-card .prob { color: var(--ink2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.score-pill { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; font-weight: 800; font-size: 18px; border: 3px solid var(--line); color: var(--ink3); background: var(--panel); }
.score-pill small { display: block; font-size: 9px; font-weight: 600; margin-top: -4px; letter-spacing: .04em; }
.score-pill.hi { border-color: var(--good); color: var(--good); }
.score-pill.mid { border-color: var(--warn); color: var(--warn); }
.score-pill.lo { border-color: var(--bad); color: var(--bad); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }

/* дашборд */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-size: 26px; line-height: 1.1; }
.kpi span { font-size: 13px; color: var(--ink3); }
.hero { background: linear-gradient(120deg, var(--accent-soft), var(--panel) 70%); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 16px; display: flex; gap: 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.hero h1 { font-size: 22px; }
.hero p { color: var(--ink2); max-width: 720px; margin: 6px 0 0; }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 190px 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-bar { height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
.list-mini a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line2); color: var(--ink); font-size: 14px; }
.list-mini a:last-child { border-bottom: 0; }
.list-mini a:hover { color: var(--accent); text-decoration: none; }

/* карточка идеи */
.idea-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.idea-head h1 { font-size: 26px; max-width: 820px; }
.field-block { margin-bottom: 16px; }
.field-block h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); font-weight: 700; }
.field-block .v { white-space: pre-wrap; word-wrap: break-word; }
.field-block .v.empty { color: var(--ink3); font-style: italic; }
.vote-row { display: flex; gap: 8px; flex-wrap: wrap; }
.side-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ''; position: absolute; left: 6.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* комментарии */
.cmt { padding: 12px 0; border-top: 1px solid var(--line2); }
.cmt .who { font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmt .body { margin: 6px 0 4px; white-space: pre-wrap; word-wrap: break-word; }
.cmt .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.cmt .replies { margin-left: 28px; border-left: 2px solid var(--line2); padding-left: 14px; }
.comment-composer { margin-top: 12px; }
.cmt { scroll-margin-block: 6rem; }
.reply-reference { display: block; max-width: 100%; background: none; color: var(--muted); font: inherit; font-size: .85em; text-align: start; border: 0; border-inline-start: 2px solid var(--line2); padding: 2px 8px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.reply-reference:hover { color: var(--ink); }
.cmt.resolved > .body { opacity: .7; }
.k-question { background: var(--info-soft); color: var(--info); }
.k-risk { background: var(--bad-soft); color: var(--bad); }
.k-data { background: var(--good-soft); color: var(--good); }
.k-contact { background: var(--accent-soft); color: var(--accent); }

/* ИИ-оценка */
.ai-top { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: center; }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 38px; line-height: 1; display: block; }
.ring .val span { font-size: 11px; color: var(--ink3); }
.subscores { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 10px; }
.subscores div b { font-size: 20px; display: block; }
.subscores div span { font-size: 12px; color: var(--ink3); }
.crit { display: grid; grid-template-columns: 250px 1fr 44px; gap: 12px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line2); }
.crit:last-child { border-bottom: 0; }
.bar5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-top: 6px; }
.bar5 i { height: 8px; border-radius: 2px; background: var(--line); }
.bar5 i.f { background: var(--accent); }
.conf-low { color: var(--warn); font-size: 12px; font-weight: 600; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
ul.tight { margin: 0; padding-left: 18px; }
ul.tight li { margin-bottom: 4px; }
.devil { border-left: 3px solid var(--bad); background: var(--bad-soft); padding: 14px 16px; border-radius: 8px; }
.progress { height: 8px; background: var(--line2); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.dots { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; margin-top: 12px; max-width: 420px; }
.dot { aspect-ratio: 1; border-radius: 50%; background: var(--line); transition: background .3s; }
.dot.s1 { background: var(--s1); } .dot.s2 { background: var(--s2); } .dot.s3 { background: var(--s3); } .dot.s4 { background: var(--s4); } .dot.s5 { background: var(--s5); }
.dot.nr { opacity: .35; }
.heat { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 13px; }
.heat td, .heat th { padding: 6px 8px; }
.heat th { text-align: left; color: var(--ink3); font-weight: 600; font-size: 12px; }
.heat .cell { text-align: center; border-radius: 6px; font-weight: 700; min-width: 54px; }
.distr { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.distr div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--ink3); height: 100%; }
.distr div i { display: block; width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; }
.resp { border-top: 1px solid var(--line2); padding: 10px 0; font-size: 14px; }
.resp .q { color: var(--ink2); margin: 4px 0; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.disclaimer { font-size: 12px; color: var(--ink3); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 14px; }

/* форма */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.form-sec { margin-bottom: 8px; }
.form-sec > h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); margin: 6px 0 12px; }
.sticky { position: sticky; top: 72px; }

.persona { padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.persona.off { opacity: .5; }

@media (max-width: 980px) {
  .layout-2, .form-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 32px 22px; }
  .auth-side h1 { font-size: 26px; }
}
@media (max-width: 680px) {
  .top-in { gap: 8px; }
  .top .brand span { display: none; }
  .ai-top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .subscores { justify-content: center; }
  .crit { grid-template-columns: 1fr 44px; }
  .crit > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .cols-2 { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 130px 1fr 28px; }
  .idea-card { grid-template-columns: 1fr; }
  .user-chip .nm { display: none; }
  .dots { grid-template-columns: repeat(10, 1fr); }
}

.auth-tools { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 16px; }
.auth-tools button { min-block-size: 44px; }
.auth-tools .lang-btn { inline-size: 6em; }
.auth-tools .install-btn { inline-size: 14.75em; }
.lang-btn, .install-btn { font: inherit; font-size: 13px; color: var(--ink2); background: var(--panel); border: 1px solid var(--line); padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.lang-btn:hover, .install-btn:hover { color: var(--ink); border-color: var(--ink3); }
.installed .install-btn, [hidden] { display: none !important; }
.connection-banner { padding: 8px 16px; color: var(--ink); background: var(--warn-soft); text-align: center; }
.offline-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.offline-card { width: min(100%, 420px); border: 1px solid var(--line); border-radius: 16px; padding: 28px; background: var(--panel); box-shadow: var(--shadow); }
.offline-card section > p:first-child { margin: 14px 0 8px; color: var(--ink2); font-weight: 600; }
.offline-card h1 { margin-bottom: 8px; }
.offline-card button { margin-top: 10px; }
@media (max-width: 680px) {
  .top-in { height: auto; min-height: 48px; flex-wrap: wrap; justify-content: space-between; padding-top: 6px; gap: 3px; }
  .top .brand span { display: inline-flex; }
  .nav { order: 3; flex: 1 0 100%; min-width: 0; }
  .top-right { gap: 2px; }
  .auth-side { padding: 18px 20px; }
  .auth-side ul, .auth-side > .small { display: none; }
  .auth-side h1 { font-size: 22px; margin: 12px 0 6px; }
  .auth { align-content: start; }
  .auth-form { padding-top: 16px; }
  .main, .card { overflow-wrap: anywhere; }
}

.nav, .tabs { min-inline-size: 0; overscroll-behavior-x: contain; }
.nav a, .tabs button { flex: none; }
.menu { max-width: calc(100% - 24px); max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 980px) {
  .layout-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .main :is(.card,.sticky,.page-head,.filters,.cols-2,.row,.layout-2,.form-grid) > * { min-width: 0; }
  .tbl-wrap, select, input, textarea, .chip, .btn, .st { max-width: 100%; }
  .chip, .st, .btn { white-space: normal; overflow-wrap: anywhere; }
  .pager, .modal .actions { flex-wrap: wrap; }
  .filters select { max-width: 100%; }
  .modal { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 680px) {
  .cols-2, .idea-card, .ai-top { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid select, input[type=text], input[type=email], input[type=password], input[type=date], textarea { font-size: 16px; }
}
.push-invite { padding: 12px max(16px, env(safe-area-inset-left)); background: var(--info-soft); color: var(--ink); }
.push-invite p { margin: 0 0 8px; }

/* The action bar stays in the editor's normal flow at the end of the form. */
.main.idea-editor { padding-bottom: 0; }
.editor-actions {
  position: sticky; bottom: var(--editor-keyboard, 0px); z-index: 15;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin: 16px -16px 0;
  padding: 10px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgb(0 0 0 / .06);
}
.editor-buttons { display: flex; gap: 8px; flex: none; min-width: 0; border: 0; padding: 0; margin: 0; }
.editor-buttons .btn { min-height: 44px; justify-content: center; }
.editor-status { min-width: 0; flex: 1; max-height: min(16vh, 6rem); overflow: auto; }
.editor-status:empty { display: none; }
.editor-status .alert { margin: 0; padding: 7px 10px; }
body:has(.idea-editor) .toast { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
html:has(.idea-editor) { scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
@media (max-width: 680px) {
  .editor-actions { flex-direction: column; align-items: stretch; gap: 6px; }
  .editor-buttons .btn { flex: 1; min-width: 0; padding: 7px 8px; }
}
.ava { object-fit: cover; }
.ava-small { width: 24px; height: 24px; font-size: 10px; vertical-align: middle; margin-inline-end: 4px; }
.ava-profile { width: 72px; height: 72px; font-size: 24px; margin-bottom: 8px; }
.upload-fields, .photo-fields { min-width: 0; border: 0; padding: 0; margin: 18px 0; }
.upload-fields legend, .photo-fields legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.upload-fields input, .photo-fields input { max-width: 100%; }
.file-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; overflow-wrap: anywhere; }
.file-row .btn { flex-shrink: 0; }
.menu .notif-item { display: grid; gap: 3px; text-align: start; white-space: normal; }
#comments, #files, #ai, #password { scroll-margin-top: 7rem; }

html.pull-enabled, html.pull-enabled body { overscroll-behavior-y: none; }
.pull-hint {
  position: fixed; top: max(4px, env(safe-area-inset-top)); left: 50%; z-index: 60;
  pointer-events: none; white-space: nowrap; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 24px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-weight: 600;
}
.refresh-dialog { width: min(26rem, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); }
.refresh-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.refresh-dialog h2 { margin-top: 0; }

#giga-review, #gpt-review { scroll-margin-top: 7rem; }
.compare-scores { margin-bottom: 12px; }
.compare-scores > div { display: grid; justify-items: start; gap: 6px; padding: 12px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.compare-scores h3 { margin: 0; }
.compare-scores b { font-size: 18px; }
.research-result { display: grid; gap: 12px; margin: 14px 0; }
.research-result > * { min-width: 0; margin: 0; }
.research-result .btn { justify-self: start; }
.research-result details, .research-result .pre { overflow-wrap: anywhere; }
.research-result summary, #ai summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.finance-table { min-width: 420px; font-variant-numeric: tabular-nums; }
.finance-table td { text-align: right; }

/* Typography and tables in personal GPT reports. */
.report-prose, .report-inline { overflow-wrap: anywhere; }
.report-prose { line-height: 1.65; min-width: 0; }
.report-prose :is(p, ul, ol, blockquote) { margin: .65em 0; }
.report-prose > :first-child, .report-prose li > :first-child { margin-top: 0; }
.report-prose > :last-child, .report-prose li > :last-child { margin-bottom: 0; }
.report-prose :is(h3,h4,h5,h6) { line-height: 1.3; margin: 1.35em 0 .5em; color: var(--ink); text-wrap: pretty; }
.report-prose h3 { font-size: 1.18em; letter-spacing: -.015em; }
.report-prose h4 { font-size: 1.06em; }
.report-prose :is(h5,h6) { font-size: 1em; }
.report-prose :is(ul,ol), .report-sources, .report-answers { padding-inline-start: 1.55em; }
.report-prose li + li { margin-block-start: .24em; }
.report-prose li::marker, .report-sources li::marker { color: var(--ink2); font-weight: 600; }
.report-prose blockquote { padding: .55em 1em; border-inline-start: 3px solid var(--accent); background: var(--panel2); color: var(--ink2); }
.report-prose blockquote > :first-child { margin-top: 0; }
.report-prose blockquote > :last-child { margin-bottom: 0; }
.report-prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.1em 0; }
.report-prose a, .report-inline a, .report-sources a { color: var(--info); text-decoration: underline; text-underline-offset: .15em; }
.report-prose .report-citation { font-size: .84em; font-weight: 600; white-space: nowrap; }
.report-prose :not(pre) > code, .report-inline code { padding: .08em .32em; border-radius: 4px; background: var(--panel2); font-size: .9em; }
.report-prose pre { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); padding: 11px 14px; font-size: .88em; line-height: 1.5; }
.report-table { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-block: .9em; }
.report-table:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.report-table table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; line-height: 1.45; font-size: .93em; }
.report-table :is(th,td) { padding: .65em .8em; vertical-align: top; min-width: 6.5em; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.report-table th { text-align: start; background: var(--panel2); }
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-summary { border-inline-start: 3px solid var(--accent); background: var(--panel2); border-radius: 0 8px 8px 0; padding: 12px 15px; margin: 12px 0 18px; }
.review-version { display: grid; gap: 4px; margin: 12px 0; max-width: 34rem; }
.review-version select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.gpt-score { margin: 16px 0; }
.gpt-score > div { min-width: 0; }
.report-archive { padding-block: 6px; margin-block: 12px; }
.research-result { gap: 14px; }
.research-result > details, #gpt-review .card > details { border: 1px solid var(--line); border-radius: 8px; padding: 0 13px; }
.research-result summary, #gpt-review .card > details > summary { padding: 11px 0; cursor: pointer; font-weight: 600; }
.research-result details[open] > summary { margin-bottom: 6px; }
.research-result > details[open], #gpt-review .card > details[open] { padding-bottom: 12px; }
.report-prose + h3 { margin-top: 16px; }
.report-metrics, .report-actions { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9.5rem),1fr)); gap: 8px; }
.report-metrics > div, .report-actions > section { padding: 10px 12px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; min-width: 0; overflow-wrap: anywhere; }
.report-metrics > div { display: flex; flex-direction: column-reverse; justify-content: end; }
.report-metrics > div span { color: var(--ink2); }
.report-metrics b { font-variant-numeric: tabular-nums; }
.report-actions h3 { margin: 0 0 .4em; }
.report-sources li { margin-block: .65em; }
.report-sources li > a { font-weight: 600; }
.report-sources .report-prose { color: var(--ink2); font-size: .92em; }
.report-criterion + .report-criterion { border-top: 1px solid var(--line2); margin-top: 9px; padding-top: 9px; }
.report-answers li { margin-block: .4em; overflow-wrap: anywhere; }
.report-table th:first-child { min-width: 8.5em; }
@media (max-width: 420px) {
  #gpt-review > .card { padding-inline: 13px; }
  .research-result > details { padding-inline: 10px; }
}

.gpt-panel { margin: 16px 0; padding-block: 4px 16px; border-bottom: 1px solid var(--line2); }
.gpt-panel-head { align-items: flex-start; }
.gpt-panel-head .tiny { margin-bottom: 3px; }
.gpt-panel-count { margin: 14px 0 5px; }
.gpt-panel .progress { margin: 0; }
.gpt-panel-count b, .gpt-legend b { font-variant-numeric: tabular-nums; color: var(--ink); }
.gpt-panel > p { margin: 9px 0; }
.gpt-dots { width: 100%; }
.dot.gpt-yes { background: var(--s5); }
.dot.gpt-conditional { background: var(--s3); }
.dot.gpt-no { background: var(--s1); }
.dot.gpt-outside { background: var(--panel2); border: 1px dashed var(--ink2); }
.dot.gpt-pending { background: var(--line); }
.gpt-legend { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 11px 0 0; padding: 0; list-style: none; }
.gpt-legend li { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink2); }
.gpt-legend .dot { display: inline-block; width: .8em; height: .8em; }

#gpt-finance { scroll-margin-top: 7rem; }
