:root {
  color-scheme: light;
  --bg: #eef2f7;
  --panel: #ffffff;
  --text: #16202d;
  --muted: #5a6777;
  --line: #d7dde6;
  --brand: #1859ff;
  --brand-soft: #e8efff;
  --danger: #c83d32;
}

* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
input, textarea, select { width: 100%; padding: 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; }
textarea { min-height: 120px; resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.75rem 1rem; border: 0; border-radius: 12px; background: var(--brand); color: white; font: inherit; cursor: pointer; }
button.secondary, .button.secondary { background: #f3f6fb; color: var(--text); }
button.danger { background: var(--danger); }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; padding: 1.5rem 1rem; background: #111827; color: white; display: flex; flex-direction: column; gap: 1rem; }
.brand { padding: 0.5rem 0.75rem 1rem; font-size: 1.25rem; font-weight: 700; }
.nav-link { display: block; padding: 0.7rem 0.9rem; margin-bottom: 0.35rem; border-radius: 12px; color: #d6def0; }
.nav-link.active, .nav-link:hover { background: rgba(255,255,255,0.12); color: white; }
.logout { margin-top: auto; display: block; padding: 0.8rem 0.9rem; border-radius: 12px; background: rgba(255,255,255,0.08); color: white; }

.page { padding: 2rem; }
.page.with-sidebar { margin-left: 240px; }
.card { background: var(--panel); border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px; padding: 1.25rem; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06); }
.grid { display: grid; gap: 1rem; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.1fr 1.4fr; }
.stat span { display: block; color: var(--muted); margin-bottom: 0.4rem; }
.stat strong { font-size: 1.8rem; }
.stack { display: grid; gap: 0.9rem; }
.actions, .filters { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; }
.small { padding: 0.45rem 0.7rem; font-size: 0.875rem; }
.active-filter { outline: 2px solid var(--brand); }
.alert { padding: 0.85rem 1rem; border-radius: 14px; margin-bottom: 1rem; }
.alert.error { background: #feeceb; color: #8b1e17; }
.alert.success { background: #e8f8ef; color: #145a32; }
.alert.warning { background: #fff6df; color: #7a5410; }
.muted { color: var(--muted); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(420px, 100%); }

@media (max-width: 1100px) {
  .grid.four, .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .sidebar { position: static; width: auto; }
  .page.with-sidebar { margin-left: 0; }
  .page { padding: 1rem; }
}