@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --bg: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #e11d48;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(79, 70, 229, .09), transparent 40%),
    radial-gradient(circle at 90% 8%, rgba(16, 185, 129, .08), transparent 36%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.footnote { color: #94a3b8; font-size: 11px; text-align: center; margin-top: 4px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.num { font-variant-numeric: tabular-nums; }

.card {
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 12px 28px -14px rgba(15, 23, 42, .07);
  transition: transform .3s var(--spring), box-shadow .3s var(--spring), border-color .22s ease;
}
.card-lift:hover { transform: translateY(-2px); border-color: rgba(79, 70, 229, .3); box-shadow: 0 10px 24px -10px rgba(15, 23, 42, .09), 0 18px 34px -16px rgba(79, 70, 229, .14); }
.anim-in { animation: animIn .36s var(--ease) both; }
@keyframes animIn { from { opacity: 0; transform: translateY(10px) scale(.992); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--indigo), #7c3aed);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 14px -4px rgba(79, 70, 229, .45);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark.small { width: 34px; height: 34px; }
.brand-title { font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.pill { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef2ff; color: var(--indigo-dark); border: 1px solid #e0e7ff; }
#user-badge { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.nav-tabs { max-width: 1280px; margin: 0 auto; padding: 16px 18px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tab-btn {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 9px 14px; border-radius: 12px; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all .18s ease;
}
.tab-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.tab-btn.active { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .7); }

.page { max-width: 1280px; margin: 0 auto; padding: 22px 18px 60px; }
.page h1 { font-size: 25px; letter-spacing: -.03em; margin: 0 0 2px; font-weight: 800; }
.page h2 { font-size: 15px; margin: 0; font-weight: 800; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--indigo); }

.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.card-pad { padding: 18px; }
.kpi-label { font-size: 11px; color: var(--muted); }
.kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -.03em; margin-top: 5px; }
.kpi-hint { font-size: 11px; color: var(--indigo); font-weight: 700; margin-top: 4px; }

.progress { width: 100%; height: 7px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #818cf8, var(--indigo)); transition: width .65s var(--spring); }
.progress.thick { height: 12px; background: rgba(255,255,255,.12); }
.progress.thick > div { background: linear-gradient(90deg, #818cf8, #34d399); }

.thermometer {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  color: #fff; border: 0;
}
.thermometer .eyebrow { color: #a5b4fc; }
.thermometer p { color: #cbd5e1; font-size: 12px; }

.btn {
  border: 1px solid transparent; border-radius: 11px; padding: 9px 14px;
  font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: transform .15s var(--spring), background .18s ease, box-shadow .18s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px -6px rgba(79,70,229,.65); }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-dark { background: #0f172a; color: #fff; }
.btn-ghost { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.btn-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.btn-danger { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.btn-sm { padding: 6px 10px; font-size: 11px; }
.btn-wide { width: 100%; }

label { display: block; font-size: 11px; font-weight: 700; color: #334155; margin-bottom: 8px; }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px; font-size: 12px; font-family: inherit;
  border: 1px solid #dbe2ea; border-radius: 11px; background: #f8fafc; color: var(--ink);
  outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; }

.badge { font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: #ecfdf5; color: #047857; }
.badge-warn { background: #fffbeb; color: #b45309; }
.badge-bad { background: #fff1f2; color: #be123c; }
.badge-info { background: #eef2ff; color: var(--indigo-dark); }
.badge-mute { background: #f1f5f9; color: #475569; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; background: #f8fafc; padding: 11px 14px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.filter-bar { display: inline-flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 11px; }
.filter-bar button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; color: var(--muted); cursor: pointer; }
.filter-bar button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.evidence { border: 1px dashed #cbd5e1; background: #f8fafc; border-radius: 14px; min-height: 180px; display: grid; place-items: center; text-align: center; padding: 16px; color: #94a3b8; font-size: 12px; }
.evidence img, .evidence iframe { max-width: 100%; max-height: 320px; border-radius: 10px; }

.alert-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #f1f5f9; border-radius: 11px; font-size: 12px; background: #f8fafc; }
.ledger-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; background: #f8fafc; border: 1px solid #eef2f7; font-size: 11px; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: 360px; pointer-events: none; }
.toast { pointer-events: auto; font-size: 12px; font-weight: 700; padding: 12px 15px; border-radius: 12px; border: 1px solid #1e293b; background: #0f172a; color: #fff; box-shadow: 0 12px 30px -10px rgba(15,23,42,.5); animation: animIn .3s var(--ease); }
.toast.ok { background: #064e3b; border-color: #047857; color: #ecfdf5; }
.toast.warn { background: #78350f; border-color: #b45309; color: #fffbeb; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.45); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow-y: auto; background: #fff; border-radius: 20px; box-shadow: 0 30px 70px -20px rgba(15,23,42,.5); animation: animIn .3s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn { border: 0; background: #f1f5f9; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; color: #475569; font-size: 16px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); padding: 28px; display: grid; gap: 14px; }
.login-card h1 { font-size: 24px; margin: 0; letter-spacing: -.03em; }
.login-card .brand-mark { margin-bottom: 4px; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-7-5 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpi-grid, .grid-2, .grid-3, .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .page { padding: 16px 12px 50px; }
  .nav-tabs { padding: 12px 12px 0; }
  .topbar-inner { padding: 10px 12px; }
}
