:root {
  --bg: #f6f7f5; --surface: #ffffff; --surface2: #f0f2ef; --text: #1b1f1d; --muted: #5d6662; --line: #dfe3df; --grid: #e6e9e6;
  --brand: #1f5f3f; --accent: #2e8b57; --accent-soft: #e5f2ea; --bad: #b4372f; --bad-soft: #f8e6e4; --warn: #a76a06; --warn-soft: #fbf0dc;
  --A: #c2413a; --B: #d98a1c; --C: #2f6fb3; --D: #2e8b57; --fund: #7b847f;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 14px rgba(20, 30, 25, .05);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111413; --surface: #181c1a; --surface2: #1f2421; --text: #e8ece9; --muted: #9aa59f; --line: #2c332f; --grid: #262c29;
    --brand: #2e8b57; --accent: #4fbf83; --accent-soft: #19301f; --bad: #ec6d63; --bad-soft: #3a1d1b; --warn: #e3a948; --warn-soft: #34291a;
    --A: #ec6d63; --B: #e6a23c; --C: #5b9be0; --D: #4fbf83; --fund: #9aa59f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111413; --surface: #181c1a; --surface2: #1f2421; --text: #e8ece9; --muted: #9aa59f; --line: #2c332f; --grid: #262c29;
  --brand: #2e8b57; --accent: #4fbf83; --accent-soft: #19301f; --bad: #ec6d63; --bad-soft: #3a1d1b; --warn: #e3a948; --warn-soft: #34291a;
  --A: #ec6d63; --B: #e6a23c; --C: #5b9be0; --D: #4fbf83; --fund: #9aa59f; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.theme { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; outline: none; }
.foot { max-width: 1180px; margin: 0 auto; padding: 0 24px 32px; color: var(--muted); font-size: 13px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 30px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; max-width: 760px; }
.loading { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.good .v { color: var(--accent); } .kpi.bad .v { color: var(--bad); }
.verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: start; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: none; }
.verdict.no { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.verdict .ico { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.verdict.no .ico { background: var(--bad); }
.verdict b { font-size: 16px; }
.verdict .note { color: color-mix(in srgb, var(--text) 78%, var(--accent)); }
.verdict.no .note { color: color-mix(in srgb, var(--text) 78%, var(--bad)); }
.stats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stats > div { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.stats > div:first-child { border-left: none; }
.stats .v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.stats .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stats .good .v { color: var(--accent); } .stats .bad .v { color: var(--bad); }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface2), var(--surface), var(--surface2)); background-size: 200% 100%; min-height: 120px; }
@media (prefers-reduced-motion: no-preference) { .skeleton { animation: shimmer 1.4s ease-in-out infinite; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
html { scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; accent-color: var(--accent); caret-color: var(--accent); }
.theme svg { display: block; margin: auto; }
.theme:hover, .tabs button:hover, .btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 85%, #000); }
.tabs button, .btn { transition: background-color .15s ease-out, border-color .15s ease-out; }
.meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--accent-soft); color: var(--accent); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.chart { overflow-x: auto; }
.chart svg { width: 100%; height: auto; display: block; }
#calcOut .chart svg { min-width: 560px; }
#calcOut, #labOut { min-width: 0; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--muted); background: var(--surface2); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr.hl td { background: var(--accent-soft); font-weight: 600; }
td.pos { color: var(--accent); } td.neg { color: var(--bad); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.tabs button, .btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; }
.tabs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn:focus-visible, .tabs button:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: grid; gap: 14px; }
.field label { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.field label b { color: var(--text); font-weight: 600; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field select, .field input[type="date"], .field input[type="number"] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; }
.checks input { accent-color: var(--accent); }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.note { color: var(--muted); font-size: 13.5px; }
.list { margin: 0; padding-left: 20px; } .list li { margin: 6px 0; }
.bar { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); }
.mono { font-family: var(--mono); font-size: 13px; }
.journal { max-height: 420px; overflow: auto; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.callout { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: 14px; }
@media (max-width: 900px) {
  .stats { --n: 2 !important; } .stats > div:nth-child(3) { border-left: none; } .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g2 { grid-template-columns: 1fr; } .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top { padding: 8px 16px; gap: 10px; flex-wrap: wrap; } .brand span { display: none; } .nav { order: 3; flex-basis: 100%; }
  main { padding: 18px 16px 32px; } .foot { padding: 0 16px 24px; } h1 { font-size: 22px; } .kpi .v, .stats .v { font-size: 20px; } .stats > div { padding: 12px 14px; }
  th, td { padding: 8px 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: no-preference) { .card { transition: border-color .15s; } }

/* экскурсия */
.tour { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 16, 13, .55); outline: 2px solid var(--accent); pointer-events: none; }
.tour-card { position: fixed; pointer-events: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28); outline: none; }
.tour-card.docked { left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; }
.tour-card h2 { font-size: 17px; margin: 4px 0 6px; }
.tour-card p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.tour-step { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.tour-dots { display: flex; gap: 5px; margin-bottom: 12px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-dots i.past { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tour-dots i.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
.tour-skip { border: none; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; }
.tour-actions .btn { padding: 7px 14px; }
@media (prefers-reduced-motion: no-preference) {
  .tour-hole { transition: top .25s cubic-bezier(.2, .8, .2, 1), left .25s cubic-bezier(.2, .8, .2, 1), width .25s cubic-bezier(.2, .8, .2, 1), height .25s cubic-bezier(.2, .8, .2, 1); }
  .tour-card { transition: top .25s cubic-bezier(.2, .8, .2, 1), left .25s cubic-bezier(.2, .8, .2, 1), opacity .18s ease-out; }
  .tour.out { opacity: 0; transition: opacity .18s ease-out; }
}
.tourbtn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; height: 36px; padding: 0 12px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.tourbtn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* после совета директоров */
.verdict.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.verdict.warn .ico { background: var(--warn); }
.verdict.warn .note { color: color-mix(in srgb, var(--text) 80%, var(--warn)); }
abbr.term { text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent); text-underline-offset: 3px; cursor: help; }
abbr.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.steps { padding-left: 22px; } .steps li::marker { color: var(--accent); font-weight: 700; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 85%, #000); }
/* первая колонка таблиц не уезжает при прокрутке вбок */
.tablewrap th:first-child, .tablewrap td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tablewrap th:first-child { background: var(--surface2); }
.tablewrap tr.hl td:first-child { background: color-mix(in srgb, var(--accent-soft) 100%, var(--surface)); }
td .note { display: block; font-size: 12px; }
@media (max-width: 560px) {
  .nav { flex-wrap: wrap; overflow: visible; gap: 4px; }
  .nav a { padding: 6px 10px; background: var(--surface2); }
  .top { position: static; }
}
