:root {
  --bg: #050707;
  --bg-2: #101314;
  --panel: rgba(10, 12, 12, 0.84);
  --panel-strong: rgba(18, 22, 21, 0.94);
  --border: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f5ef;
  --muted: #b7bdb9;
  --accent: #6bbd56;
  --accent-strong: #7cd164;
  --accent-deep: #244f27;
  --accent-soft: rgba(107, 189, 86, 0.16);
  --shadow: 0 32px 100px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(107, 189, 86, 0.18), transparent 24%),
    radial-gradient(circle at 85% 14%, rgba(118, 35, 93, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(16, 97, 48, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.42)),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1px, transparent 1px, transparent 25%),
    linear-gradient(rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 25%);
  background-size: 240px 240px;
  opacity: 0.22;
  mask-image: linear-gradient(180deg, black, rgba(0, 0, 0, 0.25));
}

body::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 14%, transparent 86%, rgba(107, 189, 86, 0.08)),
    radial-gradient(circle at center, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.28));
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 32px;
}

.dashboard-shell {
  padding: 0 0 40px;
}

.stage,
.dashboard-stage {
  width: 100%;
  max-width: 720px;
}

.dashboard-stage {
  width: min(calc(100% - 64px), 1400px);
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 18px;
}

.panel,
.dashboard-panel {
  position: relative;
  overflow: hidden;
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel::before,
.dashboard-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.brand-stack {
  display: grid;
  gap: 6px;
  margin-bottom: 36px;
}

.brand-kicker,
.identity-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-mark {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(2.75rem, 7vw, 4.8rem);
  line-height: 0.94;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.brand-mark.compact {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  white-space: nowrap;
}

.copy-block {
  display: grid;
  gap: 12px;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line);
}

.page-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 20px 32px 12px;
  background: linear-gradient(180deg, rgba(5, 7, 7, 0.94) 0%, rgba(5, 7, 7, 0.82) 72%, rgba(5, 7, 7, 0) 100%);
  backdrop-filter: blur(12px);
}

