:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe1ea;
  --accent: #0f6efd;
  --danger: #d92d20;
  --success: #16a34a;
  --sidebar-bg: linear-gradient(180deg, #111c2d 0%, #17263a 58%, #1d2e46 100%);
  --sidebar-border: rgba(255,255,255,.08);
  --sidebar-text: #c8d3e4;
  --sidebar-accent: #c9a25e;
  --card-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Manrope", "Segoe UI", system-ui, sans-serif; background: radial-gradient(circle at top right, #e7eefc, #f8fafc 40%, #eef2f8); color: var(--text); }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.sidebar {
  background: var(--sidebar-bg);
  color: #e5efff;
  padding: 22px 18px;
  transition: width .2s ease, padding .2s ease;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.03);
}
.sidebar-collapsed { width: 64px; overflow: hidden; }
.layout.layout-sidebar-hidden { grid-template-columns: 0 1fr; }
.layout.layout-sidebar-hidden .sidebar { width: 0; padding: 0; overflow: hidden; border: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  color: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 15px; letter-spacing: .02em; }
.brand-copy small { color: rgba(200,211,228,.72); font-size: 12px; }
.sidebar-caption {
  padding: 0 12px 8px;
  color: rgba(200,211,228,.62);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.sidebar nav { display: grid; gap: 8px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--sidebar-text);
  transition: background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  border: 1px solid transparent;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}
.nav-item-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.nav-item-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.9);
}
.nav-item-icon svg { width: 20px; height: 20px; }
.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #f7fafc;
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  color: #fff;
  border-color: rgba(201,162,94,.28);
  box-shadow: 0 0 0 1px rgba(201,162,94,.14), 0 12px 24px rgba(3,7,18,.18);
}
.nav-item.active::before {
  background: linear-gradient(180deg, #e3c28a, var(--sidebar-accent));
  box-shadow: 0 0 18px rgba(201,162,94,.5);
}
.nav-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #facc15;
  color: #172033;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(255,255,255,.12);
}

.main { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: rgba(255,255,255,.85); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-logout-form { margin: 0; }
.topbar-logout-btn { min-width: 92px; }
.content { padding: 20px; display: grid; gap: 16px; }

.login-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(14,116,144,.22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(15,110,253,.18), transparent 28%),
    linear-gradient(135deg, #07111f 0%, #0f1d31 48%, #13263f 100%);
  color: #e2e8f0;
}

.login-shell {
  width: min(1480px, 100%);
}

.login-showcase,
.login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 28px;
  backdrop-filter: blur(18px);
}

.login-showcase {
  padding: 42px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(250,204,21,.16), transparent 26%),
    linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  box-shadow: 0 30px 80px rgba(2,6,23,.36);
}

.login-showcase-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 560px);
  gap: 28px;
  align-items: center;
}

.login-showcase-panel {
  min-width: 0;
}

.login-showcase::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.24), rgba(14,165,233,0));
  pointer-events: none;
}

.login-showcase-mark {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  background: linear-gradient(135deg, #f8d26b, #f59e0b);
  box-shadow: 0 18px 35px rgba(245,158,11,.24);
}

.login-showcase-copy {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  max-width: 620px;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.login-showcase-copy h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 4.5vw, 58px);
  line-height: 1;
  letter-spacing: -.05em;
  color: #f8fafc;
}

.login-card {
  padding: 34px 32px 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: 0 30px 90px rgba(2,6,23,.3);
  color: var(--text);
}

.login-card-head h2 {
  margin: 14px 0 10px;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -.04em;
}

.login-card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15,110,253,.08);
  color: #0f6efd;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-alert {
  margin-top: 22px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(217,45,32,.18);
  background: linear-gradient(180deg, #fff5f4, #fff0ef);
  color: #9f1239;
}

