:root {
  --bg: #070b14;
  --panel: #0e1626;
  --panel-2: #121d31;
  --line: #22324d;
  --text: #eef5ff;
  --muted: #8ea2bd;
  --cyan: #26d9ff;
  --blue: #3b82f6;
  --red: #ef4444;
  --green: #34d399;
  --amber: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(38, 217, 255, 0.12), transparent 34%), var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(38, 217, 255, 0.28);
  border-radius: 8px;
  background: rgba(14, 22, 38, 0.94);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55), 0 0 50px rgba(38, 217, 255, 0.08);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 217, 255, 0.5);
  border-radius: 8px;
  color: var(--cyan);
  font-weight: 800;
  box-shadow: inset 0 0 18px rgba(38, 217, 255, 0.12);
}
.brand-mark.small { width: 40px; height: 40px; font-size: 13px; }
.eyebrow { color: var(--cyan); text-transform: uppercase; font-size: 11px; letter-spacing: 1.3px; margin: 18px 0 8px; }
.login-card h1 { margin-bottom: 24px; font-size: 28px; }

input, textarea, select {
  width: 100%;
  background: #09101e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(38, 217, 255, 0.1); }
.login-card input { margin-bottom: 12px; }

button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--text);
  background: #18243a;
}
button:hover { border-color: rgba(38, 217, 255, 0.45); }
.primary, .login-card button { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.secondary { background: #17233a; }
.danger { background: rgba(239, 68, 68, 0.16); color: #fecaca; border-color: rgba(239, 68, 68, 0.3); }
.icon-btn { width: 34px; height: 34px; padding: 0; }

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.95);
  padding: 24px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.sidebar-brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.tabs { display: grid; gap: 7px; }
.tab {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--muted);
  padding: 11px 12px;
}
.tab.active, .tab:hover {
  color: var(--text);
  background: rgba(38, 217, 255, 0.08);
  border-color: rgba(38, 217, 255, 0.25);
}

.content { padding: 26px; min-width: 0; }
.topline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.topline .eyebrow { margin: 0 0 6px; }
.user-bar { display: flex; align-items: center; gap: 12px; color: var(--muted); }

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(38, 217, 255, 0.08);
  border: 1px solid rgba(38, 217, 255, 0.24);
}
.alert.error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.32); color: #fecaca; }
.alert.success { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.32); color: #bbf7d0; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 180ms ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head p { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.toolbar input { max-width: 420px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}
.stat-card, .panel, .table-wrap {
  background: rgba(14, 22, 38, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stat-card { padding: 20px; }
.stat-value { font-size: 30px; color: var(--cyan); font-weight: 800; }
.stat-label { margin-top: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }

.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 16px; min-width: 0; }
.panel h3 { margin-bottom: 12px; }

.table-wrap { overflow: auto; }
.table-wrap.compact { max-height: 560px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(34, 50, 77, 0.75); vertical-align: top; font-size: 13px; }
th { color: var(--muted); background: #0a1120; text-transform: uppercase; font-size: 11px; letter-spacing: 0.9px; }
tr:hover td { background: rgba(38, 217, 255, 0.035); }
small { color: var(--muted); }
code { color: #b8d7ff; word-break: break-all; font-size: 12px; }
td button { margin-right: 6px; margin-bottom: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(142, 162, 189, 0.12);
  color: #cbd5e1;
  font-size: 12px;
  margin: 2px;
}
.badge.ok { color: #bbf7d0; background: rgba(52, 211, 153, 0.12); }
.badge.info { color: #bae6fd; background: rgba(38, 217, 255, 0.12); }
.badge.danger { color: #fecaca; background: rgba(239, 68, 68, 0.14); }
.badge.muted { color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 13, 0.72);
  z-index: 100;
}
.modal-content {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(38, 217, 255, 0.28);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.6);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
#modal-form { display: grid; gap: 12px; }
#modal-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
#modal-form .check { display: flex; align-items: center; color: var(--text); }
#modal-form .check input { width: auto; }

@media (max-width: 980px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; border-right: none; border-bottom: 1px solid var(--line); }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .stats-grid, .split-grid { grid-template-columns: 1fr; }
  .topline, .section-head { align-items: flex-start; flex-direction: column; }
}
