/* Помощник по обращениям — mobile-first. Phone is the primary layout; ≥ 960px adds the sidebar and multi-column views. */
:root {
  --navy: #16365f; --navy-2: #1f4c84; --blue: #2f6fd0; --blue-soft: #e8f0fc; --sky: #8fc1f0; --gold: #f2c14e;
  --bg: #f4f6fa; --panel: #ffffff; --ink: #142033; --ink-2: #3c4a5e; --muted: #6b778a; --line: #e2e7ef; --line-2: #eef1f6;
  --ok: #1e7b4c; --ok-bg: #e5f5ec; --warn: #9a5b00; --warn-bg: #fff3dc; --danger: #c0332b; --danger-bg: #fdecea;
  --info: #2f6fd0; --info-bg: #e8f0fc;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 4px 16px rgba(20, 32, 51, .06);
  --tabbar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PT Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); overflow-x: hidden; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: .3em 0 .6em; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .tiny { font-size: .76rem; }
.error { color: var(--danger); } .nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.main { min-width: 0; }
main#app { padding: 12px 14px calc(var(--tabbar-h) + var(--safe-b) + 20px); max-width: 1680px; margin: 0 auto; }
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: var(--navy); color: #fff; }
.appbar .brand { color: #fff; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.appbar-title { margin-left: auto; font-size: .85rem; color: #c9d8ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: url("/icon.svg") center/cover; flex: none; display: inline-block; }
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(5, 1fr); background: #fff;
  border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(20, 32, 51, .06); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  font-size: .7rem; font-weight: 600; position: relative; }