.page-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.page-banner-brand {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.page-banner .brand-mark.compact {
  font-size: clamp(2.7rem, 5vw, 4.4rem);
}

.page-banner .account-pill {
  margin-left: auto;
  padding: 12px 14px;
  border-radius: 20px;
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(28, 31, 31, 0.88), rgba(19, 21, 21, 0.82));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.page-banner .account-actions {
  gap: 10px;
}

.page-banner .account-actions form {
  display: flex;
  margin: 0;
}

.page-banner .account-actions .ghost-link,
.page-banner .account-actions .ghost-button {
  min-height: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.page-banner .account-actions .banner-icon-link {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.page-banner .account-actions .banner-icon-form {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
}

.page-banner .account-actions .banner-icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.page-banner .account-actions .banner-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.panel-title,
.identity-name {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel-copy,
.support-copy,
.identity-meta,
.action-copy,
.config-notice {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.auth-zone {
  display: grid;
  gap: 14px;
  padding: 28px 0 24px;
}

.google-slot {
  min-height: 44px;
}

.auth-message {
  min-height: 24px;
  color: #ffd8a3;
}

.config-notice {
  padding: 16px 18px;
  border: 1px dashed rgba(107, 189, 86, 0.4);
  border-radius: 14px;
  background: rgba(107, 189, 86, 0.08);
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-title-block {
  min-width: 0;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: auto;
}

.account-actions > * {
  flex: 0 0 164px;
}

.account-actions form {
  display: flex;
  margin: 0;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
  text-decoration: none;
}

.account-actions .ghost-link,
.account-actions .ghost-button {
  width: 100%;
  min-height: 38px;
  height: 38px;
  padding: 0 16px;
}

.identity-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4e9241, #77c960);
  color: #081007;
  font-weight: 700;
  font-size: 1.5rem;
}

.avatar-compact {
  width: 36px;
  height: 36px;
  font-size: 0.92rem;
}

.identity-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.identity-inline-name,
.identity-inline-meta {
  margin: 0;
}

.identity-inline-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.05;
}

.identity-inline-meta {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.05;
}

.player-panel {
  display: grid;
  gap: 14px;
}

.player-shell {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.stream-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.stream-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}

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

.uptime-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.uptime-label,
.uptime-value {
  margin: 0;
}

.uptime-label {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.uptime-value {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.uptime-value-status {
  font-size: 0.96rem;
  line-height: 1.35;
}

.settings-panel {
  display: grid;
  gap: 24px;
}

.settings-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.channel-stack {
  display: grid;
  gap: 16px;
}

.channel-config {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.channel-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.channel-title,
.channel-meta {
  margin: 0;
}

.channel-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.channel-meta {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.channel-config-grid {
  display: grid;
  gap: 12px;
}

.settings-label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.settings-help,
.settings-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(3, 5, 5, 0.78);
  color: var(--text);
  font: inherit;
}

.settings-select {
  appearance: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.settings-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

.user-list {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(255, 255, 255, 0.025);
}

.user-list-header,
.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 48px 48px 20px 48px 48px 48px 20px 40px;
  column-gap: 8px;
  row-gap: 0;
  align-items: center;
  min-width: 620px;
}

.user-list-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
}

.user-row {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.user-row:last-child {
  border-bottom: 0;
}

.user-list-header > span,
.user-list-header > button {
  display: grid;
  place-items: center;
}

.user-col-email {
  grid-column: 1;
}

.user-col-view {
  grid-column: 2;
}

.user-col-admin {
  grid-column: 3;
}

.user-col-ch1 {
  grid-column: 5;
}

.user-col-ch2 {
  grid-column: 6;
}

.user-col-ch3 {
  grid-column: 7;
}

.user-col-action {
  grid-column: 9;
  justify-self: end;
  margin-left: auto;
}

.user-list-header .user-col-email {
  justify-items: start;
}

.user-header-add-button {
  justify-self: end;
}

.user-email-cell {
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-toggle-cell {
  display: grid;
  place-items: center;
}

.user-toggle-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.user-icon-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

.user-icon {
  width: 14px;
  height: 14px;
  display: block;
}

body.modal-open {
  overflow: hidden;
}

.user-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 5, 5, 0.72);
  backdrop-filter: blur(10px);
}

.user-modal-backdrop[hidden] {
  display: none;
}

.user-modal {
  width: min(100%, 440px);
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(18, 21, 21, 0.98), rgba(10, 12, 12, 0.96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.user-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.user-modal-title {
  margin: 6px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.user-modal-actions {
  justify-content: flex-end;
}

.settings-input:focus {
  outline: 2px solid rgba(107, 189, 86, 0.35);
  outline-offset: 2px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-actions {
  gap: 10px;
  justify-content: space-between;
}

.settings-live-status {
  margin-left: auto;
  text-align: right;
}

.settings-live-status[data-state="saving"],
.settings-live-status[data-state="pending"] {
  color: var(--accent);
}

.settings-live-status[data-state="error"] {
  color: #f0a7a7;
}

.primary-button {
  border: 1px solid rgba(107, 189, 86, 0.5);
  background: linear-gradient(180deg, #72c25a, #58a947);
  color: #f5f8f1;
  padding: 12px 18px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.primary-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.settings-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-message.success {
  background: rgba(107, 189, 86, 0.12);
  border-color: rgba(107, 189, 86, 0.3);
}

.settings-message.error {
  background: rgba(167, 86, 86, 0.12);
  border-color: rgba(167, 86, 86, 0.26);
}

.action-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.action-card {
  display: grid;
  gap: 8px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 180ms ease, border-color 180ms ease;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: rgba(107, 189, 86, 0.38);
  text-decoration: none;
}

.action-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 720px) {
  .login-shell,
  .dashboard-shell {
    padding: 16px;
  }

  .dashboard-shell {
    padding: 0 0 24px;
  }

  .page-banner {
    padding: 14px 16px 10px;
  }

  .page-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .page-banner-brand {
    width: 100%;
  }

  .page-banner .brand-mark.compact {
    white-space: normal;
    font-size: clamp(2.2rem, 9vw, 3.4rem);
  }

  .dashboard-stage {
    width: min(calc(100% - 32px), 1400px);
    padding-top: 12px;
  }

  .panel,
  .dashboard-panel {
    padding: 28px;
    border-radius: 24px;
  }

  .dashboard-head,
  .dashboard-controls,
  .player-meta,
  .identity-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .account-pill,
  .account-actions {
    width: 100%;
  }

  .account-actions {
    margin-left: 0;
  }

  .identity-inline {
    width: 100%;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

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

  .user-list-header {
    display: none;
  }
}