:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --panel: #12161d;
  --panel-2: #181d26;
  --line: #2a303b;
  --text: #f2f4f8;
  --muted: #98a2b3;
  --green: #72e5ad;
  --green-dark: #173b2c;
  --red: #ff7b88;
  --red-dark: #421e25;
  --purple: #b9a2ff;
  --youtube: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 80% -10%, rgba(114, 229, 173, .09), transparent 32rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
.shell { width: min(1480px, calc(100% - 48px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: rgba(10, 12, 16, .88); backdrop-filter: blur(16px); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; width: 52px; height: 52px; object-fit: contain; }
nav { display: flex; align-items: center; gap: 24px; }
nav a, .link-button { color: var(--muted); text-decoration: none; }
nav form { display: inline; }
.link-button { border: 0; padding: 0; background: none; font: inherit; cursor: pointer; }
nav a:hover, .link-button:hover { color: var(--text); }
main.shell { min-height: calc(100vh - 130px); padding-block: 42px 64px; }
.footer { padding: 18px 0 32px; color: var(--muted); font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: 19px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.muted, small { color: var(--muted); }
.page-heading { margin-bottom: 30px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.split.compact { align-items: flex-start; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.panel, .metric, .auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.02), transparent), var(--panel);
}
.panel { padding: 24px; margin-bottom: 22px; }
.panel-heading { display: flex; justify-content: space-between; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.metric { padding: 20px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 4px; font-size: 34px; letter-spacing: -.04em; }
.metric.live strong { color: var(--green); }
.metric.danger strong { color: var(--red); }
.two-column { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
.button {
  display: inline-flex; min-height: 42px; padding: 10px 16px; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; color: var(--text); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.button.primary { background: var(--green); color: #092015; }
.button.secondary { border-color: var(--line); background: var(--panel-2); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.button.danger-button { background: var(--red); color: #2a080d; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.button-row form { margin: 0; }
.flash { margin-bottom: 20px; padding: 13px 16px; border: 1px solid; border-radius: 10px; }
.flash.success { color: var(--green); border-color: #275d46; background: var(--green-dark); }
.flash.error { color: #ffc0c6; border-color: #70313b; background: var(--red-dark); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
td a { font-weight: 700; text-decoration: none; }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status, .platform {
  display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.status.active, .status.sent, .status.live { color: var(--green); background: var(--green-dark); }
.status.failed, .status.error, .status.revoked { color: var(--red); background: var(--red-dark); }
.status.pending, .status.processing, .status.retry { color: #ffd479; background: #3b311c; }
.platform.twitch { color: var(--purple); background: #28213f; }
.platform.youtube { color: var(--youtube); background: #3c2022; }
.status-row { display: flex; gap: 7px; flex-wrap: wrap; }
.channel-table-panel { padding: 0; overflow: hidden; }
.channel-table { min-width: 1120px; }
.channel-table th { padding-block: 14px; background: var(--panel-2); white-space: nowrap; }
.channel-table td { padding-block: 10px; }
.channel-table tbody tr { transition: background .14s; }
.channel-table tbody tr:hover { background: rgba(255,255,255,.025); }
.channel-table tbody tr:last-child td { border-bottom: 0; }
.channel-identity { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.channel-identity small { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-name { display: block; max-width: 210px; overflow: hidden; color: var(--text); font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.channel-name:hover, .table-action:hover { color: var(--green); }
.channel-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px;
  display: grid; place-items: center; background: var(--panel-2); color: var(--green); font-size: 16px; font-weight: 800;
}
.channel-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.large-avatar { width: 72px; height: 72px; flex: 0 0 auto; border-radius: 18px; object-fit: cover; }
.filter-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.table-action { color: var(--muted); font-size: 13px; font-weight: 750; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.identity-heading { display: flex; align-items: center; gap: 18px; }
.identity-heading h1 { margin-bottom: 3px; }
.identity-heading p { margin-bottom: 0; }
.empty-state { grid-column: 1 / -1; padding: 64px 24px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty { color: var(--muted); margin: 16px 0 0; }
.auth-card { width: min(460px, 100%); margin: 5vh auto 0; padding: 34px; }
.auth-card h1 { font-size: 34px; }
.stack { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px;
  background: #0d1117; color: var(--text); font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(114,229,173,.09); }
textarea { resize: vertical; }
label small { font-weight: 400; }
.optional { color: var(--muted); font-size: 12px; font-weight: 500; }
.form-panel { max-width: 720px; }
.identity { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: 10px; background: var(--panel-2); }
code { color: var(--green); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.details { margin: 14px 0 0; }
.details div { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.subscription-list { margin: 10px 0 0; padding: 0; list-style: none; }
.subscription-list li { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.danger-zone { margin-top: 34px; padding: 24px; border: 1px solid #612b34; border-radius: var(--radius); background: rgba(66,30,37,.42); }
.inline-form { display: flex; gap: 10px; }
.inline-form input { max-width: 340px; }

@media (max-width: 800px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .page-heading.split { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1480px); }
  nav { gap: 12px; font-size: 13px; }
  main.shell { padding-top: 28px; }
  .metric-grid { gap: 9px; }
  .metric { padding: 15px; }
  .metric strong { font-size: 28px; }
  .panel, .auth-card { padding: 19px; }
  .channel-table-panel { padding: 0; }
  .inline-form { flex-direction: column; }
  .button { width: 100%; }
  .button-row { width: 100%; }
}
