/* Музоныч — админ-панель. Стиль в духе основного приложения. */
:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #2b2437;
  --muted: #6f6781;
  --brand: #7c3aed;
  --brand-dark: #6428cf;
  --brand-soft: #f1e9ff;
  --accent: #f59e0b;
  --accent-soft: #fef3d8;
  --ok: #16a34a;
  --danger: #dc2626;
  --line: #e4dcf2;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(43, 36, 55, .08);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: system-ui, 'Segoe UI', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ── Шапка ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e9e3f5;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo span { color: var(--brand); }
.logo .tag {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: #fff; border-radius: 6px; padding: 2px 8px; vertical-align: middle;
}
.topbar .spacer { flex: 1; }
.to-app { text-decoration: none; font-weight: 700; font-size: .95rem; }

.container { max-width: 980px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Карточки/кнопки ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card h2 { font-size: 1.15rem; margin: 0 0 14px; }
.card-head h2 { margin: 0; }
h1 { font-size: 1.6rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 1.02rem; }
.big-emoji { font-size: 3.4rem; margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 14px 26px;
  font-size: 1.05rem; font-weight: 700; transition: transform .1s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, .35); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn-sm { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ── Вкладки ── */
.tabs { display: flex; gap: 6px; background: #ece5f8; padding: 4px; border-radius: 999px; margin-bottom: 22px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.tabs button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 9px 22px; font-weight: 700; color: var(--muted);
}
.tabs button.active { background: var(--brand); color: #fff; }

/* ── Метрики ── */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.metric {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.metric .m-label { color: var(--muted); font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.metric .m-value { font-size: 1.7rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.metric.accent .m-value { color: var(--brand); }
.metric.money .m-value { color: var(--ok); }

/* ── Графики ── */
.chart { width: 100%; }
.chart svg { width: 100%; height: 180px; display: block; }
.chart .empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.bar { fill: var(--brand); }
.bar.accent { fill: var(--accent); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 11px; font-family: system-ui, 'Segoe UI', sans-serif; }
.line-path { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.line-dot { fill: var(--brand); }
.line-area { fill: var(--brand-soft); opacity: .55; }

.pay-stats { font-size: 1.02rem; }
.pay-stats b { color: var(--ink); }

/* ── Таблицы цен ── */
.table-wrap { overflow-x: auto; }
.pack-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.pack-table th {
  text-align: left; color: var(--muted); font-size: .82rem; font-weight: 700;
  padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
.pack-table td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pack-table input[type=text], .pack-table input[type=number] {
  width: 100%; border: 2px solid var(--line); border-radius: 10px;
  padding: 9px 10px; font: inherit; background: #fff; color: var(--ink);
}
.pack-table input:focus { outline: none; border-color: var(--brand); }
.pack-table .col-num input { width: 90px; }
.pack-table .col-hit { text-align: center; }
.pack-table .col-hit input { transform: scale(1.4); cursor: pointer; }
.row-del {
  border: 0; background: none; color: var(--danger); font-size: 1.1rem;
  padding: 6px 8px; border-radius: 8px; opacity: .7;
}
.row-del:hover { opacity: 1; background: rgba(220, 38, 38, .1); }

/* ── Настройки ── */
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 6px; max-width: 420px; }
.seg2 button {
  border: 2px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 12px; padding: 12px 8px; font-weight: 700; font-size: .95rem;
}
.seg2 button.selected { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.warn {
  background: var(--accent-soft); border-radius: 12px; padding: 12px 16px;
  color: #92600a; font-size: .92rem; margin: 12px 0 0;
}
.ok { color: #16a34a; font-weight: 700; }
.warn-inline { color: #d97706; font-weight: 700; }
label.field { display: block; font-weight: 700; margin: 0 0 16px; }
label.field input[type=number] {
  display: block; width: 200px; max-width: 100%; margin-top: 6px;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font: inherit; background: #fff; color: var(--ink); font-weight: 400;
}
label.field input:focus { outline: none; border-color: var(--brand); }

.ro-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.ro-list dt { color: var(--muted); font-weight: 600; }
.ro-list dd { margin: 0; font-weight: 700; word-break: break-word; }
.ro-list dd.on { color: var(--ok); }
.ro-list dd.off { color: var(--danger); }

/* ── Тост ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 22px;
  z-index: 100; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .metric .m-value { font-size: 1.4rem; }
}
