/* Reels Tracker: прикладной интерфейс с боковой панелью проектов.
   Палитра: холодный серо-голубой фон, кобальт, коралл и бирюза как цвета проектов. */
:root {
  --bg: #edf0f6;
  --panel: #ffffff;
  --panel-2: #f6f8fc;
  --ink: #101828;
  --muted: #667085;
  --line: #e0e5ee;
  --accent: #3b5bff;
  --accent-ink: #ffffff;
  --good: #12805c;
  --bad: #d92d20;
  --s1: #3b5bff;
  --s2: #f4694c;
  --s3: #0fa38f;
  --s4: #9b5de5;
  --s5: #e3a008;
  --s6: #64748b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --r: 16px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --panel: #141c2e;
    --panel-2: #19233a;
    --ink: #e8ecf5;
    --muted: #8d98ae;
    --line: #263049;
    --accent: #7b93ff;
    --accent-ink: #0b1120;
    --good: #35c79a;
    --bad: #ff7a6e;
    --s1: #7b93ff;
    --s2: #ff8a70;
    --s3: #35c7b1;
    --s4: #c08bff;
    --s5: #f0b429;
    --s6: #94a3b8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }

/* sidebar */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 22px 16px 18px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 210deg, var(--s1), var(--s2), var(--s3), var(--s1)); }
.brand-name { font: 600 15px/1 var(--display); letter-spacing: -.01em; }
.plist { display: flex; flex-direction: column; gap: 4px; }
.pitem { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 9px 10px; border: 1px solid transparent; border-radius: 12px; background: transparent; }
.pitem:hover { background: var(--panel-2); }
.pitem[aria-current=true] { background: var(--panel-2); border-color: var(--line); }
.av { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font: 600 13px/1 var(--display); color: #fff; }
.pn { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.add { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--ink); font-weight: 500; }
.add:hover { border-color: var(--accent); color: var(--accent); }
.reset { background: none; border: 0; padding: 4px; color: var(--muted); font-size: 12.5px; text-decoration: underline; text-align: left; }
.side-note { margin: auto 0 0; font-size: 12px; color: var(--muted); padding: 0 6px; }

/* main */
.main { padding: 26px clamp(16px, 3vw, 36px) 60px; display: flex; flex-direction: column; gap: 18px; min-width: 0; max-width: 1240px; width: 100%; }
.head { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: space-between; align-items: flex-end; }
.head h1 { font: 600 clamp(22px, 3vw, 30px)/1.15 var(--display); letter-spacing: -.02em; }
.head p { margin: 6px 0 0; }
.period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.seg-sm button { padding: 6px 10px; font-size: 13.5px; }
.dates { display: flex; align-items: center; gap: 6px; }
input[type=date], input[type=search], input[type=text], select { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 38px; }
select { padding-right: 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.hero { padding: clamp(16px, 2.4vw, 24px); min-width: 0; }
.hero-top { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: space-between; align-items: flex-start; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--muted); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.big { font: 600 clamp(34px, 6vw, 56px)/1.05 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.delta { margin-top: 6px; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.delta .up { color: var(--good); font-weight: 500; }
.delta .down { color: var(--bad); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; max-width: 28rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chart { position: relative; margin-top: 10px; min-height: 320px; }
.chart svg { display: block; width: 100%; height: 320px; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 400 11.5px var(--font); font-variant-numeric: tabular-nums; }
.chart .ax { stroke: var(--line); }
.hero > .small { margin-top: 8px; }

.tip { position: fixed; z-index: 30; pointer-events: none; opacity: 0; transition: opacity .08s; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip .h { opacity: .7; margin-bottom: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.tip .r i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font: 600 22px/1.2 var(--display); letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d .up { color: var(--good); }
.kpi .d .down { color: var(--bad); }

.reels-bar { display: flex; flex-wrap: wrap; gap: 12px 18px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.reels h2 { font: 600 20px/1.2 var(--display); letter-spacing: -.01em; }
.reels h2 .muted { font: 400 14px var(--font); letter-spacing: 0; margin-left: 6px; }
.reels-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reels-tools input[type=search] { width: 12rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 14px; }
.rc { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.rc:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.th { position: relative; aspect-ratio: 9 / 12; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; color: #fff; }
.th .chip { align-self: flex-start; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .32); }
.th .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: .9; }
.th .vv { position: relative; font: 600 20px/1 var(--display); letter-spacing: -.02em; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.th .vv small { display: block; font: 400 11.5px var(--font); letter-spacing: 0; opacity: .9; margin-top: 3px; }
.rb { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.rt { font-weight: 500; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.rp { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.rp i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rm { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rm span { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.rm svg { flex: none; }
.er { font-size: 12px; color: var(--muted); }
.er b { color: var(--ink); font-weight: 600; }

.tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:nth-child(-n+3), td:nth-child(-n+3) { text-align: left; }
th { font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; display: inline-block; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
td .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; }
.more-wrap { display: flex; justify-content: center; margin-top: 18px; }
.more { padding: 10px 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; }
.more:hover { border-color: var(--accent); color: var(--accent); }

dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--panel); color: var(--ink); width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 16, 30, .55); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font: 600 20px/1.2 var(--display); }
.f { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.f input { width: 100%; color: var(--ink); font-size: 15px; }
.err { margin: 0; font-size: 13.5px; color: var(--bad); }
.prog { margin: 0; font-size: 13.5px; color: var(--accent); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.primary, .ghost { padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); font-weight: 500; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: .6; cursor: default; }
.ghost { background: transparent; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 14px 12px; }
  .plist { flex-direction: row; overflow-x: auto; padding-bottom: 4px; gap: 8px; }
  .pitem { width: auto; flex: none; grid-template-columns: 32px auto; padding: 7px 12px 7px 8px; border-color: var(--line); }
  .pitem .pv, .pitem .ph { display: none; }
  .av { width: 32px; height: 32px; }
  .side-note { display: none; }
}
@media (max-width: 560px) {
  .seg button { padding: 7px 9px; font-size: 13.5px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rm { grid-template-columns: repeat(2, 1fr); }
  .reels-tools input[type=search] { width: 100%; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
