:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #eceae5;
  --line: #d9d6cf;
  --line-strong: #b9b5ab;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7c7a73;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --accent-soft: #e6effb;
  --accent-soft-2: #fbe9e1;
  --good: #1baf7a;
  --warn: #eda100;
  --radius: 10px;
  --font-head: Bitter, 'Iowan Old Style', Georgia, serif;
  --font-body: Commissioner, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --surface-2: #242423;
    --line: #35352f;
    --line-strong: #4f4f47;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #94938a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --accent-soft: #16263c;
    --accent-soft-2: #331c11;
    --good: #199e70;
    --warn: #c98500;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --surface-2: #242423;
  --line: #35352f;
  --line-strong: #4f4f47;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #94938a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --accent-soft: #16263c;
  --accent-soft-2: #331c11;
  --good: #199e70;
  --warn: #c98500;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--series-1); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.sec { color: var(--text-secondary); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }

button, .btn {
  font: inherit;
  font-weight: 600;
  color: var(--surface-1);
  background: var(--text-primary);
  border: 1px solid var(--text-primary);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  min-height: 44px;
}
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--line-strong);
}
button:disabled { opacity: .45; cursor: not-allowed; }

input, textarea, select {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--text-secondary); margin-bottom: 4px; }

.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

.tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--line);
}
.tag.on { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.tag.warnish { background: var(--accent-soft-2); border-color: var(--series-2); color: var(--text-primary); }

.err { color: var(--series-2); font-weight: 600; }
.ok { color: var(--good); font-weight: 600; }

/* --- Показатели проекта --- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.fact .k { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; }
.fact .n { font-size: .78rem; color: var(--text-muted); }

/* --- Полосы --- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 68px; gap: 12px; align-items: center; }
.bar-label { font-size: .9rem; overflow-wrap: anywhere; }
.bar-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; overflow: visible; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--series-1); }
.bar-fill.alt { background: var(--series-2); }
.bar-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; font-size: .9rem; }
.bar-ref {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--text-primary); border-radius: 1px;
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--text-secondary); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--series-1); display: inline-block; }
.swatch.alt { background: var(--series-2); }
.swatch.tick { width: 2px; height: 14px; border-radius: 1px; background: var(--text-primary); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
