@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #09070f;
  --bg-elevated: #120d1e;
  --surface: #171029;
  --surface-hover: #201736;
  --border: #2a2044;
  --accent: #7c5cff;
  --accent-bright: #9b7dff;
  --accent-cyan: #22d3ee;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-grad: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  --live: #00e58a;
  --live-soft: rgba(0, 229, 138, 0.14);
  --text: #f3eefc;
  --text-dim: #a89dc4;
  --text-faint: #6c6088;
  --radius: 14px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(34, 211, 238, 0.10), transparent 55%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ==================== BRAND ==================== */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark-img {
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==================== AUTH SCREEN ==================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
}

.auth-card .brand { margin-bottom: 40px; }

.auth-step h1 {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.auth-sub {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 28px;
}
.auth-sub code {
  background: var(--accent-soft);
  color: var(--accent-bright);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
}

.btn-twitch {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent-grad);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-twitch:hover { filter: brightness(1.12); }
.btn-twitch:active { transform: scale(0.98); }

.auth-note {
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
  margin: 18px 0 0;
}

.code-form {
  display: flex;
  gap: 10px;
}
.code-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0.15em;
  text-align: center;
  outline: none;
}
.code-form input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent-grad);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 22px;
  font-weight: 600;
  font-size: 14px;
  transition: filter 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.12); }

.auth-error {
  color: #ff6b8a;
  font-size: 13.5px;
  margin: 12px 0 0;
}

.btn-ghost {
  width: 100%;
  margin-top: 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand { margin-bottom: 36px; padding-left: 4px; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-bright); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-hover);
  object-fit: cover;
}
.user-name { font-size: 14px; font-weight: 600; }
.user-tg { font-size: 12.5px; color: var(--text-faint); }

.content {
  flex: 1;
  padding: 40px 48px;
  max-width: 1100px;
}

.view-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.view-header-spaced { margin-top: 44px; }

.view-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.view-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
  grid-column: 1;
}

/* ==================== VIEWER: SUBSCRIPTIONS ==================== */
.sub-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sub-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.sub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.12);
}

.sub-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-hover);
  flex-shrink: 0;
}

.sub-info { flex: 1; min-width: 0; }
.sub-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.sub-name:hover { color: var(--accent-bright); text-decoration: underline; }
.sub-status {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.sub-status.live { color: var(--live); }

.sub-stats {
  display: flex;
  gap: 22px;
  text-align: right;
}
.sub-stat-value { font-size: 15px; font-weight: 700; font-family: var(--font-display); }
.sub-stat-label { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.empty-hint {
  color: var(--text-faint);
  font-size: 14px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ==================== TOP STREAMERS ==================== */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 4px;
}
.top-rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-faint);
  width: 22px;
}
.top-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
}
.top-bar-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 6px;
}
.top-hours {
  font-size: 13px;
  color: var(--text-dim);
  width: 70px;
  text-align: right;
}

/* ==================== STREAMER DASHBOARD ==================== */
.live-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.live-badge.offline { background: var(--surface); color: var(--text-faint); }
.live-badge.live { background: var(--live-soft); color: var(--live); }

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

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.action-card label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.action-row input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.action-row input:focus { border-color: var(--accent); }
.action-hint {
  flex: 1;
  color: var(--text-faint);
  font-size: 12.5px;
  margin: 0;
}

.btn-small {
  background: var(--accent-grad);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: filter 0.15s ease;
}
.btn-small:hover { filter: brightness(1.12); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.profile-stats-grid {
  grid-template-columns: repeat(4, 1fr);
  max-width: 720px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s ease;
}
.stat-card:hover { border-color: var(--accent); }
.stat-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; }

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  max-width: 420px;
  margin: 0 auto;
}
.empty-icon {
  font-size: 40px;
  color: var(--accent-bright);
  margin-bottom: 18px;
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 12px;
}
.empty-state p {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ==================== PROFILE ==================== */
.profile-card {
  display: flex;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 560px;
}
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-hover);
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.profile-name:hover { color: var(--accent-bright); }
.profile-badge {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.profile-rows { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.profile-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.profile-row-label { color: var(--text-faint); }
.profile-row-value { color: var(--text); font-weight: 500; }
.profile-link { text-decoration: none; }
.profile-link:hover { color: var(--accent-bright); text-decoration: underline; }
.profile-logout { margin-top: 24px; width: auto; padding: 10px 20px; }

/* ==================== PRICING ==================== */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 680px;
}
.plan-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.plan-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(124, 92, 255, 0.14); }
.plan-card-featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%);
}
.plan-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--accent-grad);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
}
.plan-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.plan-price {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 20px;
}
.plan-period { font-size: 15px; font-weight: 500; color: var(--text-faint); }
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.plan-features li {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
  padding-left: 22px;
  position: relative;
}
.plan-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-bright);
  font-weight: 700;
}
.soon-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 10px;
  vertical-align: middle;
}
.plan-btn {
  background: var(--surface-hover);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: not-allowed;
}
.plan-btn-featured {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--accent);
}

/* ==================== FEATURE PLAQUE (заглушки "в разработке") ==================== */
.feature-plaque {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
}
.feature-plaque-text { display: flex; flex-direction: column; gap: 3px; min-width: 200px; }
.feature-plaque-title { font-size: 14px; font-weight: 600; }
.feature-plaque-desc { font-size: 12.5px; color: var(--text-faint); }
.feature-plaque-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 22px;
  transition: background 0.15s ease;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-soft); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--accent-bright); }
.toggle-switch input:disabled + .toggle-slider { cursor: not-allowed; opacity: 0.6; }

/* ==================== INTEGRATIONS ==================== */
.integration-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 620px;
}
.integration-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.15s ease;
}
.integration-card:not(.integration-card-disabled):hover { border-color: var(--accent); }
.integration-card-disabled { opacity: 0.65; }
.integration-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.integration-icon-tg { background: #29a9eb; }
.integration-icon-discord { background: #5865f2; }
.integration-icon-youtube { background: #ff0033; }
.integration-icon-kick { background: #53fc18; color: #0d0a14; }
.integration-icon-obs { background: #302e3a; }
.integration-info { flex: 1; min-width: 0; }
.integration-name { font-size: 14.5px; font-weight: 600; }
.integration-status { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.integration-status-connected { color: var(--live); }
.integration-action { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

.btn-ghost-small {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost-small:hover { border-color: #ff6b8a; color: #ff6b8a; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 860px) {
  .dashboard { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
  }
  .sidebar .brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex: none; margin-left: auto; }
  .sidebar-footer { display: none; }
  .content { padding: 28px 20px; }
  .actions-grid, .stats-grid { grid-template-columns: 1fr; }
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-grid { grid-template-columns: 1fr; }
  .profile-card { flex-direction: column; align-items: flex-start; padding: 24px; }
  .feature-plaque { flex-direction: column; align-items: flex-start; }
  .integration-card { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
