:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #7b2ff2;
  --accent-soft: #f1e9fe;
  --good: #1f8a4c;
  --good-soft: #e5f5ec;
  --bad: #c9372c;
  --bad-soft: #fdeceb;
  --warn: #b26a00;
  --warn-soft: #fff3df;
  --neutral-soft: #eef0f4;
  --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
small { color: var(--muted); font-weight: 400; }

/* шапка */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 14px; border-radius: var(--radius); color: var(--muted);
  text-decoration: none; font-weight: 600;
}
.tab:hover { background: var(--neutral-soft); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.count { font-weight: 400; opacity: .8; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sync .err { color: var(--bad); }

/* панель и таблицы */
main { padding: 16px 20px 40px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.search { width: 340px; max-width: 100%; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%;
}
.toolbar select, .toolbar input { width: auto; }
.toolbar .search { width: 340px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 140px); }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
.grid th {
  position: sticky; top: 0; z-index: 2; background: #fafbfc; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom;
}
.grid th small { font-size: 11px; }
.grid th.before { background: #f6f3fd; }
.grid th.after { background: #f1f8f4; }
.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: #fafaff; }
.grid tr.flash td { animation: flash 2s ease-out; }
@keyframes flash { from { background: #fff1b8; } to { background: transparent; } }
.c-id { width: 44px; font-weight: 600; }
.c-date { white-space: nowrap; }
.c-text { min-width: 200px; max-width: 320px; }
.c-num { text-align: right; white-space: nowrap; }
.grid td.c-num { font-variant-numeric: tabular-nums; }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.nm { display: flex; gap: 8px; align-items: flex-start; white-space: nowrap; }
.nm img { width: 32px; height: 42px; object-fit: cover; border-radius: 4px; background: var(--neutral-soft); flex: none; }
.nm a { color: var(--accent); text-decoration: none; }
.nm a:hover { text-decoration: underline; }
.sub { display: block; color: var(--muted); font-size: 12px; white-space: normal; min-width: 130px; max-width: 180px; }
.vc { font-weight: 600; white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.delta { display: block; font-size: 12px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.due { color: var(--warn); font-weight: 600; }
.due::after { content: " · пора замерить"; font-weight: 400; font-size: 12px; }

/* цветные выпадающие списки прямо в таблице */
.pill {
  width: auto; border: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600;
  background: var(--neutral-soft); cursor: pointer;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--neutral-soft); font-size: 12px; white-space: nowrap; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.hyp-link { display: block; }
.hyp-link .sub { max-width: 200px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }

/* кнопки */
.btn { font: inherit; font-weight: 600; border-radius: 6px; padding: 8px 14px; border: 1px solid transparent; cursor: pointer; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--neutral-soft); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }

/* модальные окна */
.modal { border: none; border-radius: 12px; padding: 0; width: min(680px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(20, 22, 30, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 20px; display: grid; gap: 12px; max-height: calc(100vh - 180px); overflow: auto; }
.modal-body p { margin: 0; }
.modal-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
label { display: block; font-size: 13px; font-weight: 600; }
label > input, label > select, label > textarea, label > .combo { display: block; margin-top: 4px; }
.req { color: var(--bad); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 12px; }
.narrow { max-width: 260px; }
fieldset.metrics { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 12px; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
fieldset.metrics legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.error { color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 6px; }
.picked:empty { display: none; }
.picked { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 6px; background: var(--neutral-soft); font-size: 13px; }
.picked img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; }

/* поиск с выпадающим списком */
.combo { position: relative; }
.combo.with-clear input { padding-right: 32px; }
.combo .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 300px; overflow: auto; font-weight: 400;
}
.combo-item { display: flex; gap: 10px; align-items: center; padding: 7px 10px; cursor: pointer; }
.combo-item.active, .combo-item:hover { background: var(--accent-soft); }
.combo-item img { width: 30px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--neutral-soft); flex: none; }
.combo-item .t { min-width: 0; }
.combo-item .t b { display: block; }
.combo-item .t span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-empty { padding: 10px; color: var(--muted); }

/* воронка и автоитог в форме изменения */
.funnel-line { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.err-text { color: var(--bad); }
.outcome-line { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.outcome-line .narrow { width: 220px; }
.outcome-line select:disabled { background: var(--neutral-soft); color: var(--text); opacity: 1; }
.outcome-line .small { padding-bottom: 9px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding-bottom: 7px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider { position: relative; width: 36px; height: 20px; border-radius: 999px; background: #c9cdd6; transition: background .2s; flex: none; }
.slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.c-outcome { white-space: nowrap; }
.auto-badge { display: block; margin-top: 3px; padding-left: 10px; font-size: 11px; color: var(--muted); }

/* вкладка «CTR-тесты» */
#tab-ab { max-width: 1200px; }
.ab-intro { max-width: 640px; }
.ab-test { padding: 16px 18px; margin-bottom: 14px; }
.ab-intro { margin: -4px 0 12px; }
.ab-group { margin-bottom: 10px; overflow: hidden; }
.ab-group.open { border-color: var(--accent); }
.ab-group-head {
  display: grid; grid-template-columns: 48px minmax(200px, 1fr) 230px 230px 20px; gap: 16px; align-items: center;
  width: 100%; padding: 12px 16px; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.ab-group-head:hover { background: #fafaff; }
.ab-group-head .ab-thumb { width: 48px; height: 64px; background: var(--neutral-soft); }
.ab-group-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-group-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.ab-group-meta .pill { cursor: default; font-size: 12px; padding: 2px 8px; }
.ab-stat { display: flex; gap: 10px; align-items: center; min-width: 0; }
.ab-stat img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; flex: none; }
.ab-stat > div { display: grid; min-width: 0; }
.ab-stat b { font-size: 20px; line-height: 1.2; }
.ab-stat .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-chevron { color: var(--muted); transition: transform .2s; }
.ab-group.open .ab-chevron { transform: rotate(180deg); }
.ab-group-body { padding: 4px 16px 6px; border-top: 1px solid var(--line); background: var(--bg); }
.ab-group-body .ab-test { margin: 12px 0; }
.ab-history { margin: 12px 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ab-hist-row { display: grid; grid-template-columns: 150px 1fr 60px 110px; gap: 12px; align-items: center; padding: 4px 0; font-size: 13px; }
@media (max-width: 900px) {
  .ab-group-head { grid-template-columns: 48px 1fr 20px; }
  .ab-group-head .ab-stat { grid-column: 2 / 3; }
  .ab-hist-row { grid-template-columns: 1fr 60px; }
  .ab-hist-row .bar, .ab-hist-row .small { display: none; }
}
.ab-head { display: flex; gap: 12px; align-items: flex-start; }
.ab-thumb { width: 40px; height: 53px; object-fit: cover; border-radius: 6px; flex: none; }
.ab-head-main { flex: 1; min-width: 0; }
.ab-title { font-weight: 700; font-size: 15px; }
.ab-head .pill { cursor: default; }
.ab-warn { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); }
.ab-total { margin-top: 12px; }
.ab-warn.soft { background: var(--warn-soft); color: var(--warn); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ab-nums { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ab-nums b { color: var(--text); }
.ab-draft-note { margin-top: 10px; }
.ab-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.ab-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.ab-tile.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ab-tile.winner { border-color: var(--good); box-shadow: 0 0 0 2px var(--good-soft); }
.ab-img { position: relative; aspect-ratio: 3 / 4; background: var(--neutral-soft); }
.ab-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ab-badge { position: absolute; left: 6px; top: 6px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #fff; }
.ab-badge.live { background: var(--accent); color: #fff; }
.ab-badge.win { background: var(--good); color: #fff; }
.ab-badge.applied { top: auto; bottom: 6px; background: rgba(29,35,48,.8); color: #fff; }
.ab-tile-body { padding: 8px 10px 10px; display: grid; gap: 6px; }
.ab-label { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-ctr { font-size: 22px; font-weight: 800; }
.ab-ctr small { font-size: 12px; }
.ab-ctr.best { color: var(--good); }
.ab-tile .ab-nums { flex-direction: column; gap: 2px; margin: 0; }
.ab-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ab-foot summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.ab-log { margin: 8px 0 0; padding-left: 18px; font-size: 12px; max-height: 220px; overflow: auto; }
.ab-log li { margin-bottom: 3px; }
.ab-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.steps { display: flex; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.steps span { padding: 4px 10px; border-radius: 999px; background: var(--neutral-soft); }
.steps span.on { background: var(--accent-soft); color: var(--accent); }
.field-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.ab-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ab-pick { position: relative; width: 96px; padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--neutral-soft); cursor: pointer; font: inherit; }
.ab-pick img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.ab-pick.on { border-color: var(--accent); }
.ab-pick-n { position: absolute; top: 4px; left: 4px; min-width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.9); border: 1px solid var(--line); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.ab-pick:not(.on) .ab-pick-n { color: transparent; }
.ab-pick.on .ab-pick-n { background: var(--accent); color: #fff; border-color: var(--accent); }
.ab-pick-tag { display: block; font-size: 10px; padding: 3px 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface); }
.ab-remove { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 1; }
.upload-btn { display: inline-block; }
.radio { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; }
.radio input { width: auto; margin: 0; }
.indent { margin: 0 0 6px 24px; max-width: 520px; }
.hint { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.chip-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
input.invalid { border-color: var(--bad); background: var(--bad-soft); }
.ab-summary { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--neutral-soft); }
.ab-sum-photos { display: flex; gap: 4px; }
.ab-sum-photos img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; }
.forecast { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.forecast > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 2px; }
.forecast b { font-size: 20px; }
.note { font-size: 13px; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft); }
@media (max-width: 720px) {
  .forecast { grid-template-columns: 1fr; }
  .ab-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* история конверсий */
.hist-controls { align-items: center; }
.hist-search { width: 380px; max-width: 100%; }
.hist-search input { width: 100%; }
.hist-date { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.hist-date input { width: auto; margin-top: 0 !important; }
.hist-status { margin: -4px 0 12px; display: grid; gap: 2px; }
.hist-product { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.hist-product img { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; }
.hist-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.hist-tiles .stat-v { font-size: 22px; }
.hist-table td.c-num { font-variant-numeric: tabular-nums; }
.pending { color: var(--warn); font-weight: 700; cursor: help; }

/* вход */
.me { font-size: 13px; font-weight: 600; color: var(--muted); }
.me:not(:empty)::before { content: "👤 "; }
.user-list { display: grid; gap: 8px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px 24px;
  box-shadow: 0 20px 50px rgba(30, 20, 60, .08); display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 22px; text-align: center; }
.login-card > p { margin: 0; text-align: center; }
.login-logo { width: 48px; height: 48px; margin: 0 auto; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 22px; }
.login-card label input { padding: 10px 12px; font-size: 15px; }
.pass-field { position: relative; display: block; margin-top: 4px; }
.pass-field input { margin-top: 0 !important; padding-right: 42px !important; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none;
  cursor: pointer; font-size: 16px; opacity: .6; padding: 4px; }
.pass-toggle:hover { opacity: 1; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }
.login-note { text-align: center; }

/* кабинеты */
.cabinet-filter { width: auto; max-width: 200px; padding: 5px 8px; font-size: 13px; }
.cab-tag { display: inline-block; padding: 1px 6px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: middle; }
.cab-list { display: grid; gap: 8px; }
.cab-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.cab-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.cab-name { font-weight: 700; font-size: 15px; border-color: transparent; padding: 3px 6px; margin-left: -6px; background: transparent; }
.cab-name:hover { border-color: var(--line); }
.cab-name:focus { background: var(--surface); }
.cab-actions { display: flex; flex-direction: column; gap: 6px; }
.cab-replace { display: grid; gap: 6px; margin-top: 6px; }
.cab-add { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.cab-add p { margin: 0; }
.cab-row { display: grid; grid-template-columns: 200px 1fr 28px; gap: 8px; align-items: start; margin-bottom: 8px; }
.cab-row textarea, .cab-replace textarea { font-family: Consolas, monospace; font-size: 12px; }
.cab-add-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .cab-item { flex-direction: column; }
  .cab-actions { flex-direction: row; flex-wrap: wrap; }
  .cab-row { grid-template-columns: 1fr 28px; }
  .cab-row textarea { grid-column: 1 / 2; }
}

/* CTR-тест в окне изменения */
.ctr-block { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 10px 12px; background: #fcfaff; display: grid; gap: 8px; }
.ctr-block p { margin: 0; }
.ctr-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ctr-actions select { width: auto; max-width: 100%; flex: 1; min-width: 220px; }
.ctr-linked { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.ctr-linked .pill { cursor: default; }
.flash-card { animation: flash-card 2s ease-out; }
@keyframes flash-card { from { box-shadow: 0 0 0 4px #ffe58a; } to { box-shadow: none; } }

/* вкладка «Прогресс» */
#tab-progress { max-width: 980px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.hero { padding: 20px 24px 18px; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.big { font-size: 22px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.big span { font-size: 48px; font-weight: 800; color: var(--text); line-height: 1; }
.level { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.level span { font-size: 22px; line-height: 1; }
.level.none { background: var(--neutral-soft); color: var(--muted); font-weight: 600; }
.scale-wrap { margin: 22px 0 6px; }
.scale { position: relative; display: grid; grid-template-columns: repeat(var(--cells), 1fr); gap: 4px; }
.cell { height: 34px; border-radius: 6px; background: var(--neutral-soft); transition: background .3s; }
.cell.on { background: var(--accent); }
.cell.extra { background: var(--good); }
.pace { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px dashed var(--warn); }
.pace span { position: absolute; top: -18px; left: -24px; width: 48px; text-align: center; font-size: 11px; color: var(--warn); font-weight: 600; }
.marks { position: relative; height: 40px; margin-top: 4px; }
.mark { position: absolute; transform: translateX(-100%); display: flex; flex-direction: column; align-items: flex-end; padding-right: 2px; opacity: .35; filter: grayscale(1); }
.mark.got { opacity: 1; filter: none; }
.mark-icon { font-size: 18px; line-height: 1.2; }
.mark-num { font-size: 11px; color: var(--muted); }
.bar-line { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: inherit; }
.bar.full > div { background: var(--good); }
.status { margin: 12px 0 0; }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
.small { font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.stat { padding: 14px 16px; }
.stat-v { font-size: 26px; font-weight: 800; }
.stat-l { font-weight: 600; margin-top: 2px; }
.section-title { margin: 24px 0 8px; font-size: 15px; }
.months { padding: 4px 16px; }
.month-row { display: grid; grid-template-columns: 140px 1fr 80px 28px 130px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.month-row:last-child { border-bottom: none; }
.month-row.current .month-name { font-weight: 700; color: var(--accent); }
.month-medal { font-size: 18px; text-align: center; }
@media (max-width: 720px) {
  .month-row { grid-template-columns: 1fr 70px 24px; }
  .month-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .month-conf { display: none; }
  .cell { height: 24px; }
}

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: #1d2330; color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.err { background: var(--bad); }

@media (max-width: 720px) {
  .top { gap: 10px; padding: 10px 16px; }
  .sync { margin-left: 0; }
  main { padding: 12px 16px 32px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .toolbar .search { width: 100%; }
}
