:root {
  --bg: #0b1117;
  --panel: #151c25;
  --panel-2: #1d2734;
  --line: #2a3645;
  --fg: #e6eaf0;
  --muted: #8c97a8;
  --accent: #ff8a00;
  --accent-2: #ffb04f;
  --ok: #22c55e;
  --warn: #f59e0b;
  --crit: #ef4444;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--fg); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #1a2330 0%, #08090d 80%); }
.login-card { width: 380px; padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.brand { text-align: center; }
.brand h1 { margin: 8px 0 2px; font-size: 22px; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; background: var(--accent); color: #1c1409; border-radius: 12px; font-weight: 800; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.login-card input { padding: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; font-size: 16px; }
.login-card button { padding: 12px; background: var(--accent); color: #1c1409; border: none; border-radius: 8px; font-weight: 700; font-size: 15px; }
.login-card button:hover { background: var(--accent-2); }
.error { color: var(--crit); background: rgba(239,68,68,.1); padding: 10px; border-radius: 6px; font-size: 14px; text-align: center; }

#app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 8px; padding: 16px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.brand-row .logo { width: 32px; height: 32px; font-size: 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.sidebar nav a { padding: 10px 12px; border-radius: 8px; color: var(--fg); font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--panel-2); color: var(--accent-2); }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; }
.logout { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px; border-radius: 8px; }
.logout:hover { color: var(--fg); border-color: var(--muted); }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok { background: rgba(34,197,94,.15); color: var(--ok); }
.pill-warn { background: rgba(245,158,11,.15); color: var(--warn); }
.pill-crit { background: rgba(239,68,68,.18); color: var(--crit); }
.pill-muted { background: rgba(140,151,168,.15); color: var(--muted); }

.view { padding: 24px 28px; overflow: auto; }
.view h1 { margin-top: 0; font-size: 22px; }
.view h2 { font-size: 16px; color: var(--muted); margin: 24px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.spinner { padding: 20px; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; font-size: 14px; min-width: 220px; }
.toolbar button { padding: 9px 14px; background: var(--accent); color: #1c1409; border: none; border-radius: 8px; font-weight: 600; }

table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.data th { background: var(--panel-2); color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--panel-2); cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }

.cal-grid { display: grid; grid-template-columns: 80px 1fr; gap: 0; }
.cal-day { padding: 12px; border-top: 1px solid var(--line); }
.cal-day h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent-2); }
.cal-event { padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; margin-bottom: 6px; }

.log-row { display: grid; grid-template-columns: 90px 70px 1fr 80px; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.log-row.error { color: var(--crit); }
.log-row.warn  { color: var(--warn); }
.log-row .ts { font-variant-numeric: tabular-nums; color: var(--muted); }
