:root {
  --bg: #e7e8eb;
  --shell: #f5f5f4;
  --card: #ffffff;
  --ink: #18181b;
  --ink-2: #52525b;
  --muted: #a1a1aa;
  --line: #ececec;
  --chip: #efefee;
  --dark: #1c1c1e;
  --accent: #f0412a;
  --accent-soft: #fde7e3;
  --good: #15803d;
  --hatch: #d4d4d8;
  --radius: 22px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--accent); }

/* ——— Кнопки, чипы, поля ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--chip); color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .15s, transform .1s; text-decoration: none;
}
.btn:hover { background: #e4e4e2; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-danger { color: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.round {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink);
  display: inline-grid; place-items: center; flex: none; font-size: 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.round:hover { background: #fafafa; }
.round.dark { background: var(--dark); color: #fff; }
.round.soft { background: var(--chip); box-shadow: none; }
.round.sm { width: 32px; height: 32px; font-size: 13px; }
.round.active { background: var(--dark); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 0; background: var(--chip); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip:hover { color: var(--ink); }
.chip.active { background: var(--dark); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.badge-accent { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-good { background: var(--good); }
.badge-flat { background: var(--chip); color: var(--ink-2); }

.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); outline: none;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--ink); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); }

/* ——— Каркас ——— */
.shell {
  max-width: 1480px; margin: 20px auto; background: var(--shell); border-radius: 32px;
  padding: 18px 28px 40px; min-height: calc(100vh - 40px);
}
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-mark { position: relative; width: 26px; height: 26px; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border-radius: 50%; }
.brand-mark::before { width: 14px; height: 14px; background: var(--accent); left: 0; top: 2px; }
.brand-mark::after { width: 10px; height: 10px; background: var(--dark); right: 1px; bottom: 1px; }
.nav-pills { display: flex; gap: 2px; padding: 4px; background: var(--card); border-radius: 999px; margin: 0 auto; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.nav-pill {
  border: 0; background: transparent; height: 34px; padding: 0 22px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px;
}
.nav-pill:hover { color: var(--ink); }
.nav-pill.active { background: var(--dark); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; text-transform: uppercase;
}

.topbar { justify-content: space-between; }
/* Переключатель школ */
.school-switch { display: flex; gap: 4px; padding: 5px; background: var(--card); border-radius: 999px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.school-btn {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px 0 6px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; letter-spacing: .02em; transition: background .15s, color .15s;
}
.school-btn:hover { background: var(--shell); color: var(--ink); }
.school-ico {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--chip); color: var(--ink-2); font-size: 13px; font-weight: 700; transition: background .15s, color .15s;
}
.school-btn.active { background: var(--dark); color: #fff; }
.school-btn.active .school-ico { background: var(--accent); color: #fff; }

/* ——— Валюта ——— */
.money { cursor: default; }
.money:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.money-tip {
  position: fixed; z-index: 90; transform: translate(-50%, -100%); pointer-events: none;
  background: var(--dark); color: #fff; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.cur-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.cur-switch button { border: 0; background: transparent; width: 30px; height: 26px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.cur-switch button.active { background: var(--dark); color: #fff; }

.hover-tip {
  position: fixed; z-index: 90; transform: translate(-50%, -100%); pointer-events: none; min-width: 180px; max-width: 320px;
  background: var(--dark); color: #fff; font-size: 12px; padding: 10px 12px; border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}
.hover-tip b { display: block; font-size: 13px; margin-bottom: 6px; }
.hover-tip div { display: flex; justify-content: space-between; gap: 14px; line-height: 1.6; }
.hover-tip span { color: #a1a1aa; }
.hover-tip em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Раскрывающиеся строки (причина → теги) */
tr.expandable { cursor: pointer; }
tr.expandable td:first-child::before { content: "▸"; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
tr.expandable.open td:first-child::before { transform: rotate(90deg); }
tr.expandable.open { background: var(--shell); }
tr.detail > td { padding: 0 0 12px 26px !important; background: var(--shell); }
table.sub { width: 100%; border-collapse: collapse; font-size: 12px; }
table.sub th, table.sub td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.sub th:first-child, table.sub td:first-child { text-align: left; }
table.sub th { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tag-row { cursor: default; }
.tag-row.clickable { cursor: pointer; }
.channel { display: inline-flex; align-items: center; gap: 5px; }
.note { font-size: 12px; color: var(--ink-2); background: var(--card); border-radius: 16px; padding: 10px 14px; margin: -4px 0 14px; line-height: 1.6; }
.note b { font-weight: 600; }

/* Логотип школы */
.school-ico img, .logo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.school-ico:has(img) { background: #fff; }
.school-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 26px; font-weight: 700; color: var(--ink-2); flex: none; overflow: hidden; }
.school-card .info { flex: 1; min-width: 160px; }
.school-card .info b { font-size: 16px; }

/* ——— Календарь ——— */
.cal-chip { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.cal-chip.active { box-shadow: none; }
.cal-pop {
  position: absolute; z-index: 70; display: flex; background: var(--card); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(24, 24, 27, .18), 0 0 0 1px rgba(0, 0, 0, .04); overflow: hidden;
}
.cal-side { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; background: var(--shell); min-width: 170px; }
.cal-preset { border: 0; background: transparent; text-align: left; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.cal-preset:hover { background: var(--card); color: var(--ink); }
.cal-preset.active { background: var(--dark); color: #fff; }
.cal-main { position: relative; padding: 18px 20px 16px; }
.cal-nav { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; pointer-events: none; }
.cal-nav button { pointer-events: auto; }
.cal-nav button:disabled { opacity: .35; cursor: default; }
.cal-months { display: flex; gap: 28px; }
.cal-month { width: 252px; }
.cal-title { text-align: center; font-weight: 600; font-size: 14px; height: 32px; line-height: 32px; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); height: 28px; line-height: 28px; }
.cal-day {
  position: relative; width: 36px; height: 36px; border: 0; background: transparent; font-size: 13px; font-weight: 500;
  color: var(--ink); font-variant-numeric: tabular-nums; z-index: 0;
}
.cal-day::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; z-index: -1; transition: background .1s; }
.cal-day:hover:not(.off)::before { background: var(--chip); }
.cal-day.in { background: var(--accent-soft); }
.cal-day.lo { border-radius: 50% 0 0 50%; }
.cal-day.hi { border-radius: 0 50% 50% 0; }
.cal-day.lo.hi { border-radius: 50%; background: transparent; }
.cal-day.lo, .cal-day.hi { color: #fff; }
.cal-day.lo::before, .cal-day.hi::before, .cal-day.lo:hover::before, .cal-day.hi:hover::before { background: var(--dark); inset: 2px; }
.cal-grid > :nth-child(7n + 1).in:not(.lo) { border-radius: 50% 0 0 50%; }
.cal-grid > :nth-child(7n).in:not(.hi) { border-radius: 0 50% 50% 0; }
.cal-day.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cal-day.off { color: #d4d4d8; cursor: default; }
.cal-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cal-range { flex: 1; display: flex; flex-direction: column; font-size: 11px; }
.cal-range b { font-size: 14px; font-weight: 600; }

/* ——— Шапка отчёта: заголовок и цифры сверху, период и статусы — отдельной строкой ——— */
.report-hero { margin-bottom: 22px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.hero-top h1 { font-size: 44px; font-weight: 500; letter-spacing: -.03em; margin: 0; line-height: 1.05; white-space: nowrap; }
.hero-top h1 span { color: var(--muted); }
.hero-top .head-stats { flex-wrap: nowrap; }
.hero-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 18px; }
.hero-controls .sync-line { margin-top: 0; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.hero h1 { font-size: 44px; font-weight: 500; letter-spacing: -.03em; margin: 0 0 14px; line-height: 1; }
.hero h1 span { color: var(--muted); }
.head-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.head-stat { display: flex; align-items: center; gap: 12px; }
.head-stat .round { width: 46px; height: 46px; font-size: 17px; }
.head-stat .v { font-size: 26px; font-weight: 500; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; line-height: 1.1; white-space: nowrap; }
.head-stat .l { font-size: 12px; color: var(--muted); }
.sync-line { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.demo-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.popover-wrap { position: relative; }
.popover {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 300px;
  background: var(--card); border-radius: 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, .14); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.popover .row { display: flex; gap: 8px; }

/* ——— Карточки ——— */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.card-sub { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }

.grid-main { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(260px, 1fr) minmax(0, 2.1fr); gap: 14px; margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Воронка — список */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { width: 30px; height: 30px; border-radius: 9px; background: var(--chip); display: grid; place-items: center; color: var(--ink-2); font-size: 12px; flex: none; }
.list-row .name { flex: 1; color: var(--ink-2); min-width: 0; }
.list-row .name small { display: block; color: var(--muted); font-size: 11px; }
.list-row b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Полукруглый индикатор */
.gauge { position: relative; width: 100%; max-width: 280px; margin: 4px auto 0; }
.gauge svg { width: 100%; display: block; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; }
.gauge-center .big { font-size: 42px; font-weight: 400; letter-spacing: -.03em; line-height: 1; }
.gauge-center .big small { font-size: 16px; color: var(--muted); margin-left: 2px; }
.gauge-center .l { font-size: 12px; color: var(--muted); }
.pill-note { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 7px 12px 7px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.pill-note .dot { width: 24px; height: 24px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 10px; flex: none; }

/* Тёмная карточка выручки */
.dark-card {
  background-color: var(--dark); color: #fff; border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; min-height: 200px;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 12px);
  display: flex; flex-direction: column; gap: 10px; flex: 1;
}
.dark-card .t { font-size: 26px; font-weight: 400; line-height: 1.1; }
.dark-card .v { font-size: 34px; font-weight: 500; letter-spacing: -.02em; margin-top: auto; white-space: nowrap; }
.dark-card .chips .chip { background: rgba(255, 255, 255, .1); color: #fff; }
.dark-card .tag-top { position: absolute; top: 18px; right: 18px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 3px 10px; font-size: 11px; }

/* Аналитика: штрихованные столбики */
.an-legend { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 10px 0 12px; }
.an-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.an-legend .unit { font-size: 11px; background: var(--chip); padding: 2px 8px; border-radius: 999px; color: var(--ink-2); font-weight: 600; }
.an-legend .sum { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.bars { position: relative; height: 340px; display: grid; grid-template-columns: 56px 1fr; }
.bars-y { position: relative; }
.bars-y span { position: absolute; right: 10px; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars-plot { position: relative; border-bottom: 1px solid var(--line); }
.bars-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: var(--gap, 6px); padding: 0 2px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; min-width: 0; }
.bar {
  width: 100%; border-radius: 999px; min-height: 3px; transition: background .15s;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, #f6f6f7 2px 6px);
  box-shadow: inset 0 0 0 1px #e4e4e7;
}
.bar-col.hot .bar, .bar-col:hover .bar { background: var(--accent); box-shadow: none; }
.bars-x { display: flex; gap: var(--gap, 6px); padding: 8px 2px 0 58px; }
.bars-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; overflow: visible; white-space: nowrap; }
.avg-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--ink-2); pointer-events: none; z-index: 1; }
.avg-line span { position: absolute; right: 0; top: -11px; background: var(--dark); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.bar-tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--dark); color: #fff; border-radius: 12px;
  padding: 8px 11px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px));
}
.bar-tip b { display: block; font-size: 14px; }
.mini-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.mini { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: var(--shell); min-width: 0; }
.mini .round { width: 36px; height: 36px; font-size: 13px; }
.mini .l { font-size: 11px; color: var(--muted); }
.mini .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini.dark { background: var(--dark); color: #fff; }
.mini.dark .round { background: #fff; color: var(--dark); }

/* ——— Теги ——— */
.tags-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 28px; }
.tag-row { display: grid; grid-template-columns: 150px 1fr 76px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.tag-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 500; }
.tag-track { height: 14px; border-radius: 999px; background: var(--shell); overflow: hidden; }
.tag-track > div { height: 100%; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, #f6f6f7 2px 6px); box-shadow: inset 0 0 0 1px #e4e4e7; }
.tag-row.top .tag-track > div, .tag-row:hover .tag-track > div { background: var(--accent); box-shadow: none; }
.tag-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ——— Таблицы ——— */
.table-scroll { overflow: auto; }
.table-scroll.tall { max-height: 460px; }
.table-scroll.tall thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.table-scroll.tall tfoot td { position: sticky; bottom: 0; background: var(--card); box-shadow: 0 -1px 0 var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th.sorted { color: var(--ink); }
table.data td { font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--shell); }
table.data tfoot td { font-weight: 700; border-bottom: 0; }
.thumb { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; background: var(--chip); vertical-align: middle; display: inline-block; }

/* ——— Креативы ——— */
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 32px 0 14px; }
.section-head h2 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -.02em; }
.section-head .spacer { flex: 1; }
.creo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.creo { background: var(--card); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.creo:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .08); }
.creo-img { position: relative; aspect-ratio: 1 / 1; background: var(--chip); display: grid; place-items: center; color: var(--muted); margin: 8px 8px 0; border-radius: 16px; overflow: hidden; }
.creo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creo-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); }
.badge .led { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.badge .led.on { background: #22c55e; }
.creo-rank { position: absolute; bottom: 8px; left: 8px; }
.creo-channel { position: absolute; bottom: 8px; right: 8px; }
.creo-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.creo-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creo-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 6px; }
.creo-metrics div { display: flex; flex-direction: column; }
.creo-metrics div > span { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.creo-metrics b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.search { height: 32px; border-radius: 999px; border: 0; background: var(--card); padding: 0 14px; width: 210px; outline: none; font-size: 12px; }

/* ——— Модалка ——— */
.modal-bg { position: fixed; inset: 0; background: rgba(24, 24, 27, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 28px; width: 100%; max-width: 880px; max-height: 92vh; overflow: auto; display: grid; grid-template-columns: 340px 1fr; }
.modal.narrow { grid-template-columns: 1fr; max-width: 420px; }
.modal-img { background: var(--chip); margin: 10px; border-radius: 20px; overflow: hidden; min-height: 320px; }
.modal-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-body { padding: 22px 22px 22px 12px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.modal.narrow .modal-body { padding: 24px; }
.modal-body h3 { margin: 0; font-size: 18px; font-weight: 600; word-break: break-word; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { background: var(--shell); border-radius: 14px; padding: 10px 12px; }
.kv div > span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.kv b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ——— Настройки ——— */
.settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.side-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 20px; }
.side-nav button { border: 0; background: transparent; text-align: left; padding: 10px 14px; border-radius: 999px; font-weight: 600; color: var(--ink-2); display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.side-nav button:hover { color: var(--ink); }
.side-nav button.active { background: var(--dark); color: #fff; }
.side-nav i { width: 16px; text-align: center; }
.side-nav .sep { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 14px 14px 4px; }
.settings-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.status-pill { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-pill.ok::before { background: #22c55e; }
.status-pill.err::before { background: var(--accent); }
.status-pill.run::before { background: #f59e0b; }
.test-result { font-size: 12px; padding: 12px 14px; border-radius: 14px; background: var(--shell); white-space: pre-wrap; line-height: 1.6; margin-top: 12px; }
.test-result.ok { border-left: 3px solid #22c55e; }
.test-result.err { border-left: 3px solid var(--accent); }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--chip); font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; }
.check-chip input { margin: 0; accent-color: var(--dark); }
.check-chip:has(input:checked) { background: var(--dark); color: #fff; }
.check-chip:has(input:disabled) { opacity: .6; cursor: default; }
details.adv summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); margin: 14px 0 12px; }
.warn { font-size: 12px; padding: 10px 14px; border-radius: 14px; background: #fff7ed; color: #9a3412; }
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d4d4d8; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--dark); }
.switch input:checked + span::before { transform: translateX(16px); }

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 13px; max-width: 380px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.err { background: var(--accent); }

/* ——— Вход ——— */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--shell); border-radius: 32px; padding: 34px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 6px 0 0; font-size: 34px; font-weight: 500; letter-spacing: -.02em; }
.login-error { color: var(--accent); font-size: 13px; min-height: 18px; }

@media (max-width: 1100px) {
  .hero-top { flex-direction: column; align-items: stretch; gap: 16px; }
  .hero-top .head-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .head-stat { background: var(--card); border-radius: 18px; padding: 12px; min-width: 0; }
  .head-stat .round { background: var(--shell); box-shadow: none; }
}
@media (max-width: 1240px) {
  .grid-main { grid-template-columns: 1fr 1fr; }
  .grid-main > .analytics { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 900px) {
  .tags-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { margin: 0; border-radius: 0; padding: 14px 16px 40px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .school-switch { order: 3; width: 100%; }
  .school-btn { flex: 1; justify-content: center; padding: 0 10px 0 5px; gap: 6px; font-size: 13px; }
  .school-ico { width: 30px; height: 30px; font-size: 12px; }
  .topbar-right { margin-left: auto; }
  .cal-pop { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; border-radius: 24px 24px 0 0; flex-direction: column; max-height: 90vh; overflow: auto; }
  .cal-side { flex-direction: row; overflow-x: auto; padding: 12px; min-width: 0; }
  .cal-months > .cal-month:first-child { display: none; }
  .cal-month { width: 100%; }
  .cal-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-day { width: 100%; }
  .cal-foot { flex-wrap: wrap; }
  .cal-range { flex-basis: 100%; }
  .hero h1, .hero-top h1 { font-size: 32px; white-space: normal; }
  .hero-top .head-stats { grid-template-columns: 1fr; }
  .school-switch { gap: 2px; padding: 4px; }
  .school-btn { min-width: 0; }
  .school-txt { overflow: hidden; text-overflow: ellipsis; }
  .head-stats { gap: 16px; }
  .head-stat .v { font-size: 20px; }
  .grid-main { grid-template-columns: 1fr; }
  .bars { height: 240px; grid-template-columns: 44px 1fr; }
  .bars-x { padding-left: 46px; }
  .mini-tiles { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; }
  .side-nav .sep { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { grid-template-columns: 1fr; }
  .modal-img { min-height: 0; aspect-ratio: 1 / 1; }
  .modal-body { padding: 4px 18px 18px; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .creo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tag-row { grid-template-columns: 100px 1fr 60px; }
  .search { width: 100%; }
}

@media (max-width: 420px) {
  .school-ico { display: none; }
  .school-btn { padding: 0 8px; }
}
