/* Капитал — дизайн-токены и каркас. Inter, индиго, спокойный светлый стиль + тёмная тема. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #f1f1f5;
  --text: #17172b;
  --text-dim: #6b6b80;
  --line: #e6e6ee;
  --accent: #4f46e5;        /* индиго */
  --accent-soft: #eef0fe;
  --good: #0f9d58;
  --good-soft: #e6f6ed;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --bad: #d23f31;
  --bad-soft: #fdeae7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(23, 23, 43, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101018;
    --surface: #181824;
    --surface-2: #20202e;
    --text: #ececf4;
    --text-dim: #9a9ab0;
    --line: #2a2a3a;
    --accent: #7c74f2;
    --accent-soft: #232145;
    --good: #34b46e; --good-soft: #15301f;
    --warn: #d99b3c; --warn-soft: #33270f;
    --bad: #e0604f;  --bad-soft: #391712;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #101018; --surface: #181824; --surface-2: #20202e;
  --text: #ececf4; --text-dim: #9a9ab0; --line: #2a2a3a;
  --accent: #7c74f2; --accent-soft: #232145;
  --good: #34b46e; --good-soft: #15301f;
  --warn: #d99b3c; --warn-soft: #33270f;
  --bad: #e0604f; --bad-soft: #391712; --shadow: none;
}
:root[data-theme="light"] {
  --bg: #f7f7f9; --surface: #ffffff; --surface-2: #f1f1f5;
  --text: #17172b; --text-dim: #6b6b80; --line: #e6e6ee;
  --accent: #4f46e5; --accent-soft: #eef0fe;
  --good: #0f9d58; --good-soft: #e6f6ed;
  --warn: #b7791f; --warn-soft: #fdf3e0;
  --bad: #d23f31; --bad-soft: #fdeae7;
  --shadow: 0 1px 3px rgba(23, 23, 43, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* Каркас: сайдбар на десктопе, таб-бар снизу на мобиле */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; padding: 20px 12px;
  border-right: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand {
  font-weight: 700; font-size: 17px; padding: 6px 12px 18px;
  letter-spacing: -0.01em;
}
.sidebar .brand span { color: var(--accent); }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--text-dim); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.main { flex: 1; padding: 24px; max-width: 1200px; min-width: 0; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    width: auto; flex-direction: row; padding: 6px 8px;
    border-right: none; border-top: 1px solid var(--line);
    justify-content: space-around;
  }
  .sidebar .brand, .sidebar .nav-spacer, .sidebar form { display: none; }
  .nav-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 10px; }
  .main { padding: 16px 12px 90px; }
}

/* Компоненты */
.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.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
}
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.num { font-variant-numeric: tabular-nums; }
.big { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.dim { color: var(--text-dim); }
.small { font-size: 13px; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad  { background: var(--bad-soft);  color: var(--bad); }
.pill.dim  { background: var(--surface-2); color: var(--text-dim); }

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 8px;
}
button:hover, .btn:hover { filter: brightness(1.07); }
button.ghost, .btn.ghost {
  background: transparent; color: var(--accent);
  border: 1px solid var(--line);
}
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  width: 100%;
}
label { font-size: 13px; font-weight: 600; color: var(--text-dim); display: block; margin-bottom: 4px; }

/* Полоска лимита оси (балансировка) */
.axis-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; position: relative; }
.axis-bar .fill { height: 100%; border-radius: 99px; background: var(--accent); }
.axis-bar .fill.over { background: var(--bad); }

/* Спрятанное — всегда спрятано: свои display-стили не должны перебивать hidden */
[hidden] { display: none !important; }

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