:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --accent: #53fc18;
  --accent-text: #0b0d10;
  --danger: #ff5c5c;
  --warn: #ffb547;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Classes like .login set display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
}
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

button { cursor: pointer; background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); font-weight: 500; }
button.link { background: none; border: none; padding: 0; color: var(--muted); font-weight: 400; text-decoration: underline; }

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.topbar nav button.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }
main > section { display: flex; flex-direction: column; gap: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--muted); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.bar-row { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-track { background: var(--panel-2); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 4px; }
.bar-row .count { text-align: right; font-variant-numeric: tabular-nums; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; }
.feed li { border-left: 2px solid var(--border); padding-left: 10px; }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.meta button { margin-left: auto; }
.body { white-space: pre-wrap; word-break: break-word; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 180px; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
#streamer-detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }

.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--panel-2); }
td.num { font-variant-numeric: tabular-nums; }

.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.pill.new { color: var(--muted); }
.pill.contacted { color: #6cb6ff; border-color: #6cb6ff55; }
.pill.in_talks { color: var(--warn); border-color: #ffb54755; }
.pill.signed { color: var(--accent); border-color: #53fc1855; }
.pill.declined { color: var(--danger); border-color: #ff5c5c55; }
.pill.ignoring { color: #c49bff; border-color: #c49bff55; }
.pill.already_tried { color: #a8a29e; border-color: #a8a29e55; }
.pill.off { color: var(--danger); }

.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.detail-head a { color: var(--text); font-size: 18px; font-weight: 700; text-decoration: none; }
.detail-head a:hover { color: var(--accent); }
.detail-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { color: var(--muted); padding: 12px 14px; }

@media (max-width: 900px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .grid-2, .split { grid-template-columns: 1fr; }
  #streamer-detail { position: static; max-height: none; }
}

/* Chat log: let long messages wrap instead of widening the table. */
td.message { white-space: pre-wrap; word-break: break-word; min-width: 240px; width: 100%; }

/* Streamer detail: who messaged them, and one networker's log. */
.chatters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chatter {
  width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 400; text-align: left;
}
.chatter:hover:not(:disabled), .chatter.selected { border-color: var(--accent); background: var(--panel-2); }
.chatter:disabled { cursor: default; opacity: .7; }

.chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-log li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; }
.chat-log time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
