:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9deea;
  --brand: #254edb;
  --danger: #b42318;
  --success: #067647;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #111827; color: #f9fafb; padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { font-weight: 800; letter-spacing: -0.03em; font-size: 20px; margin-bottom: 24px; }
.nav a, .nav button { display: block; width: 100%; color: #d1d5db; background: transparent; border: 0; text-align: left; padding: 9px 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav .section { color: #94a3b8; text-transform: uppercase; font-size: 11px; margin: 18px 10px 7px; letter-spacing: 0.08em; }
.main { flex: 1; min-width: 0; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 16px 28px; display: flex; justify-content: space-between; align-items: center; }
.content { padding: 24px 28px 52px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
th { color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; background: #e5e7eb; color: #374151; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #cffafe; color: #155e75; }
.badge-dark { background: #374151; color: #fff; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 9px; padding: 8px 12px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; background: #f8fafc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-small { padding: 5px 9px; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; font: inherit; background: #fff; }
textarea { min-height: 90px; }
label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.form-row { margin-bottom: 13px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.alert { padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--line); background: #fff; }
.alert-success { border-color: #86efac; background: #f0fdf4; }
.alert-danger { border-color: #fecaca; background: #fef2f2; }
.alert-warning { border-color: #fde68a; background: #fffbeb; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: 0 20px 45px rgba(15, 23, 42, .10); }
pre { white-space: pre-wrap; overflow: auto; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 14px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.statline { display: flex; gap: 16px; flex-wrap: wrap; }
.statline div { min-width: 130px; }
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { width: auto; height: auto; position: relative; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { display: block; }
}
