/* Отдел соцсетей: яркая кобальтовая шапка, оранжевый для обращений, цветные плитки, медали в рейтинге. */
:root {
  --bg: #f1f4fb; --panel: #ffffff; --line: #dde3ef; --fg: #141b2d; --muted: #5b6680;
  --accent: #2350d8; --accent-2: #1a3fb0; --accent-soft: #e4ebff; --on-accent: #ffffff;
  --lead: #f2711c; --lead-soft: #fff0e5; --muted-bar: #c5cee3; --pink: #e3407a; --pink-soft: #fde7ef;
  --ok: #129a57; --warn: #b86a00; --bad: #e0393e; --ok-soft: #e1f6ea; --warn-soft: #fff1d9; --bad-soft: #fde6e6;
  --gold: #f5b70a; --silver: #a9b3c6; --bronze: #cf7a3c;
  --radius: 12px; --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "Segoe UI", system-ui, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1222; --panel: #161d33; --line: #28324f; --fg: #eaeefa; --muted: #9aa6c4;
    --accent: #6f93ff; --accent-2: #2a47b8; --accent-soft: #1f2c57; --on-accent: #ffffff;
    --lead: #ff9a4d; --lead-soft: #3a2414; --muted-bar: #36415f; --pink: #ff6f9f; --pink-soft: #3d1a29;
    --ok: #4fd18d; --warn: #f0b04a; --bad: #ff6b6f; --ok-soft: #143524; --warn-soft: #3a2b10; --bad-soft: #3e1a1c;
    --gold: #f5c533; --silver: #b8c1d6; --bronze: #e0915a; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { background: var(--accent-2); color: var(--on-accent); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 20px; padding: 10px max(16px, env(safe-area-inset-left)); flex-wrap: wrap; max-width: 1400px; margin: 0 auto; }
.brand { font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--lead); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.brand small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { white-space: nowrap; text-decoration: none; color: var(--on-accent); opacity: .85; padding: 7px 12px; border-radius: 999px; }
.nav a:hover { background: rgb(255 255 255 / .12); opacity: 1; }
.nav a.on { background: #fff; color: #1a3fb0; font-weight: 600; opacity: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who a, .who .btn.link { color: var(--on-accent); }
.who form { margin: 0; }

main { max-width: 1400px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); display: grid; gap: 16px; }
h1 { font-size: 24px; margin: 0; font-weight: 700; text-wrap: balance; }
h2 { font-size: 16px; margin: 0; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px; }
.btn:disabled { opacity: .5; cursor: default; }
select, input[type=text], input[type=password], input[type=search], input[type=number], input[type=url], input[type=month], input[type=date] {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 8px; min-width: 0; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.f > * { color: var(--fg); }

.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.tile.hero { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile.hero .muted, .tile.hero .up, .tile.hero .down { color: var(--on-accent); opacity: .9; }
.tile.lead .big { color: var(--lead); } .tile.conv .big { color: var(--pink); } .tile.act .big { color: var(--ok); }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; border-radius: 4px; }
/* рейтинг */
.tabs { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lb li { display: grid; grid-template-columns: 2rem 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; }
.lb li.top3 { background: var(--bg); }
.lb .pl { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.lb .p1 { background: var(--gold); color: #3a2a00; } .lb .p2 { background: var(--silver); color: #1d2333; } .lb .p3 { background: var(--bronze); color: #fff; }
.lb .who-l { min-width: 0; } .lb .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .val { font-size: 18px; font-weight: 700; text-align: right; }
.lb .val small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.lb .bar2 { grid-column: 2 / 4; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: -2px; }
.lb .bar2 i { display: block; height: 100%; border-radius: 3px; }
.star { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius); background: linear-gradient(120deg, var(--accent-soft), var(--lead-soft)); }
.star .medal { width: 52px; height: 52px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #3a2a00; }
.star b { font-size: 17px; }
.tile .big { font-size: 32px; line-height: 1.15; font-weight: 700; font-family: var(--num); }
.up { color: var(--ok); } .down { color: var(--bad); }

.tbox { overflow: auto; max-height: 36rem; border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; font-size: 12px; z-index: 1; }
th button { all: unset; cursor: pointer; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
tr.sel td { background: var(--accent-soft); }
td.wrap { white-space: normal; min-width: 14rem; }
.bar { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--line); vertical-align: middle; margin-left: 8px; overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }

.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgb(0 0 0 / .15); padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 5; }

/* ввод данных */
.entry-grid { max-width: 980px; }
.entry-grid td input { width: 4.2em; text-align: right; padding: 4px 6px; }
.entry-grid td input.changed { border-color: var(--lead); background: var(--warn-soft); }
.entry-grid tr.mgr-first td { border-top: 2px solid var(--line); }
.entry-grid td.name { font-weight: 600; white-space: normal; min-width: 11rem; }
.entry-grid td.plat a { color: var(--muted); }
.periods { display: flex; gap: 6px; flex-wrap: wrap; }
.periods button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.periods button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.periods button.closed { color: var(--muted); }
.savebar { position: sticky; bottom: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; box-shadow: 0 -4px 16px rgb(0 0 0 / .06); }

.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; z-index: 50; max-width: min(90vw, 26rem); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--fg); padding: 18px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog form { display: grid; gap: 12px; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--fg); }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 16px; background: var(--bg); padding: 8px 10px; border-radius: 6px; user-select: all; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); }
.err { color: var(--bad); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
@media (max-width: 720px) {
  .top-in { gap: 8px 12px; } .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; } .brand { flex: 1; }
  .hide-n { display: none; } .tile .big { font-size: 24px; } }

