/* Audiomack Stream Platform — dashboard styles (dark, orange-accented). */

:root {
  --bg: #0d0f12;
  --bg2: #12151a;
  --panel: #161a21;
  --panel2: #1b2029;
  --line: #232936;
  --line2: #2c3442;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --faint: #5c6372;
  --accent: #ff7a1a;
  --accent2: #ff9a4d;
  --accent-dim: rgba(255, 122, 26, 0.14);
  --green: #34c98e;
  --green-dim: rgba(52, 201, 142, 0.14);
  --red: #f0524f;
  --red-dim: rgba(240, 82, 79, 0.14);
  --amber: #e8b33f;
  --amber-dim: rgba(232, 179, 63, 0.14);
  --blue: #4d9fff;
  --blue-dim: rgba(77, 159, 255, 0.14);
  --radius: 12px;
  --radius-s: 8px;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ── sidebar ── */
.sidebar {
  width: 218px; flex: 0 0 218px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 22px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #ffb347);
  color: #1a1208; font-size: 15px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 0 18px rgba(255, 122, 26, 0.35);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; }
.brand-name span { color: var(--accent); font-weight: 400; }
.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-s);
  color: var(--muted); text-decoration: none; font-weight: 500;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent2); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line2); transition: background 0.12s; }
.nav-item.active .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--green-dim); color: var(--green);
  font-size: 12px; font-weight: 600;
}
.live-pill.dead { background: var(--red-dim); color: var(--red); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── main ── */
.main { flex: 1; padding: 28px 32px; max-width: 1280px; }
.page { display: none; }
.page.active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── cards ── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .hint, .hint { color: var(--faint); font-size: 12px; }
.tiny { color: var(--muted); font-size: 12px; }

/* ── stats ── */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: left;
}
.stat-card.accent { border-color: rgba(255, 122, 26, 0.4); background: linear-gradient(180deg, var(--accent-dim), var(--panel)); }
.stat-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-card.accent .stat-num { color: var(--accent2); }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; margin-top: 2px; }

/* ── chart ── */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--accent2), var(--accent)); min-height: 2px; transition: height 0.3s; }
.chart .bar-label { font-size: 9px; color: var(--faint); white-space: nowrap; }

/* ── two-col layouts ── */
.two-col { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.col-side .card { margin-bottom: 18px; }

/* ── groups ── */
.group-new { display: flex; gap: 8px; margin-bottom: 12px; }
.group-new input { flex: 1; }
.group-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.group-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-s);
  background: var(--panel2); border: 1px solid var(--line);
  cursor: pointer; transition: border-color 0.12s;
}
.group-item:hover { border-color: var(--line2); }
.group-item.active { border-color: var(--accent); background: var(--accent-dim); }
.group-item .g-name { font-weight: 600; font-size: 13px; }
.group-item .g-meta { color: var(--muted); font-size: 11px; }
.group-item .g-del { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 5px; }
.group-item .g-del:hover { color: var(--red); background: var(--red-dim); }
.group-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 14px 0; }
.group-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── forms ── */
input, select, textarea {
  background: var(--bg2); border: 1px solid var(--line2); color: var(--text);
  border-radius: var(--radius-s); padding: 8px 10px; font: inherit; font-size: 13px;
  outline: none; transition: border-color 0.12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea.code-input { width: 100%; font-family: var(--mono); font-size: 12px; resize: vertical; }
.filter { width: 180px; padding: 6px 10px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; margin-bottom: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form-grid label.fspan { grid-column: 1 / -1; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; padding-top: 18px; }
.form-grid label.check input { width: 15px; height: 15px; accent-color: var(--accent); }
select[multiple] { min-height: 90px; }

/* ── buttons ── */
.btn {
  background: var(--accent); border: none; color: #1a1208;
  font-weight: 700; font-size: 13px; padding: 9px 16px;
  border-radius: var(--radius-s); cursor: pointer;
  transition: filter 0.12s, transform 0.06s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); font-weight: 600; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent2); }
.btn.ghost.danger:hover { border-color: var(--red); color: var(--red); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.grow { flex: 1; }

/* ── tables ── */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.tbl tr:hover td { background: var(--panel2); }
.tbl .mono { font-family: var(--mono); font-size: 11.5px; }
.tbl .dim { color: var(--muted); }
.tbl input[type="checkbox"] { accent-color: var(--accent); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px; padding: 3px 7px; border-radius: 5px; }
.icon-btn:hover { color: var(--text); background: var(--panel2); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-dim); }
.member-bar { padding: 6px 2px 12px; }

/* ── badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.2px; }
.badge.green { background: var(--green-dim); color: var(--green); }
.badge.red { background: var(--red-dim); color: var(--red); }
.badge.amber { background: var(--amber-dim); color: var(--amber); }
.badge.blue { background: var(--blue-dim); color: var(--blue); }
.badge.dim { background: var(--panel2); color: var(--muted); }

/* ── runs / health ── */
.health-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.health-cell { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; }
.health-cell .h-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.health-cell .h-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.progress-track { height: 8px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 6px; transition: width 0.4s; }
.event-feed { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 11.5px; }
.event-line { display: flex; gap: 10px; padding: 5px 8px; border-radius: 6px; background: var(--panel2); }
.event-line .e-time { color: var(--faint); flex: 0 0 auto; }
.event-line .e-kind { color: var(--blue); flex: 0 0 130px; }
.event-line.warn .e-kind { color: var(--amber); }
.event-line.error .e-kind { color: var(--red); }
.event-line .e-msg { color: var(--text); }

/* ── logs ── */
.log-stream {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 12px; height: 560px; overflow-y: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
}
.log-line { white-space: pre-wrap; word-break: break-all; color: var(--muted); }
.log-line.error { color: var(--red); }

/* ── preview box ── */
.preview-box { font-size: 13px; line-height: 1.9; }
.preview-box b { color: var(--accent2); }
.preview-box .ok { color: var(--green); font-weight: 700; }
.preview-box .warn { color: var(--amber); font-weight: 700; }
.preview-math { font-family: var(--mono); font-size: 12px; background: var(--bg2); border-radius: var(--radius-s); padding: 12px 14px; border: 1px solid var(--line); }

/* ── toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--text);
  padding: 12px 18px; border-radius: var(--radius-s); font-size: 13px;
  opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; max-width: 380px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }

/* ── scrollbars ── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
