:root {
  --bg: #0b1220;
  --surface: #131c30;
  --surface-2: #1a2440;
  --border: #1f2a44;
  --border-soft: #25324f;
  --text: #e6eaf3;
  --text-dim: #93a1b8;
  --text-muted: #6b7a93;
  --accent: #4d8bff;
  --accent-hov: #6a9eff;
  --good: #34c87b;
  --warn: #f6b140;
  --danger: #ff5b6a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.45;
}
.muted { color: var(--text-dim); }

/* ---------- Splash & Login ---------- */
.splash { display: grid; place-items: center; min-height: 100vh; color: var(--text-dim); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px 36px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p.lead { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font-size: 14px;
  background: #0e1729; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 100px; }

.btn {
  background: var(--accent); color: white; border: 0; border-radius: 8px;
  padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
.btn:hover { background: var(--accent-hov); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--accent); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); }
.link-btn { background: transparent; color: var(--accent); border: 0; cursor: pointer; font-size: 13px; padding: 0 4px; }
.link { color: var(--accent); font-size: 13px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.brand { font-size: 13px; color: var(--text-dim); margin-top: 18px; text-align: center; }

/* ---------- Dashboard ---------- */
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dash-header .brand-title { font-size: 16px; font-weight: 600; }
.dash-header .who { color: var(--text-dim); font-size: 13px; }
.dash-header .who span { margin-right: 14px; }

.dash-main { max-width: 1200px; margin: 28px auto; padding: 0 24px; }

.hero h2 { font-size: 22px; margin-bottom: 4px; }
.hero p { font-size: 14px; }

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin: 22px 0;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; min-width: 0;
}
.kpi-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; }
.kpi-value.bad { color: var(--danger); }
.kpi-value.warn { color: var(--warn); }
.kpi-value.good { color: var(--good); }
.kpi-sub { font-size: 12px; margin-top: 4px; }

.grid-2col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px;
}
@media (max-width: 800px) { .grid-2col { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 15px; }
.panel-head .muted { font-size: 12px; }

.list { list-style: none; }
.list .row {
  display: flex; gap: 12px; padding: 11px 0;
  border-top: 1px solid var(--border-soft);
}
.list .row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; margin-bottom: 2px; }
.row-sub { font-size: 12px; }
.row-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge.b-good { background: rgba(52,200,123,.15); color: var(--good); }
.badge.b-warn { background: rgba(246,177,64,.15); color: var(--warn); }
.badge.b-bad  { background: rgba(255,91,106,.15); color: var(--danger); }
.badge.b-dim  { background: var(--surface-2); color: var(--text-dim); }

.apps-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.app-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.app-card .icon { font-size: 24px; margin-bottom: 4px; }
.app-card h4 { font-size: 15px; }
.app-card p { font-size: 13px; }
.app-card .card-cta {
  margin-top: 10px; align-self: flex-start;
  color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: none;
}
.app-card.disabled { opacity: .55; }
.app-card.disabled .card-cta { color: var(--text-dim); pointer-events: none; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(8,12,22,.75);
  display: grid; place-items: center; padding: 20px; z-index: 100;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 28px; width: 100%; max-width: 480px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.modal-card h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ---------- MFA banner & step2 ---------- */
.mfa-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(246,177,64,.10); border: 1px solid rgba(246,177,64,.4);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 18px;
}
.mfa-banner strong { color: var(--warn); }
#login-step2 .lead { font-weight: 600; margin-bottom: 14px; }
