:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1e3a8a;
  --accent: #2563eb;
  --green: #15803d; --green-bg: #dcfce7;
  --yellow: #b45309; --yellow-bg: #fef3c7;
  --red: #b91c1c; --red-bg: #fee2e2;
  --blue: #1d4ed8; --blue-bg: #dbeafe;
  --na: #9ca3af; --na-bg: #f3f4f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--brand); color: #fff; padding: 0 18px; height: 52px;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand a { color: #fff; font-weight: 700; font-size: 15.5px; text-decoration: none; white-space: nowrap; }
.brand .proto { font-size: 10.5px; font-weight: 600; background: rgba(255,255,255,.18); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav-item { color: #dbeafe; padding: 6px 11px; border-radius: 7px; font-weight: 500; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.2); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.uname { font-size: 13px; opacity: .92; }
.bell { position: relative; font-size: 16px; text-decoration: none; }
.bell.dim { opacity: .55; }
.bell .bubble { position: absolute; top: -6px; right: -9px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; }

.main { max-width: 1180px; margin: 0 auto; padding: 18px 18px 40px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

.flash { max-width: 1180px; margin: 12px auto 0; padding: 10px 16px; border-radius: var(--radius); font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.flash.bad { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15.5px; }
.card-body { padding: 16px 18px; overflow-x: auto; }
.card-body > svg { max-width: 100%; height: auto; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: #fff; border: 1px solid var(--line); padding: 7px 13px; border-radius: 999px; color: var(--ink); font-weight: 500; font-size: 13px; }
.tab:hover { border-color: var(--accent); text-decoration: none; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exportbar { display: flex; gap: 8px; align-items: center; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; position: sticky; top: 52px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #f8faff; }
td.empty { color: var(--muted); text-align: center; padding: 22px; }
.compact th, .compact td { padding: 5px 8px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.dot.green { background: var(--green); } .dot.yellow { background: #d97706; }
.dot.red { background: var(--red); } .dot.na { background: var(--na); } .dot.blue { background: var(--blue); }
.pill { display: inline-flex; align-items: center; padding: 2.5px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.na { background: var(--na-bg); color: var(--na); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }

.cell-st { border-radius: 7px; padding: 4px 9px; display: inline-block; min-width: 86px; font-variant-numeric: tabular-nums; }
.cell-st.green { background: var(--green-bg); } .cell-st.yellow { background: var(--yellow-bg); }
.cell-st.red { background: var(--red-bg); } .cell-st.na { background: var(--na-bg); color: var(--muted); }
.cell-sub { font-size: 11px; color: var(--muted); display: block; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); border: 1px solid var(--accent);
  color: #fff; padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.4); }
.btn-sec { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-sec:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-green { background: var(--green); border-color: var(--green); }
.inline { display: inline; }

input[type=text], input[type=number], input[type=email], input[type=password], input[type=datetime-local], input[type=date], select, textarea {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 10px; font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { width: 100%; min-height: 110px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }
label.fl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 22px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { font-size: 13px; display: inline-flex; gap: 5px; align-items: center; background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; cursor: pointer; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 15px; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn .v { color: var(--red); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }

.note { font-size: 12.5px; color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.emailbody { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-size: 13.5px; }
.bigmsg { text-align: center; padding: 60px 20px; }
.bigmsg h1 { font-size: 26px; }

.login-wrap { max-width: 420px; margin: 60px auto; }
.login-wrap .card-body { padding: 26px; }
.login-wrap input { width: 100%; margin-bottom: 12px; }
.demo-users { font-size: 12.5px; color: var(--muted); margin-top: 14px; line-height: 1.7; }

.audit-pii { background: var(--yellow-bg); border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--yellow); margin-bottom: 12px; }
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.vlist li:last-child { border-bottom: 0; }
.tag { display: inline-block; background: var(--blue-bg); color: var(--blue); border-radius: 6px; font-size: 11.5px; font-weight: 600; padding: 1.5px 7px; margin-right: 5px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 5px 0 5px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 99px; background: var(--accent); }
