:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1e242c;
  --line: #2a323c;
  --txt: #e8edf2;
  --muted: #94a3b8;
  --brand: #ff6a00;
  --brand-2: #ffa14a;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --blue: #3b82f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { font-weight: 800; letter-spacing: .5px; color: var(--brand); font-size: 18px; }
.brand span { color: var(--muted); font-weight: 600; margin-left: 6px; font-size: 13px; }
.brand.big { font-size: 26px; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px;
}
.mainnav a:hover { background: var(--panel-2); color: var(--txt); }
.mainnav a.active { background: var(--brand); color: #fff; }
.userbox { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }
.who em { color: var(--brand-2); font-style: normal; font-weight: 700; text-transform: uppercase; font-size: 11px; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; color: var(--brand-2); }
.lead, .sub { color: var(--muted); }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.snap-time { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); }
.btn-primary { background: var(--brand); color: #fff; border: none; padding: 10px 16px; font-weight: 700; }
.btn-primary:hover { background: #ff7d1f; }
.btn-ghost { background: transparent; color: var(--muted); padding: 5px 10px; font-size: 13px; }
.btn-ghost:hover { color: var(--txt); border-color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin: 14px 0; font-size: 14px; border: 1px solid; }
.alert.erro { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: #fecaca; }
.alert.warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); color: #fde68a; }

/* ---------- Cards (home) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card-link:hover { border-color: var(--brand); transform: translateY(-2px); transition: .12s; }
.card-static { opacity: .82; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 700; }
.card-when { color: var(--muted); font-size: 13px; margin-top: 8px; }
.card-cta { color: var(--brand-2); font-size: 12px; font-weight: 700; margin-top: 10px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.pill-ok { background: rgba(34,197,94,.18); color: #86efac; }
.pill-warn { background: rgba(245,158,11,.18); color: #fcd34d; }
.pill-err { background: rgba(239,68,68,.18); color: #fca5a5; }
.pill-gray { background: rgba(148,163,184,.18); color: #cbd5e1; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi-value { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.kpi-status-atingida, .kpi-status-bom { border-color: rgba(34,197,94,.5); }
.kpi-status-atencao { border-color: rgba(245,158,11,.5); }
.kpi-status-critico { border-color: rgba(239,68,68,.5); }

/* ---------- Progress ---------- */
.progress { position: relative; background: var(--panel-2); border-radius: 999px; height: 10px; overflow: hidden; }
.progress.big { height: 26px; margin: 14px 0; }
.progress-bar { background: linear-gradient(90deg, var(--brand), var(--brand-2)); height: 100%; border-radius: 999px; }
.progress-bar.status-atingida, .progress-bar.status-bom { background: linear-gradient(90deg, #16a34a, #4ade80); }
.progress-bar.status-atencao { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-bar.status-critico { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.pct { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; background: var(--panel); border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl th { background: var(--panel-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover, .tbl tbody tr:hover { background: rgba(255,255,255,.03); }
.row-muted { opacity: .55; }

/* ---------- Toolbar / filter ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; margin: 14px 0; flex-wrap: wrap; }
input[type="search"], input[type="text"], input[type="password"], select {
  background: var(--panel-2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; font: inherit; min-width: 220px;
}
input:focus, select:focus { outline: none; border-color: var(--brand); }

/* ---------- Forms / admin ---------- */
.grid-2 { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-reset { display: flex; gap: 6px; }
.inline-reset input { min-width: 120px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login-card .sub { margin: -6px 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}