.tabbar a.active { color: var(--navy); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--navy); }
.tabbar svg, .sidebar svg { width: 24px; height: 24px; }
.badge-dot { position: absolute; top: 8px; right: calc(50% - 20px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: .68rem; line-height: 18px; text-align: center; }
.sidebar { display: none; }

/* ---------- buttons, inputs ---------- */
button, .button { font: inherit; font-weight: 600; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s; -webkit-tap-highlight-color: transparent; }
button:active, .button:active { transform: scale(.98); }
button.primary, .button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-2); }
button.accent { background: var(--blue); border-color: var(--blue); color: #fff; }
button.danger, .button.danger { color: var(--danger); border-color: #f1c4c0; background: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--blue); }
button.link { background: none; border: 0; min-height: 0; padding: 0; color: inherit; text-decoration: underline; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
button.block, .button.block { width: 100%; }
input, select, textarea { font: inherit; font-size: 16px; /* no iOS zoom */ width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 111, 208, .15); }
label { display: block; margin: 10px 0; font-size: .86rem; color: var(--ink-2); font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 12px; margin: 12px 0; }
legend { font-size: .84rem; color: var(--muted); padding: 0 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.field { margin: 10px 0; } .field-label { display: block; font-size: .86rem; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.filepick { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 400; cursor: pointer; }
.filepick .button { flex: none; } .filepick-name { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.filepick:focus-within .button { box-shadow: 0 0 0 3px rgba(47, 111, 208, .25); }

/* ---------- layout helpers ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid2, .grid3 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 2px 14px; }
.page-head h1 { margin: 0; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card.flat { box-shadow: none; }
.card.ok { background: var(--ok-bg); border-color: #bfe3cf; box-shadow: none; }
.card.warn { background: var(--warn-bg); border-color: #f2d9a6; box-shadow: none; }
.card.danger { background: var(--danger-bg); border-color: #f3c3be; box-shadow: none; }
.card h3 { margin-bottom: 8px; }
.section-title { margin: 22px 2px 10px; font-size: 1rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); max-width: 100%; line-height: 1.35; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger { background: var(--danger-bg); color: var(--danger); } .chip.info { background: var(--info-bg); color: var(--info); }
.chip.dark { background: var(--navy); color: #fff; }

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 20px); display: flex; flex-direction: column; justify-content: center; padding: 20px 6px; }
.hero { color: #fff; background: linear-gradient(160deg, #16365f 0%, #1f4c84 55%, #2f6fd0 100%); border-radius: 24px; padding: 28px 22px 64px;
  position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 193, 240, .35), transparent 70%); }
.hero h1 { font-size: 1.75rem; margin: 14px 0 8px; }
.hero p { color: #d6e4f7; margin: 0; }
.hero .facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .facts span { background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 4px 12px; font-size: .78rem; }
.login-card { margin: -44px 10px 0; position: relative; z-index: 1; }
.login-card button { margin-top: 8px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--navy); }
.kpi .l { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi.danger .v { color: var(--danger); } .kpi.ok .v { color: var(--ok); }
.kpi > svg { width: 34px; height: 34px; color: var(--sky); flex: none; }
svg { flex: none; }
.banner svg, button svg, .button svg { width: 20px; height: 20px; }
.card.ok svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--ok); }
.kpi.wide { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .86rem; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--blue); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); font-weight: 700; font-size: .92rem; }
.quick a svg { width: 26px; height: 26px; color: var(--blue); }
.quick a small { color: var(--muted); font-weight: 400; font-size: .78rem; }

/* ---------- inbox ---------- */
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 2px 14px 4px; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: none; min-height: 38px; padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--ink-2); font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.seg a.active, .seg button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg a.active.danger { background: var(--danger); border-color: var(--danger); }
.seg .count { font-size: .74rem; background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 0 7px; }
.seg a.active .count { background: rgba(255, 255, 255, .22); }
.list { display: grid; gap: 10px; }
.item { display: block; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px 18px;
  color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: transparent; }
.card + .list { margin-top: 12px; } .list + p { margin-top: 14px; }
.item.mode-urgent::before { background: var(--danger); } .item.mode-verify::before, .item.mode-decide::before { background: var(--warn); }
.item.mode-explain::before { background: var(--blue); } .item.mode-inform::before { background: var(--ok); }
.item .owner { font-size: .76rem; color: var(--muted); align-self: center; }
.item .top { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--muted); }
.item .title { font-weight: 700; margin: 4px 0 2px; font-size: 1rem; }
.item .sub { color: var(--ink-2); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deadline { font-weight: 700; } .deadline.soon { color: var(--warn); } .deadline.over { color: var(--danger); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; }

/* ---------- appeal ---------- */
.appeal-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.appeal-head h2 { font-size: 1.12rem; margin: 6px 0 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .9rem; margin: 2px 0 8px; }
.panes { display: block; }
.pane { display: none; }
.pane.active { display: block; }
.appeal-text { white-space: pre-wrap; background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: .95rem; line-height: 1.6; }
.appeal-text mark { border-radius: 4px; padding: 1px 2px; color: inherit; }
.appeal-text sup { font-weight: 800; margin-right: 2px; font-size: .66rem; color: var(--navy); }
.q1 { background: #fff1b8; } .q2 { background: #d6ecff; } .q3 { background: #dcf5d3; } .q4 { background: #fcdcee; }
.q5 { background: #e7dcff; } .q6 { background: #ffe1c7; } .q7 { background: #d2f3f0; } .q8 { background: #ececec; }
.questions { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.questions li { padding: 10px 12px; border-radius: 12px; border-left: 4px solid var(--line); background: #fff; border: 1px solid var(--line); }
.questions li .qid { display: inline-block; min-width: 26px; padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: .74rem; margin-right: 6px; }
.banner { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.banner.ok { color: var(--ok); background: var(--ok-bg); }
.letter { font-family: Georgia, "PT Serif", "Times New Roman", serif; font-size: 1rem; line-height: 1.65; white-space: pre-wrap;
  background: #fffefb; border: 1px solid #ece6d8; border-radius: 12px; padding: 16px; }
.editor { min-height: 52vh; font-family: Georgia, "PT Serif", "Times New Roman", serif; line-height: 1.6; border-radius: 12px; }
button.cite { min-height: 0; display: inline; padding: 0 6px; margin: 0 2px; border-radius: 6px; font-size: .72rem; font-family: -apple-system, system-ui, sans-serif;
  background: var(--info-bg); color: var(--info); border: 1px solid #c9dbf6; vertical-align: 2px; line-height: 1.6; }
button.cite.bad { background: var(--danger-bg); color: var(--danger); border-color: #f3c3be; }
.findings { margin: 6px 0 0; padding-left: 18px; font-size: .9rem; }
.findings li { margin: 4px 0; }
.findings li.error { color: var(--danger); }
.source { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: background .4s, box-shadow .4s; }
.source + .source { margin-top: 10px; }
.source.flash { background: #fff8d6; box-shadow: 0 0 0 3px #f2c14e; }
.source .sid { display: inline-block; font-weight: 800; font-size: .76rem; color: var(--info); background: var(--info-bg); border-radius: 6px; padding: 1px 7px; }
.source .crumb { font-size: .84rem; color: var(--navy); font-weight: 600; margin: 6px 0 4px; }
.quote { font-family: Georgia, "PT Serif", serif; font-size: .92rem; line-height: 1.55; white-space: pre-wrap; border-left: 3px solid var(--sky);
  padding: 2px 0 2px 12px; margin: 8px 0; max-height: 280px; overflow: auto; color: var(--ink-2); }
.actionbar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 10; display: flex; gap: 8px; margin-top: 14px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(20, 32, 51, .16); }
.actionbar > .primary { flex: 1; }
.timer { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- ask ---------- */
.ask-thread { display: grid; gap: 14px; }
.bubble-q { justify-self: end; max-width: 88%; background: var(--navy); color: #fff; border-radius: 18px 18px 4px 18px; padding: 10px 14px; white-space: pre-wrap; }
.bubble-a { background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 18px 4px; padding: 14px 16px; box-shadow: var(--shadow); }
.bubble-a .summary { font-weight: 700; font-size: 1.02rem; margin-bottom: 8px; }
.bubble-a ul { margin: 0; padding-left: 18px; } .bubble-a li { margin: 6px 0; }
.ask-bar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 10; display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 28px rgba(20, 32, 51, .16); }
.ask-bar textarea { border: 0; box-shadow: none; resize: none; min-height: 44px; max-height: 160px; padding: 10px; }
.ask-bar button { flex: none; width: 48px; padding: 0; border-radius: 14px; }
.suggest { display: grid; gap: 8px; }
.compare { display: grid; gap: 10px; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.suggest button { justify-content: flex-start; text-align: left; font-weight: 500; font-size: .92rem; }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.dots span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--blue); animation: blink 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- progress, spinner ---------- */
.splash { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .92rem; }
.steps li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.steps li.done { color: var(--ink-2); } .steps li.done::before { background: var(--ok); }
.steps li.now { color: var(--navy); font-weight: 700; } .steps li.now::before { background: var(--blue); box-shadow: 0 0 0 4px rgba(47, 111, 208, .2); }
.progress { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.progress .bar { height: 100%; width: 35%; background: var(--blue); animation: slide 1.4s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ---------- library ---------- */
.doc-item .title { font-size: .96rem; }
ul.tree { list-style: none; padding-left: 14px; margin: 0; }
ul.tree.root { padding-left: 0; }
ul.tree li { margin: 2px 0; display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; }
ul.tree li > ul.tree { grid-column: 2; padding-left: 0; }
ul.tree .twisty { min-height: 0; width: 26px; height: 26px; padding: 0; border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
ul.tree .unit { cursor: pointer; font-size: .9rem; padding: 3px 6px; border-radius: 6px; display: block; line-height: 1.4; }
ul.tree .unit:hover { background: var(--blue-soft); }
.doc-text { white-space: pre-wrap; font-family: Georgia, "PT Serif", serif; line-height: 1.6; font-size: .95rem; }
.doc-text mark { background: #fff1b8; border-radius: 3px; }

/* ---------- table (desktop data) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
table.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; font-size: .9rem; }
.table th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- sheet, toast, details ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(13, 22, 38, .45); animation: fade .2s; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto; background: var(--panel); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(22px + var(--safe-b)); animation: up .22s ease-out; box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 14px; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast { position: fixed; z-index: 70; left: 14px; right: 14px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: up .2s; text-align: center; }
.toast.error { background: var(--danger); } .toast.ok { background: var(--ok); }
details { border-radius: 12px; }
details > summary { cursor: pointer; list-style: none; font-weight: 700; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "⌄"; color: var(--muted); font-size: 1.1rem; transition: transform .2s; }
details[open] > summary::after { transform: rotate(180deg); }
pre { white-space: pre-wrap; margin: 0; font-size: .8rem; }
dialog { border: 0; border-radius: 20px; padding: 18px; width: min(680px, 94vw); max-height: 90vh; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(13, 22, 38, .45); }

/* ---------- desktop ---------- */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); }
  .toast { left: auto; right: 24px; max-width: 460px; text-align: left; }
}
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; }
  .shell.no-nav { display: block; }
  .login-wrap { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 1.15fr 1fr; align-items: stretch;
    padding: 40px 24px; min-height: 100vh; align-content: center; }
  .login-wrap .hero { border-radius: 24px 0 0 24px; padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
  .login-wrap .hero h1 { font-size: 2.1rem; }
  .login-wrap .login-card { margin: 0; border-radius: 0 24px 24px 0; padding: 44px 40px; display: flex; flex-direction: column;
    justify-content: center; box-shadow: var(--shadow); }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--navy); color: #fff; padding: 18px 14px; }
  .sidebar .brand { display: flex; gap: 10px; align-items: center; color: #fff; margin: 4px 6px 22px; }
  .sidebar .brand b { display: block; font-size: 1.02rem; } .sidebar .brand small { display: block; color: #9fb7d8; font-size: .76rem; }
  .sidebar .logo { width: 36px; height: 36px; border-radius: 10px; }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #c9d8ee; font-weight: 600; font-size: .95rem; position: relative; }
  .sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .sidebar nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
  .sidebar nav a .badge-dot { position: static; margin-left: auto; }
  .sidebar .who { margin-top: auto; font-size: .82rem; color: #9fb7d8; display: grid; gap: 6px; padding: 10px 8px 0; border-top: 1px solid rgba(255, 255, 255, .1); }
  .appbar, .tabbar { display: none !important; }
  main#app { padding: 26px 32px 40px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi.wide { grid-column: span 2; }
  .dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
  .list.cols { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
  .seg { margin: 0 0 14px; padding: 2px 0 4px; flex-wrap: wrap; }
  .panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
  .pane { display: block; }
  .pane[data-pane=answer] { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding-right: 2px; }
  .pane-tabs { display: none !important; }
  .actionbar, .ask-bar { bottom: 16px; }
  .toast { bottom: 24px; }
  .ask-layout { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
  .doc-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
  .doc-layout > .card:first-child { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
  .sheet-panel { left: auto; right: 24px; bottom: 24px; width: 520px; border-radius: 20px; }
}
/* ---------- appeal: plan of work ---------- */
.plan .eyebrow { margin: 0; }
.plan-summary { font-size: 1.05rem; line-height: 1.5; margin: 8px 0 6px; font-weight: 600; color: var(--ink); }
.plan.mode-urgent { border-color: #f3c3be; background: #fff8f7; }
.risk, .repeat { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; margin: 8px 0; }
.risk { color: var(--danger); font-weight: 600; } .repeat { color: var(--warn); }
.risk svg, .repeat svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
ol.tasks { list-style: none; counter-reset: t; padding: 0; margin: 0; display: grid; gap: 12px; }
ol.tasks li { counter-increment: t; display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 8px; line-height: 1.45; }
ol.tasks li::before { content: counter(t); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff;
  font-size: .76rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
ol.tasks .who { font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.qref { display: inline-block; padding: 0 5px; border-radius: 5px; font-size: .7rem; font-weight: 800; margin-right: 3px; vertical-align: 1px; }
ol.qlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
ol.qlist li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; line-height: 1.45; }
ol.qlist .qid { display: inline-flex; justify-content: center; height: 22px; align-items: center; border-radius: 6px; font-weight: 800; font-size: .74rem; }
.qmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.missing { color: var(--warn); margin-top: 4px; }
ul.plain { margin: 0; padding-left: 18px; line-height: 1.5; } ul.plain li { margin: 4px 0; }
.checks { border-radius: 12px; padding: 10px 12px; margin: 10px 0 12px; font-size: .88rem; }
.checks.ok { background: var(--ok-bg); color: var(--ok); display: flex; gap: 6px; align-items: center; }
.checks.warn { background: var(--warn-bg); color: var(--ink); } .checks.warn b { color: var(--warn); }
.checks ul { margin: 6px 0 0; padding-left: 18px; } .checks li.error { color: var(--danger); }
.row.tight { gap: 4px; }
.form-narrow { max-width: 760px; }
details.more-fields { margin: 6px 0 14px; } details.more-fields > summary { font-size: .9rem; color: var(--blue); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