.login-form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field span {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.login-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid #d7dfeb;
  border-radius: 16px;
  background: rgba(255,255,255,.95);
  color: #0f172a;
  font-size: 15px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.login-field input:focus {
  outline: none;
  border-color: rgba(15,110,253,.5);
  box-shadow: 0 0 0 4px rgba(15,110,253,.12);
  transform: translateY(-1px);
}

.login-submit {
  min-height: 54px;
  margin-top: 4px;
  border-radius: 16px;
  font-size: 15px;
  box-shadow: 0 18px 30px rgba(15,110,253,.18);
}

.login-note {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5eaf2;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.card { background: var(--card); border: 1px solid #e6eaf2; border-radius: 16px; padding: 16px; box-shadow: var(--card-shadow); }
.bento-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi .kpi-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi .kpi-value { font-size: 30px; font-weight: 800; margin-top: 8px; }

.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.toolbar, .tab-head, .actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-row input, .actions-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.btn-group { display: inline-flex; gap: 6px; }
.btn { border: 1px solid var(--line); padding: 8px 12px; border-radius: 12px; background: #fff; cursor: pointer; font-weight: 600; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease; }
.btn:hover { border-color: #9cb7e0; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(37,99,235,.12); }
.btn-active, .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.disabled, .btn:disabled { opacity: .55; pointer-events: none; box-shadow: none; }
.ghost { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 10px; cursor: pointer; }
.user-devices-list { display: grid; gap: 8px; width: 100%; }
.user-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.user-device-title {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.user-device-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff1f2;
  color: #be123c;
  cursor: pointer;
  flex: 0 0 auto;
}
.user-device-delete-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.user-device-delete-btn:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.dashboard-page {
  display: grid;
  gap: 18px;
}
.dashboard-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 24px;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.14), transparent 42%),
    linear-gradient(180deg, rgba(239,246,255,.98), rgba(255,255,255,.94));
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.12), rgba(59,130,246,0));
  pointer-events: none;
}
.dashboard-hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.dashboard-heading {
  display: grid;
  gap: 12px;
}
.dashboard-heading h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -.03em;
}
.dashboard-heading p {
  margin: 8px 0 0;
  max-width: 620px;
}
.dashboard-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 20px;
}
.dashboard-view-tab {
  position: relative;
  padding: 2px 0 10px;
  color: #7b8798;
  font-weight: 700;
}
.dashboard-view-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}
.dashboard-view-tab.active {
  color: #1e293b;
}
.dashboard-view-tab.active::after {
  background: linear-gradient(90deg, #2f6fed, #60a5fa);
}
.dashboard-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.dashboard-segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dfe7f2;
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.dashboard-segment {
  min-width: 58px;
  padding: 10px 14px;
  border-radius: 11px;
  color: #64748b;
  text-align: center;
  font-weight: 700;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.dashboard-segment.active {
  background: linear-gradient(180deg, #2f6fed, #2563eb);
  color: #fff;
  box-shadow: 0 10px 18px rgba(37,99,235,.22);
}
.dashboard-kpi-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-kpi-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 132px;
  padding: 20px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dashboard-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(15,23,42,.11);
}
.dashboard-kpi-card-actionable {
  cursor: pointer;
}
.dashboard-kpi-card-actionable:focus-visible {
  outline: 2px solid rgba(37,99,235,.4);
  outline-offset: 2px;
  border-color: rgba(37,99,235,.34);
}
.dashboard-kpi-copy {
  min-width: 0;
}
.dashboard-kpi-label {
  color: #7b8798;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dashboard-kpi-value {
  margin-top: 10px;
  font-size: 32px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #0f172a;
}
.dashboard-kpi-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dashboard-kpi-icon svg {
  width: 26px;
  height: 26px;
}
.dashboard-kpi-card-users-total .dashboard-kpi-icon { color: #2563eb; background: rgba(59,130,246,.14); }
.dashboard-kpi-card-paid-users .dashboard-kpi-icon { color: #0f766e; background: rgba(20,184,166,.14); }
.dashboard-kpi-card-payments-count-1d .dashboard-kpi-icon,
.dashboard-kpi-card-payments-count-24h .dashboard-kpi-icon,
.dashboard-kpi-card-payments-count-7d .dashboard-kpi-icon,
.dashboard-kpi-card-payments-count-30d .dashboard-kpi-icon { color: #1d4ed8; background: rgba(37,99,235,.14); }
.dashboard-kpi-card-revenue-1d .dashboard-kpi-icon,
.dashboard-kpi-card-revenue-24h .dashboard-kpi-icon,
.dashboard-kpi-card-revenue-7d .dashboard-kpi-icon,
.dashboard-kpi-card-revenue-30d .dashboard-kpi-icon { color: #7c3aed; background: rgba(124,58,237,.14); }
.dashboard-kpi-card-trials-started-1d .dashboard-kpi-icon,
.dashboard-kpi-card-trials-started-24h .dashboard-kpi-icon,
.dashboard-kpi-card-trials-started-7d .dashboard-kpi-icon,
.dashboard-kpi-card-trials-started-30d .dashboard-kpi-icon { color: #c2410c; background: rgba(249,115,22,.15); }
.dashboard-kpi-card-online-now .dashboard-kpi-icon { color: #15803d; background: rgba(34,197,94,.15); }
.dashboard-kpi-card-unpaid-device-attempts-1d .dashboard-kpi-icon,
.dashboard-kpi-card-unpaid-device-attempts-24h .dashboard-kpi-icon,
.dashboard-kpi-card-unpaid-device-attempts-7d .dashboard-kpi-icon,
.dashboard-kpi-card-unpaid-device-attempts-30d .dashboard-kpi-icon { color: #be185d; background: rgba(236,72,153,.14); }
.dashboard-kpi-card-webhook-errors-1d .dashboard-kpi-icon,
.dashboard-kpi-card-webhook-errors-24h .dashboard-kpi-icon,
.dashboard-kpi-card-webhook-errors-7d .dashboard-kpi-icon,
.dashboard-kpi-card-webhook-errors-30d .dashboard-kpi-icon { color: #b91c1c; background: rgba(239,68,68,.14); }
.dashboard-chart-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dashboard-chart-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 14px;
  border-radius: 18px;
  border: 1px solid #e4ebf7;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
.dashboard-chart-card::before {
  content: none;
}
.dashboard-chart-card-payments::before {
  display: none;
}
.dashboard-chart-card-users::before {
  background-position: center center;
  background-size: 86% auto;
  opacity: .1;
}
.dashboard-section-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.dashboard-section-head h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 700;
}
.dashboard-chart-note {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}
.dashboard-chart-wrap {
  position: relative;
  z-index: 1;
  min-height: 260px;
}
.dashboard-chart-wrap.is-empty::after {
  content: "Нет данных за период";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,.86), rgba(241,245,249,.92));
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.dashboard-chart-wrap canvas {
  width: 100% !important;
  height: 260px !important;
}
.dashboard-events-card {
  padding: 20px;
}
.dashboard-events-table-wrap {
  overflow: auto;
}
.dashboard-events-table {
  width: 100%;
  min-width: 760px;
}
.dashboard-events-table th,
.dashboard-events-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #ebeff6;
}
.dashboard-events-table thead th {
  color: #7b8798;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.dashboard-events-table tbody tr {
  transition: background-color .16s ease;
}
.dashboard-events-table tbody tr:hover {
  background: #fafcff;
}
.dashboard-event-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2ff;
  color: #315fe8;
}
.dashboard-event-pill-scope {
  background: #eef2f7;
  color: #334155;
}
.dashboard-event-pill-payment-succeeded,
.dashboard-event-pill-payment-success {
  background: rgba(34,197,94,.14);
  color: #166534;
}
.dashboard-event-pill-trial-started {
  background: rgba(249,115,22,.14);
  color: #9a3412;
}
.dashboard-event-pill-webhook-auth-fail,
.dashboard-event-pill-webhook-processing-error {
  background: rgba(239,68,68,.14);
  color: #991b1b;
}
.dashboard-event-pill-device-unpaid-attempt {
  background: rgba(236,72,153,.14);
  color: #9d174d;
}
.dashboard-event-pill-user-subscription-refresh {
  background: rgba(14,165,233,.14);
  color: #0f766e;
}
.dashboard-event-pill-system-task,
.dashboard-event-pill-system-event {
  background: rgba(148,163,184,.18);
  color: #475569;
}
.dashboard-event-pill-support-action {
  background: rgba(168,85,247,.14);
  color: #7c3aed;
}
.dashboard-event-subtype {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.3;
}
.event-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.event-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: #0f172a;
}
.event-title .tag {
  margin-left: 6px;
  vertical-align: middle;
}
.event-repeat-stack {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}
.event-repeat-stack[open] {
  display: block;
  margin: 10px 0 0;
}
.event-repeat-toggle {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.event-repeat-toggle.event-repeat-toggle-hot {
  background: #fef3c7;
  color: #92400e;
}
.event-repeat-toggle::-webkit-details-marker {
  display: none;
}
.event-repeat-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.event-repeat-card {
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.event-repeat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.event-repeat-time {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.event-repeat-title {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.event-preview {
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
}
.event-level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #dbeafe;
  color: #1d4ed8;
}
.event-level-debug {
  background: #e0f2fe;
  color: #075985;
}
.event-level-info {
  background: #dbeafe;
  color: #1d4ed8;
}
.event-level-success {
  background: #dcfce7;
  color: #166534;
}
.event-level-warn {
  background: #fef3c7;
  color: #92400e;
}
.event-level-error {
  background: #fee2e2;
  color: #991b1b;
}
.payments-monthly-chart-card {
  padding: 18px 20px 16px;
}
.dashboard-event-meta {
  margin: 0;
  max-width: 420px;
  max-height: 4.5em;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #475569;
  background: #f8fbff;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  padding: 10px 12px;
}
.dashboard-user-link {
  color: #1d4ed8;
  font-weight: 700;
}
.dashboard-user-link:hover {
  color: #1e40af;
  text-decoration: underline;
}
.dashboard-users-dialog {
  width: min(980px, 96vw);
  max-width: 980px;
  max-height: min(86vh, 900px);
  padding: 0;
  overflow: hidden;
}
.dashboard-users-dialog[open] {
  display: flex;
  flex-direction: column;
}
.dashboard-users-dialog::backdrop {
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
}
.dashboard-users-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.12), transparent 42%),
    linear-gradient(180deg, #f8fbff, #ffffff);
}
.dashboard-users-dialog-head h3 {
  margin: 0;
}
.dashboard-users-dialog-head p {
  margin: 6px 0 0;
}
.dashboard-users-dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.dashboard-users-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px 20px;
  overflow: auto;
  overscroll-behavior: contain;
}
.dashboard-users-table-wrap {
  overflow-x: auto;
}
.dashboard-users-table td {
  white-space: nowrap;
}
.dashboard-users-tg-id,
.dashboard-users-payment-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.tag { background: #edf2ff; color: #1d4ed8; padding: 3px 8px; border-radius: 999px; font-size: 12px; }

.pre-mini { max-width: 300px; overflow: auto; max-height: 80px; font-size: 12px; white-space: pre-wrap; }
.pre-big { max-height: 380px; overflow: auto; font-size: 12px; white-space: pre-wrap; background: #0b1220; color: #dbeafe; border-radius: 10px; padding: 12px; }
.event-facts {
  display: grid;
  gap: 8px;
}
.event-fact {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #e8edf5;
  border-radius: 10px;
  background: #f8fbff;
}
.event-fact span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #94a3b8;
}
.event-fact strong {
  font-size: 12px;
  line-height: 1.4;
  color: #334155;
  word-break: break-word;
}
.event-raw-meta {
  margin-top: 10px;
}
.event-raw-meta summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.event-meta-pretty {
  margin-top: 8px;
  margin-bottom: 0;
  max-width: 100%;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 14px; width: min(680px, 92vw); }
.app-log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.app-log-head h3 { margin: 0; }
.app-log-cards { display: grid; gap: 10px; max-height: 520px; overflow: auto; padding-right: 2px; }
.app-log-card {
  border: 1px solid var(--line);
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.app-log-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.app-log-emoji { font-size: 18px; line-height: 1; }
.app-log-level {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}
.app-log-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.app-log-message { font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.app-log-source {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.app-log-raw { margin-top: 8px; }
.app-log-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.app-log-raw .pre-big { margin-top: 8px; max-height: 140px; margin-bottom: 0; }
.app-log-debug { border-left-color: #0ea5e9; }
.app-log-warn { border-left-color: #f59e0b; }
.app-log-error { border-left-color: #dc2626; }
.app-log-success { border-left-color: #16a34a; }
.app-log-warn .app-log-level { background: #fef3c7; color: #92400e; }
.app-log-error .app-log-level { background: #fee2e2; color: #991b1b; }
.app-log-success .app-log-level { background: #dcfce7; color: #166534; }
.app-log-debug .app-log-level { background: #e0f2fe; color: #075985; }

.kv { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 6px 0; }
.kv span { color: var(--muted); }
.copy-card-button {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed #bfd0e8;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.copy-card-button:hover {
  transform: translateY(-1px);
  border-color: #8eb3ea;
  box-shadow: 0 10px 22px rgba(37,99,235,.12);
}
.copy-card-button code {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #0f172a;
}
.copy-card-hint {
  color: #31507f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.form-grid { display: grid; gap: 8px; }
.form-grid input, .form-grid textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.form-grid select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.payments-cashback-card {
  display: grid;
  gap: 12px;
  background:
    radial-gradient(circle at top right, rgba(22,163,74,.08), transparent 28%),
    linear-gradient(180deg, #ffffff, #f8fbff);
}
.payments-cashback-switch {
  align-items: flex-start;
}
.payments-cashback-tag-on {
  background: #e8fff1;
  color: #15803d;
}
.payments-cashback-tag-off {
  background: #f1f5f9;
  color: #475569;
}
.payments-cashback-mode-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.payments-cashback-mode-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  cursor: pointer;
}
.payments-cashback-mode-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
}
.payments-cashback-mode-copy {
  display: grid;
  gap: 4px;
}
.payments-cashback-mode-copy strong {
  color: #0f172a;
  font-size: 14px;
}
.payments-cashback-mode-copy span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input[type="hidden"] { display: none; }
.users-id-link {
  display: inline-grid;
  gap: 2px;
}
.users-id-primary {
  color: #0f172a;
  font-weight: 800;
}
.users-id-secondary {
  color: #315fe8;
  font-size: 13px;
  font-weight: 700;
}
.flow-builder { display: grid; gap: 8px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; }

.flow-svg rect { fill: #f8fafc; stroke: #0f6efd; stroke-width: 1.5; }
.flow-svg path { stroke: #0f6efd; stroke-width: 2; fill: none; }
.flow-svg text { font-size: 12px; fill: #0f172a; }

.tabs .tab-body { margin-top: 12px; }
.muted { color: var(--muted); }
.suspicious-head { justify-content: space-between; align-items: center; }
.suspicious-buttons-block {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.suspicious-buttons-list { display: grid; gap: 8px; }
.suspicious-button-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px minmax(220px, 1.3fr) auto;
  align-items: center;
}
.suspicious-row-warned td { background: #fff8e7; }
.suspicious-warn-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}
.suspicious-source-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.suspicious-source-ip {
  background: #dbeafe;
  color: #1d4ed8;
}
.suspicious-source-happ {
  background: #dcfce7;
  color: #166534;
}
.suspicious-ip-list { display: grid; gap: 4px; max-width: 320px; }
.suspicious-ip-list code {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.header-settings-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.header-badges { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.header-settings-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.header-settings-card h4 { margin-top: 0; margin-bottom: 10px; }
.header-settings-map { grid-column: 1 / -1; }
.header-settings-map textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.header-settings-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.support-page {
  display: grid;
  gap: 14px;
}
.support-settings-card {
  background:
    radial-gradient(circle at top right, rgba(15,110,253,.14), transparent 48%),
    linear-gradient(180deg, #ffffff, #f8fbff);
}
.support-settings-head {
  justify-content: space-between;
  align-items: center;
}
.support-settings-form input {
  min-width: 280px;
  flex: 1;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.support-settings-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.support-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.support-badge-online {
  background: #dcfce7;
  color: #166534;
}
.support-badge-offline {
  background: #fee2e2;
  color: #991b1b;
}

.support-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 62vh;
}
.support-threads-card,
.support-chat-card {
  display: flex;
  flex-direction: column;
  min-height: 62vh;
}
.support-threads-toolbar {
  margin-bottom: 10px;
}
.support-threads-toolbar input {
  flex: 1;
  min-width: 160px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.support-empty {
  padding: 8px 2px;
}
.support-threads-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.support-thread-card {
  border: 1px solid var(--line);
  border-left: 4px solid #16a34a;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  cursor: pointer;
}
.support-thread-card.waiting {
  border-left-color: #dc2626;
}
.support-thread-card.active {
  border-color: #0f6efd;
  box-shadow: 0 0 0 2px rgba(15,110,253,.16);
}
.support-thread-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.support-thread-user {
  font-weight: 700;
}
.support-thread-meta {
  font-size: 12px;
  color: var(--muted);
}
.support-thread-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.support-thread-preview {
  margin-top: 6px;
  color: #334155;
  font-size: 13px;
  line-height: 1.3;
  word-break: break-word;
  white-space: pre-wrap;
}
.support-thread-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.support-thread-footer .support-thread-delete {
  padding: 5px 8px;
  font-size: 11px;
}
.support-tag-list {
  display: inline-flex;
  gap: 6px;
}
.support-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.support-tag-urgent {
  background: #fee2e2;
  color: #991b1b;
}
.support-tag-payment {
  background: #ffedd5;
  color: #9a3412;
}
.support-waiting {
  font-size: 12px;
  font-weight: 700;
  margin-right: auto;
}
.support-waiting-on {
  color: #dc2626;
}
.support-waiting-off {
  color: #16a34a;
}

.support-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.support-chat-title-wrap h3 {
  margin: 0;
}
.support-user-link {
  font-weight: 700;
  color: #0f6efd;
  text-decoration: none;
}
.support-user-link:hover {
  text-decoration: underline;
}
.support-chat-messages {
  flex: 1;
  min-height: 280px;
  max-height: 62vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background:
    radial-gradient(circle at top left, rgba(15,110,253,.08), transparent 45%),
    #f8fbff;
  display: grid;
  gap: 8px;
}
.support-msg {
  max-width: 82%;
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 10px rgba(15,23,42,.05);
}
.support-msg-user {
  justify-self: flex-start;
  border-left: 4px solid #f59e0b;
}
.support-msg-admin {
  justify-self: flex-end;
  border-left: 4px solid #16a34a;
  background: #ecfdf3;
}
.support-msg-system {
  justify-self: center;
  border-left: 4px solid #0ea5e9;
}
.support-msg-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.support-msg-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.support-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.support-msg-attachment {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.support-msg-media-link {
  display: inline-block;
  max-width: min(360px, 100%);
  margin-bottom: 6px;
}
.support-msg-media {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.support-msg-media-file {
  margin-bottom: 6px;
}
.support-msg-media-file a {
  font-weight: 600;
}
.support-msg-delete {
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
}
.support-reply-form {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.support-reply-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.support-reply-attachments {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.support-reply-attachments input[type="file"] {
  display: none;
}

.broadcasts-page {
  display: grid;
  gap: 14px;
}
.broadcasts-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  background:
    radial-gradient(circle at top right, rgba(15,110,253,.12), transparent 55%),
    linear-gradient(180deg, #ffffff, #f8fbff);
}
.broadcasts-kpis {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}
.broadcast-kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}
.broadcast-kpi-label {
  color: var(--muted);
  font-size: 12px;
}
.broadcast-kpi-value {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
}
.broadcast-message-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.broadcast-message-toggle:hover {
  border-color: rgba(37, 99, 235, 0.38);
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}
.broadcast-message-toggle[aria-expanded="true"] {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
}
.broadcast-message-row.hidden {
  display: none;
}
.broadcast-message-cell {
  padding: 0 14px 14px;
  background: #f8fafc;
}
.broadcast-message-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 45%),
    linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}
.broadcast-message-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}
.broadcast-message-card-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: .01em;
}
.broadcast-message-card-meta {
  color: var(--muted);
  font-size: 12px;
}
.broadcast-message-card-body {
  margin: 0;
  padding: 0 16px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: #0f172a;
}

.nodes-page {
  display: grid;
  gap: 18px;
}
.nodes-kpi-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.nodes-kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 118px;
  padding: 20px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.nodes-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15,23,42,.12);
}
.nodes-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
}
.nodes-kpi-icon svg { width: 22px; height: 22px; }
.nodes-kpi-icon-primary { color: #315fe8; background: rgba(47,111,237,.12); }
.nodes-kpi-icon-blue { color: #2563eb; background: rgba(59,130,246,.13); }
.nodes-kpi-icon-success { color: #15803d; background: rgba(34,197,94,.14); }
.nodes-kpi-icon-danger { color: #dc2626; background: rgba(239,68,68,.14); }
.nodes-kpi-copy { min-width: 0; }
.nodes-kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.nodes-kpi-value {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -.03em;
}
.nodes-info-card {
  padding: 18px 20px;
}
.nodes-info-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.nodes-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.nodes-card-heading h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}
.nodes-card-heading p {
  margin: 6px 0 0;
}
.nodes-main-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 1fr) minmax(0, 2fr);
  align-items: start;
}
.nodes-form-card {
  overflow: hidden;
}
.nodes-table-card {
  overflow: visible;
}
.nodes-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.nodes-form-grid {
  display: grid;
  gap: 14px;
}
.nodes-form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nodes-field {
  display: grid;
  gap: 8px;
}
.nodes-field > span {
  font-size: 13px;
  font-weight: 700;
  color: #344256;
}
.nodes-domain-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nodes-domain-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}
.nodes-domain-status svg {
  width: 16px;
  height: 16px;
}
.nodes-domain-status-ok {
  color: #15803d;
}
.nodes-domain-status-error {
  color: #b91c1c;
}
.nodes-domain-status-muted {
  color: #64748b;
}
.nodes-field input,
.nodes-search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid #dbe2ed;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.nodes-field input:focus,
.nodes-search input:focus {
  outline: none;
  border-color: #6b9cff;
  box-shadow: 0 0 0 4px rgba(47,111,237,.12);
}
.nodes-input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.nodes-switches-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nodes-switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid #e6ebf3;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.nodes-switch-copy {
  font-weight: 700;
  color: #223046;
}
.switch {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d8e0ec;
  transition: background-color .18s ease;
  pointer-events: none;
}
.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15,23,42,.15);
  transition: transform .18s ease;
}
.switch input:checked + .switch-slider {
  background: linear-gradient(90deg, #2f6fed, #3b82f6);
}
.switch input:checked + .switch-slider::after {
  transform: translateX(20px);
}
.switch input:disabled + .switch-slider {
  opacity: .65;
}
.nodes-form-actions {
  display: grid;
  gap: 10px;
}
.nodes-btn-block {
  width: 100%;
  min-height: 44px;
}
.nodes-btn-secondary {
  min-height: 44px;
  background: #f8fbff;
}
.nodes-btn-medium {
  min-height: 42px;
  padding-inline: 16px;
  white-space: nowrap;
}
.nodes-table-card {
  position: relative;
  isolation: isolate;
}
.nodes-table-card::before {
  content: "";
  position: absolute;
  inset: auto -80px 18px auto;
  width: 380px;
  height: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 360'%3E%3Cg fill='%2390A4C5'%3E%3Cpath d='M56 146l36-24 27 7 19 22 37 3 39-21 34 7 7 17-21 17-52 11-55 32-38-8-33-26z'/%3E%3Cpath d='M281 96l46-25 75 9 21 18 51 4 31 21-11 27-58 22-56-2-37-18-49 8-29-19 5-25z'/%3E%3Cpath d='M435 207l39-10 32 10 17 24 45 8 33 26-17 24-74 5-45-19-33 12-31-26 12-26z'/%3E%3Cpath d='M227 212l36-12 24 10 18 27-15 24-39 9-34-18-8-24z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .1;
  pointer-events: none;
  z-index: -1;
}
.nodes-table-header,
.nodes-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nodes-table-toolbar {
  margin-top: 18px;
  margin-bottom: 14px;
}
.nodes-toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nodes-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #dbe2ed;
  background: #fff;
  color: #344256;
  font-weight: 700;
}
.nodes-chip-muted {
  background: #f8fbff;
  color: var(--muted);
}
.nodes-search {
  position: relative;
  width: min(320px, 100%);
}
.nodes-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: #7b8aa0;
  transform: translateY(-50%);
  pointer-events: none;
}
.nodes-search-icon svg { width: 18px; height: 18px; }
.nodes-search input {
  padding-left: 38px;
  background: rgba(255,255,255,.94);
}
.nodes-table-wrap {
  overflow: auto;
}
.nodes-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.nodes-table th,
.nodes-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #edf1f7;
  word-break: break-word;
}
.nodes-table thead th {
  color: #7b8798;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.nodes-table tbody tr {
  transition: background-color .16s ease;
}
.nodes-table tbody tr:hover {
  background: rgba(248,251,255,.9);
}
.nodes-id-cell {
  color: #5b6b7f;
  font-weight: 700;
  white-space: nowrap;
}
.nodes-node-cell {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.nodes-node-flag {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: linear-gradient(180deg, #f7faff, #eef4fd);
  border: 1px solid #e0e8f4;
  font-size: 12px;
  font-weight: 700;
  color: #2a3a53;
  text-align: center;
  overflow: hidden;
  word-break: break-word;
}
.nodes-node-copy {
  min-width: 0;
}
.nodes-node-copy strong {
  word-break: break-word;
}
.nodes-node-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.nodes-soft-tag {
  background: #f7f5ef;
  color: #8a6427;
}
.nodes-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.nodes-status-pill-online {
  background: rgba(34,197,94,.14);
  color: #166534;
}
.nodes-status-pill-error {
  background: rgba(239,68,68,.14);
  color: #b91c1c;
}
.nodes-status-pill-muted {
  background: #eef2f7;
  color: #5f6c80;
}
.nodes-meta-stack {
  margin-top: 10px;
}
.nodes-paths {
  display: grid;
  gap: 8px;
  color: #314156;
}
.nodes-paths .muted {
  display: inline-block;
  min-width: 48px;
}
.nodes-health-main {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
}
.nodes-actions-cell {
  width: 156px;
}
.nodes-action-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.nodes-actions-cell form {
  margin: 0;
}
.nodes-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #dbe2ed;
  background: rgba(255,255,255,.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease, color .16s ease;
  list-style: none;
}
.nodes-icon-btn svg { width: 16px; height: 16px; }
.nodes-icon-btn:hover {
  transform: translateY(-1px);
  border-color: #a9bddf;
  background: #f8fbff;
  color: #1d4ed8;
}
.nodes-icon-btn-danger:hover {
  border-color: rgba(217,45,32,.32);
  background: rgba(254,242,242,.95);
  color: #b42318;
}
.nodes-edit-details {
  position: relative;
}
.nodes-edit-details summary::-webkit-details-marker { display: none; }
.nodes-edit-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(480px, calc(100vw - 80px));
  padding: 16px;
  border: 1px solid #dfe6f0;
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 20px 36px rgba(15,23,42,.16);
  backdrop-filter: blur(16px);
  z-index: 4;
}
.nodes-edit-form {
  display: grid;
  gap: 12px;
}
.nodes-inline-actions {
  display: flex;
  justify-content: flex-end;
}
.nodes-empty-state {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

.broadcasts-gift-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.broadcast-gift-fields {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fbfdff;
}
.broadcast-conditional-fields {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fbfdff;
  overflow: hidden;
  max-height: 160px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height .22s ease, opacity .18s ease, transform .18s ease, padding .18s ease, margin .18s ease;
}
.broadcast-conditional-fields.is-hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  padding-top: 0;
  padding-bottom: 0;
  margin-top: -6px;
  border-width: 0;
  pointer-events: none;
}

.toast { position: fixed; right: 18px; bottom: 18px; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: all .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1024px) {
  .login-body {
    padding: 18px;
  }
  .login-shell {
    width: min(860px, 100%);
  }
  .login-showcase {
    min-height: auto;
    justify-content: center;
  }
  .login-showcase {
    padding: 28px;
  }
  .login-showcase-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .login-showcase-panel {
    display: grid;
    gap: 18px;
  }
  .login-card {
    padding: 26px 20px 22px;
  }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    top: 0;
    z-index: 30;
    padding: 12px;
  }
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .nav-item {
    margin-bottom: 0;
    min-height: 44px;
  }
  .nav-item-main {
    min-width: 0;
  }
  .topbar {
    padding: 12px;
    flex-wrap: wrap;
  }
  .topbar-title { font-size: 18px; }
  .content {
    padding: 12px;
    gap: 12px;
  }
  .card {
    padding: 12px;
    border-radius: 12px;
    overflow-x: auto;
  }
  .grid-two { grid-template-columns: 1fr; }
  .header-settings-layout { grid-template-columns: 1fr; }
  .header-settings-hero { flex-direction: column; align-items: flex-start; }
  .toolbar,
  .tab-head,
  .actions-row,
  .inline-form,
  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }
  .actions-row input,
  .actions-row select,
  .actions-row .btn,
  .actions-row .ghost,
  .inline-form input,
  .inline-form select,
  .inline-form .btn,
  .btn-group .btn {
    width: 100%;
  }
  .table {
    min-width: 760px;
  }
  .pre-mini,
  .pre-big {
    max-width: none;
  }
  .kv {
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
  .suspicious-button-row { grid-template-columns: 1fr; }
  .support-settings-meta { grid-template-columns: 1fr; }
  .support-layout { grid-template-columns: 1fr; }
  .support-threads-card, .support-chat-card { min-height: auto; }
  .support-chat-messages { max-height: 48vh; }
  .support-msg { max-width: 92%; }
  .broadcasts-hero { flex-direction: column; }
  .broadcasts-kpis { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hero-main,
  .dashboard-section-head,
  .dashboard-table-head,
  .dashboard-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-kpi-grid,
  .dashboard-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-users-dialog-head {
    flex-direction: column;
  }
  .dashboard-users-dialog-actions {
    justify-content: flex-start;
  }
  .dashboard-chart-wrap,
  .dashboard-chart-wrap canvas {
    min-height: 260px;
    height: 260px !important;
  }
  .nodes-kpi-grid,
  .nodes-main-grid,
  .nodes-form-grid-2,
  .nodes-switches-grid {
    grid-template-columns: 1fr;
  }
  .nodes-table-header,
  .nodes-table-toolbar,
  .nodes-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .nodes-search {
    width: 100%;
  }
  .nodes-btn-medium {
    width: 100%;
    white-space: normal;
  }
  .nodes-input-with-button {
    grid-template-columns: 1fr;
  }
  .nodes-table-wrap {
    overflow: visible;
  }
  .nodes-table,
  .nodes-table tbody,
  .nodes-table tr,
  .nodes-table td {
    display: block;
  }
  .nodes-table thead {
    display: none;
  }
  .nodes-table tbody {
    display: grid;
    gap: 12px;
  }
  .nodes-table tbody tr {
    border: 1px solid #e8edf5;
    border-radius: 16px;
    padding: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 20px rgba(15,23,42,.05);
  }
  .nodes-table td {
    padding: 0;
    border: 0;
  }
  .nodes-table td + td {
    margin-top: 12px;
  }
  .nodes-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: #7b8798;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .nodes-id-cell {
    font-size: 18px;
  }
  .nodes-actions-cell {
    width: auto;
  }
  .nodes-action-group {
    align-items: stretch;
  }
  .nodes-edit-details {
    flex: 1 1 100%;
  }
  .nodes-edit-details > summary.nodes-icon-btn,
  .nodes-actions-cell form,
  .nodes-actions-cell form .nodes-icon-btn {
    width: 100%;
  }
  .nodes-edit-panel {
    position: static;
    width: 100%;
    margin-top: 10px;
  }
}

@media (max-width: 720px) {
  .login-body {
    padding: 12px;
  }
  .login-showcase,
  .login-card {
    border-radius: 22px;
  }
  .login-showcase-copy h1 {
    font-size: 32px;
  }
  .login-card-head h2 {
    font-size: 28px;
  }
  .login-showcase {
    min-height: auto;
    padding: 20px;
  }
  .login-showcase-layout {
    gap: 16px;
  }
  .login-card {
    padding: 22px 16px 18px;
  }
  .dashboard-hero {
    padding: 18px 16px;
  }
  .dashboard-heading h1 {
    font-size: 30px;
  }
  .dashboard-view-tabs,
  .dashboard-segmented-control {
    width: 100%;
  }
  .dashboard-view-tabs {
    gap: 16px;
    overflow: auto;
    padding-bottom: 2px;
  }
  .dashboard-segmented-control {
    justify-content: space-between;
  }
  .dashboard-segment {
    flex: 1 1 0;
    min-width: 0;
  }
  .dashboard-kpi-grid,
  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-kpi-card {
    min-height: 118px;
    padding: 18px;
  }
  .dashboard-kpi-value {
    font-size: 28px;
  }
  .dashboard-events-table-wrap {
    overflow: visible;
  }
  .dashboard-events-table,
  .dashboard-events-table tbody,
  .dashboard-events-table tr,
  .dashboard-events-table td {
    display: block;
    min-width: 0;
  }
  .dashboard-events-table thead {
    display: none;
  }
  .dashboard-events-table tbody {
    display: grid;
    gap: 12px;
  }
  .dashboard-events-table tbody tr {
    border: 1px solid #e8edf5;
    border-radius: 16px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15,23,42,.05);
  }
  .dashboard-events-table td {
    padding: 0;
    border: 0;
  }
  .dashboard-events-table td + td {
    margin-top: 10px;
  }
  .dashboard-events-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: #7b8798;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .dashboard-event-meta {
    max-width: 100%;
  }
  .dashboard-users-dialog {
    width: min(100vw, 100vw);
    max-width: 100vw;
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .dashboard-users-dialog-head,
  .dashboard-users-dialog-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .dashboard-users-dialog-actions {
    width: 100%;
  }
  .dashboard-users-dialog-actions .btn,
  .dashboard-users-dialog-actions form {
    flex: 1 1 auto;
  }
  .dashboard-users-dialog-actions form .btn {
    width: 100%;
  }
}

.builder-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.builder-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.builder-layout { display: grid; gap: 14px; grid-template-columns: 250px 1fr 320px; min-height: 70vh; }
.builder-left, .builder-center, .builder-right { min-height: 68vh; }
.builder-blocks { display: grid; gap: 8px; }
.builder-blocks .btn { text-align: left; }
.builder-canvas-toolbar { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
#builder-canvas-wrapper {
  position: relative;
  height: calc(68vh - 60px);
  border: 1px dashed var(--line);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(148,163,184,.12) 1px, transparent 1px),
    linear-gradient(rgba(148,163,184,.12) 1px, transparent 1px);
  background-size: 30px 30px;
}
#builder-edges-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#builder-nodes-layer { position: absolute; inset: 0; transform-origin: 0 0; }
.builder-node {
  position: absolute;
  min-width: 180px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15,23,42,.09);
  user-select: none;
  cursor: grab;
}
.builder-node.active { border-color: #0f6efd; box-shadow: 0 0 0 2px rgba(15,110,253,.15), 0 8px 20px rgba(15,23,42,.09); }
.builder-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fbff;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  font-size: 12px;
  color: var(--muted);
}
.builder-node-title { padding: 9px 10px; font-weight: 700; }
.builder-node-subtitle { padding: 0 10px 10px 10px; font-size: 12px; color: var(--muted); }
.builder-port {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #0f6efd;
  color: #0f6efd;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
}
.builder-port.connecting { background: #0f6efd; color: #fff; }
.builder-edge {
  stroke: #0ea5e9;
  stroke-width: 2;
  fill: none;
  marker-end: url(#builder-arrowhead);
}
.hidden { display: none !important; }

@media (max-width: 1280px) {
  .builder-layout { grid-template-columns: 1fr; }
  .builder-left, .builder-right, .builder-center { min-height: auto; }
  #builder-canvas-wrapper { height: 62vh; }
}
