/* HXS Stream admin panel. A committed-dark control surface: it displays the
   brand colours of Twitch, Kick and YouTube as data, so the app's own accent
   (amber, an on-air signal light) stays clear of all three. Every colour is
   painted explicitly. */

:root {
  --ground: #0d0f14;
  --panel: #151922;
  --panel-2: #1a1f2a;
  --line: #242b38;
  --line-soft: #1e2430;
  --text: #e8ecf2;
  --muted: #8a94a6;
  --faint: #5b6675;

  --accent: #ffb020;
  --accent-dim: #c9861a;
  --accent-wash: rgba(255, 176, 32, 0.12);

  --live: #ff4d4d;
  --ok: #3fb950;
  --warn: #d29922;

  --twitch: #a970ff;
  --kick: #53fc18;
  --youtube: #ff4444;

  --radius: 9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

.label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.07em;
  color: var(--faint);
  font-weight: 600;
}

/* ---- layout ------------------------------------------------------------- */

.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  height: 52px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -0.01em; }
.brand .sig {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.body { display: grid; grid-template-columns: 290px 1fr; flex: 1; min-height: 0; }

.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.main { overflow-y: auto; padding: 18px 22px 40px; min-width: 0; }

/* ---- shared ------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip.pending { color: var(--warn); }
.chip.soon { color: var(--faint); font-style: italic; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.pf { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.pf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.pf.twitch::before { background: var(--twitch); }
.pf.kick::before { background: var(--kick); }
.pf.youtube::before { background: var(--youtube); }
.pf.twitch { color: var(--twitch); }
.pf.kick { color: var(--kick); }
.pf.youtube { color: var(--youtube); }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--accent-dim); }
.btn.primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #1a1206; font-weight: 650; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.danger { color: var(--live); }
.btn.danger:hover { border-color: var(--live); background: rgba(255, 77, 77, 0.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="password"], select, textarea {
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-dim); outline: none; }
textarea { resize: vertical; min-height: 54px; }

/* ---- tenant rail -------------------------------------------------------- */

.tenant {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}
.tenant:hover { background: var(--panel-2); }
.tenant.active { background: var(--accent-wash); border-color: var(--accent-dim); }
.tenant .meta { min-width: 0; flex: 1; }
.tenant .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant .sub { font-size: 12px; color: var(--faint); }
.kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex: 0 0 auto;
}

.rail-group { display: flex; flex-direction: column; gap: 6px; }

/* ---- detail ------------------------------------------------------------- */

.head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.head h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.head .sub { color: var(--muted); font-size: 13px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .label { margin: 0; }

.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.item:last-child { border-bottom: none; }
.item:hover { background: var(--panel-2); }
.item .grow { flex: 1; min-width: 0; }
.item .name { font-weight: 550; }
.item .meta2 { font-size: 12px; color: var(--faint); }

.row-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.row-form select { width: auto; min-width: 120px; }
.row-form input[type="text"] { flex: 1; min-width: 160px; width: auto; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field .desc { color: var(--faint); font-size: 12px; }

.empty { padding: 24px 14px; text-align: center; color: var(--faint); }
.empty.pick { margin-top: 80px; }

/* ---- event log ---------------------------------------------------------- */

.events { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ev { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.ev .t { color: var(--faint); font-size: 12px; flex: 0 0 auto; }
.ev .k { color: var(--accent); flex: 0 0 auto; }
.ev .d { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- login -------------------------------------------------------------- */

.login-wrap { height: 100%; display: grid; place-items: center; padding: 20px; }
.login {
  width: 100%;
  max-width: 330px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login h1 { margin: 0; font-size: 17px; }
.error { color: var(--live); font-size: 13px; min-height: 18px; }

/* ---- toast + modal ------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--accent-dim);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 60;
}
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
  z-index: 50; padding: 20px;
}
.modal {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal h2 { margin: 0; font-size: 16px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  color: var(--muted);
}
.seg button.on { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-wash); }

@media (max-width: 820px) {
  .body { grid-template-columns: 1fr; }
  .rail { border-right: none; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .main { padding: 16px 14px 40px; }
  /* Multi-input forms must stack instead of overflowing. */
  .row-form { flex-direction: column; align-items: stretch; }
  .row-form select, .row-form input[type="text"], .row-form .btn { width: 100%; min-width: 0; }
  .item { flex-wrap: wrap; }
  .item .grow { flex-basis: 100%; order: -1; }
  .head { row-gap: 6px; }
  .head .spacer { display: none; }
  /* The status chips are informational; on a phone the brand + sign-out are
     what must fit. Let the bar wrap and drop the pending-subsystem chips. */
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .topbar .chip.soon { display: none; }
}
