:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #2563eb;
  --sidebar: #111113;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #e4e4e7; padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 600; font-size: 16px; padding: 0 8px; }
.brand span { color: #a1a1aa; font-weight: 400; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; color: #d4d4d8; }
.nav-item:hover { background: #1f1f23; }
.nav-item.active { background: #27272a; color: #fff; }
.nav-item.muted { color: #71717a; }
.soon { font-size: 11px; color: #71717a; border: 1px solid #3f3f46; border-radius: 4px; padding: 0 5px; }
.logout { margin-top: auto; padding: 8px 10px; color: #a1a1aa; font-size: 13px; }

.content { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.hint { color: var(--muted); margin: 0; }
.hint.small { font-size: 12px; margin: -8px 0 20px; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--panel); padding: 5px 11px; border-radius: 999px; font-size: 13px; }
.pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.pill.ghost { color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.kpi .v { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.kpi .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.accent .v { color: var(--accent); }

.charts, .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.two { grid-template-columns: 280px 1fr; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 20px; min-width: 0; }
.charts .panel, .two .panel { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 420px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
td { border-bottom: 1px solid #f1f1f3; padding: 6px 8px; white-space: nowrap; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
tr.total td { font-weight: 600; border-top: 1px solid var(--line); }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: #f4f4f5; }
.tag.added { background: #ecfdf5; color: #047857; }
.tag.removed { background: #fef2f2; color: #b91c1c; }

.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--sidebar); }
.login { background: var(--panel); padding: 28px; border-radius: 10px; width: 320px; display: flex; flex-direction: column; gap: 10px; }
.login .brand { padding: 0 0 8px; color: var(--text); }
.login label { font-size: 13px; color: var(--muted); }
.login input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.login button { margin-top: 6px; padding: 9px; border: 0; border-radius: 6px; background: var(--text); color: #fff; font-size: 14px; cursor: pointer; }
.error { color: #b91c1c; margin: 0; font-size: 13px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts, .two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  nav { flex-direction: row; }
  .logout { margin: 0 0 0 auto; }
  .content { padding: 20px 16px; }
}
