:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --soft: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: #eef2ff; color: var(--accent);
}
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fffbeb; color: #b45309; }
.badge.bad { background: #fef2f2; color: #b91c1c; }

.shell { max-width: 1320px; margin: 0 auto; padding: 16px 20px 40px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.grid-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.kpi-label { font-size: 0.78rem; color: var(--muted); }
.kpi-val { font-size: 1.55rem; font-weight: 800; margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 1rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff;
}
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--soft); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: top; }
th { font-size: 0.78rem; color: var(--muted); background: var(--soft); }

.login-box {
  max-width: 400px; margin: 80px auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.toast {
  position: fixed; bottom: 18px; right: 18px; z-index: 999; background: #0f172a; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 0.85rem;
}
.mono { font-family: ui-monospace, monospace; font-size: 0.8rem; }
