:root {
  color-scheme: light;
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #17227a;
  --accent-2: #2563eb;
  --accent-3: #1d4ed8;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 8px;
  font-size: 36px;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.status,
.meta,
.count {
  color: var(--muted);
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b6afa5;
}

.status-dot.ok {
  background: #16a34a;
}

.status-dot.error {
  background: #dc2626;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.4fr) auto;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0;
}

.filter-block {
  min-width: 0;
}

.filter-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-button,
#refreshButton {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-button.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.filter-button:not(.active):hover,
#refreshButton:hover {
  border-color: #c7d2fe;
  background: #f8faff;
}

.meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  min-height: 114px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  margin-top: 14px;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.kpi-delta {
  margin-top: auto;
  padding-top: 14px;
  font-size: 13px;
  font-weight: 800;
}

.kpi-delta.positive {
  color: #137044;
}

.kpi-delta.negative {
  color: #b42318;
}

.kpi-delta.neutral {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.platform-list,
.month-bars {
  padding: 8px 16px 16px;
}

.platform-row,
.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  color: var(--muted);
  font-size: 14px;
}

.platform-name {
  color: var(--ink);
  font-weight: 700;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}

.table-panel {
  margin-top: 12px;
}

.insights-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 22px;
}

.report-block {
  min-width: 0;
}

.report-heading {
  margin-bottom: 10px;
}

.report-heading h2 {
  color: #050505;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.95;
  font-weight: 900;
  text-transform: uppercase;
}

.report-heading p {
  width: min(720px, 100%);
  margin: 10px 0 0;
  color: #484848;
  font-size: 21px;
  line-height: 1.25;
}

.report-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 28px 30px 30px;
}

.report-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: #97166f;
}

.report-card-recommendations::before {
  background: #155a9e;
}

.insight-list {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 16px 0 0;
  list-style: none;
}

.insight-list li {
  position: relative;
  padding-left: 34px;
  color: #444;
  font-size: 20px;
  line-height: 1.35;
}

.insight-list li::before {
  content: "";
  position: absolute;
  top: 0.48em;
  left: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #97166f;
}

.insight-list strong {
  color: #15508e;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
}

th,
td {
  height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
  text-align: left;
}

tbody tr:hover {
  background: #f8faff;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
}

.pill.TELEGRAM {
  background: #2a84c8;
}

.pill.MAX {
  background: #272727;
}

.pill.VK {
  background: #4377b8;
}

.pill.INSTAGRAM {
  background: #d94b75;
}

.link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.empty-state {
  width: min(520px, calc(100% - 32px));
  margin: 80px auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

@media (max-width: 1060px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }

  .report-heading h2 {
    font-size: 48px;
  }
}

@media (max-width: 680px) {
  .app {
    width: min(100% - 20px, 1380px);
    padding-top: 18px;
  }

  .topbar,
  .filters {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    display: flex;
  }

  h1 {
    font-size: 28px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    min-height: 98px;
    padding: 14px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .platform-row,
  .bar-row {
    grid-template-columns: 90px 1fr auto;
  }

  .report-heading h2 {
    font-size: 34px;
  }

  .report-heading p {
    font-size: 16px;
  }

  .report-card {
    padding: 22px 16px 20px;
  }

  .insight-list {
    gap: 16px;
  }

  .insight-list li {
    padding-left: 24px;
    font-size: 16px;
  }
}

[hidden]{display:none!important}.login-panel{max-width:420px;margin:12vh auto;padding:32px;background:#fff;border:1px solid #e0e2e9;border-radius:16px}.login-panel h1{margin:16px 0;font-size:38px}.login-panel label{display:block;margin:24px 0 8px}.login-panel input{box-sizing:border-box;width:100%;padding:14px;border:1px solid #d5d7e0;border-radius:8px;font:inherit}.login-panel button,#logout{padding:12px 20px;background:#1f237b;color:#fff;border:0;border-radius:8px;cursor:pointer;font:inherit}.login-panel button{width:100%}#loginError{color:#b42318;min-height:1.4em}.session-info{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.login-panel .eyebrow{font-size:12px;color:#1f237b;font-weight:700}.login-panel p{line-height:1.5}@media(max-width:500px){.login-panel{margin:8vh 16px;padding:24px}.session-info{gap:8px}}
