/* MagicWebinar — админка. Светлая и тёмная темы через CSS-переменные. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e9ef;
  --border-strong: #cfd8e2;
  --text: #16202b;
  --muted: #6a7888;
  --accent: #0b98b4;
  --accent-strong: #08809a;
  --accent-soft: #e2f5f9;
  --blue: #4f6bed;
  --blue-soft: #eceffd;
  --good: #12916a;
  --good-soft: #e1f5ec;
  --warn: #b06a00;
  --warn-soft: #fff3df;
  --bad: #cf3f3f;
  --bad-soft: #fdeaea;
  --neutral-soft: #edf0f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .04);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1318;
  --surface: #161d24;
  --surface-2: #1b232c;
  --border: #252f3a;
  --border-strong: #334150;
  --text: #e5ebf1;
  --muted: #8d9aa8;
  --accent: #22b4cf;
  --accent-strong: #44c6de;
  --accent-soft: #133a44;
  --blue: #8297ff;
  --blue-soft: #222a4d;
  --good: #3cc791;
  --good-soft: #143528;
  --warn: #f0a93b;
  --warn-soft: #3a2a10;
  --bad: #f07272;
  --bad-soft: #3d1b1d;
  --neutral-soft: #222b35;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
.mono, code { font-family: var(--mono); font-size: 12.5px; }

/* ---------- раскладка ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #19b5d3, #0a8aa5);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .01em; }
.brand-version {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 999px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 14px 10px 6px;
}
.nav-label:first-child { padding-top: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  color: var(--text); font-weight: 500; opacity: .86;
}
.nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .7; flex: none; }
.nav a:hover { background: var(--surface-2); opacity: 1; }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); opacity: 1; font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a.soon { opacity: .55; }
.nav a em {
  margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.license-banner { padding: 11px 28px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.license-banner a { font-weight: 600; text-decoration: underline; margin-left: 6px; }
.license-banner.tone-bad { background: var(--bad-soft); color: var(--bad); }
.license-banner.tone-warn { background: var(--warn-soft); color: var(--warn); }
.license-banner.tone-muted { background: var(--neutral-soft); color: var(--muted); }

.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1280px; width: 100%; }

/* ---------- карточки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { text-transform: uppercase; letter-spacing: .05em; font-size: 13px; color: var(--muted); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center;
}
.stat::after { content: ""; position: absolute; right: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--accent); opacity: .7; }
.stat-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.stat-icon svg { width: 21px; height: 21px; fill: currentColor; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-muted { background: var(--neutral-soft); color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 3px 0 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }

.status-list, .limits, .checklist { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.status-list li:last-child { border-bottom: 0; }
.status-list em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-good { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot-bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot-muted { background: var(--border-strong); }
.limits li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.limits li:last-child { border-bottom: 0; }
.checklist li { padding: 6px 0 6px 26px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 4px; color: var(--good); font-weight: 700; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: step; }
.steps li {
  counter-increment: step; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-strong);
  display: flex; flex-direction: column; gap: 4px;
}
.steps li::before { content: "Этап " counter(step); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.steps li span { color: var(--muted); font-size: 12.5px; }
.steps li.done { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.steps li.done::before { content: "Этап " counter(step) " · готово"; color: var(--accent-strong); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 10px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.row-off td { opacity: .55; }
.row-alert td { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-muted { background: var(--neutral-soft); color: var(--muted); }

/* ---------- кнопки и формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-logout { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-logout:hover { background: var(--bad-soft); }
.link { color: var(--accent); font-weight: 600; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], select {
  font: inherit; color: var(--text); background: var(--surface);
  height: 40px; padding: 0 12px; width: 100%;
  border: 1px solid var(--border); border-radius: 10px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; align-items: center; }

/* ---------- лицензия ---------- */
.summary { display: grid; grid-template-columns: 1fr 220px; gap: 24px; }
.summary-title { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.summary-title h2 { font-size: 18px; }
.summary .facts { margin-top: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.activation { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.activation-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.activation-icon svg { width: 28px; height: 28px; fill: currentColor; }
.activation h2 { font-size: 20px; }
.activation p { max-width: 520px; margin: 0; }
.activation-form { display: flex; gap: 10px; width: 100%; max-width: 560px; margin-top: 8px; }
.activation .activation-form { justify-content: center; }
.key-input { font-family: var(--mono) !important; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- сообщения ---------- */
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13.5px; }
.alert-ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); color: var(--good); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); margin-top: 14px; }
.alert-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.right { text-align: right; }
.empty { color: var(--muted); margin: 4px 0; }
.empty-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; }
.empty-state p { margin: 0; max-width: 520px; }
.empty-state .btn { margin-top: 10px; }

/* ---------- вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); padding: 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.public-card { max-width: 460px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-size: 16px; }
.login-brand span:not(.brand-mark) { color: var(--muted); font-size: 13px; }
.login-foot { margin: 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 14px; gap: 10px; }
  .brand { border: 0; padding: 0; }
  .brand-name, .brand-version, .nav-label, .nav a em, .nav a span { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { padding: 9px; }
  .nav a.soon { display: none; }
  .topbar { padding: 12px 16px; }
  .user-meta { display: none; }
  .user-chip { padding: 3px; }
  .license-banner { padding: 10px 16px; }
  .content { padding: 16px; }
  .summary { grid-template-columns: 1fr; }
  .summary .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .activation-form { flex-direction: column; }
}
@media (max-width: 520px) {
  .stats, .steps { grid-template-columns: 1fr; }
  .facts, .summary .facts { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 17px; }
}