.banner { background: var(--bad-soft); border-color: transparent; color: var(--fg); }
textarea { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px; width: 100%; resize: vertical; }
.region-h td { background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.st-ok { color: var(--ok); } .st-bad { color: var(--bad); } .st-warn { color: var(--warn); }
.periods button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.sel-col { width: 1%; }

.pace { font-size: 12px; line-height: 1.35; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgb(255 255 255 / .16); }
.pace b { font-weight: 700; }
.pace-chip { display: inline-grid; gap: 1px; font-size: 12px; line-height: 1.25; white-space: nowrap; }
.pace-chip b { font-size: 13px; }
.pace-ok { color: var(--ok); } .pace-bad { color: var(--bad); }
.pchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 12px; white-space: nowrap; }
a.pchip:hover { border-color: var(--accent); }
.pchip .pdot { width: 8px; height: 8px; border-radius: 50%; }
.pchip b { font-weight: 700; }
.pchip .ext { color: var(--accent); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.lb li.click { cursor: pointer; }
.lb li.click:hover { background: var(--bg); }
.lb .more { grid-column: 2 / 4; display: grid; gap: 4px; padding: 6px 0 2px; }
.ptable { border-collapse: collapse; font-size: 13px; width: auto; }
.ptable td, .ptable th { padding: 3px 12px 3px 0; border: 0; text-align: left; position: static; background: none; }
.ptable td.num, .ptable th.num { text-align: right; }
.tog { color: var(--muted); display: inline-block; width: 1em; transition: transform .15s; }
.open .tog { transform: rotate(90deg); }
tr.detail td { background: var(--bg); white-space: normal; }
.miss { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.lb li.muted { display: block; }
.ms { position: relative; }
.ms-btn { list-style: none; cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 30px 6px 10px; min-width: 12rem; max-width: 22rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.ms-btn::-webkit-details-marker { display: none; }
.ms-btn::after { content: "▾"; position: absolute; right: 10px; color: var(--muted); }
.ms-panel { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(24rem, 90vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgb(0 0 0 / .18); padding: 8px; display: grid; gap: 4px; }
.ms-presets { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; flex-wrap: wrap; }
.ms-list { display: grid; max-height: 18rem; overflow: auto; }
.ms-item { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; color: var(--fg); }
.ms-item:hover { background: var(--bg); }
