:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2230;
  --border: #2b3444;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3b82f6;
  --accent2: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 18px; font-size: 13px; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background .15s;
}
button:hover { background: var(--accent2); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.ghost:hover { background: var(--bg3); color: var(--text); }
button.danger { background: var(--red); }
button.small { padding: 5px 10px; font-size: 12px; }

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin: 6px 0;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label { font-size: 12px; color: var(--muted); display: block; margin-top: 10px; }

.brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--bg2); padding: 32px; border-radius: 16px; width: 340px; border: 1px solid var(--border); }
.login-card h1 { font-size: 20px; margin: 16px 0; }
.login-card button { width: 100%; margin-top: 10px; }

/* Layout */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 8px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 24px; flex: 1; }
.sidebar nav a {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--muted);
  font-weight: 600; user-select: none;
}
.sidebar nav a:hover { background: var(--bg3); color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: #fff; }

main { flex: 1; padding: 28px 32px; overflow: auto; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
header h1 { margin: 0; font-size: 24px; }
h2 { font-size: 16px; margin: 24px 0 12px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat .num { font-size: 32px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Table */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
td .sub { color: var(--muted); font-size: 12px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: rgba(34,197,94,.15); color: var(--green); }
.badge.off { background: rgba(139,148,158,.15); color: var(--muted); }
.badge.live { background: rgba(239,68,68,.15); color: var(--red); }
.badge.type { background: rgba(59,130,246,.15); color: var(--accent); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-live.active { background: var(--green); box-shadow: 0 0 8px var(--green); }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.url-cell { font-family: monospace; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; width: 480px; max-width: 92vw; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
#modal-body { padding: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.checklist { max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.checklist label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px; color: var(--text); cursor: pointer; }
.checklist input { width: auto; margin: 0; }
.hint { background: var(--bg3); border-radius: 8px; padding: 12px; font-size: 13px; margin-top: 12px; }
.hint code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg3); border: 1px solid var(--border); padding: 14px 20px; border-radius: 10px; z-index: 60; }
