:root {
  --bg: #0B1220;
  --panel: #131B2E;
  --panel-border: #232D45;
  --text: #E7EAF0;
  --muted: #8892A6;
  --accent: #22D3B8;
  --accent-dim: #17403A;
  --warn: #F5A623;
  --danger: #EF5B5B;
  --primary: #4C7CF3;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .brand span, .login-brand span {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--muted); font-size: 13px; }

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

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0D1526;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
}

.brand, .login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
  margin-bottom: 32px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(34, 211, 184, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 211, 184, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 211, 184, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 184, 0); }
}

.nav-item {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}
.nav-item.active { background: var(--panel); color: var(--text); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.sidebar-footer button {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-family: inherit;
}
.sidebar-footer button:hover { color: var(--text); border-color: var(--accent); }

.main { flex: 1; padding: 28px 32px; max-width: 1400px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 22px; margin: 0 0 4px; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-right { text-align: right; display: flex; flex-direction: column; gap: 2px; }
#clock { font-size: 15px; }

/* ---------- KPI cards ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--kpi-accent, var(--accent));
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
}
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Panels / grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 600; }

/* ---------- Table ---------- */
.table-wrap { max-height: 340px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
  position: sticky; top: 0; background: var(--panel);
}
td { padding: 9px 10px; border-bottom: 1px solid #1A2338; }
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-READY  { background: var(--accent-dim); color: var(--accent); }
.status-INCALL { background: #1E2E5C; color: var(--primary); }
.status-PAUSED { background: #4A3A18; color: var(--warn); }
.status-OTHER  { background: #3A1E22; color: var(--danger); }

/* ---------- Login page ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 340px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.login-card input {
  background: #0D1526;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-card button {
  background: var(--accent);
  color: #06231F;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
.login-error { color: var(--danger); font-size: 13px; min-height: 16px; margin: 0; }
