:root {
  color-scheme: light;
  font-family: Inter, Manrope, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

html[data-theme="cobalt-dark"] {
  color-scheme: dark;
  --bg: #090d17;
  --sidebar: #0d1322;
  --panel: #121a2b;
  --panel2: #182238;
  --line: #2a3650;
  --text: #f3f6fc;
  --muted: #96a3b9;
  --accent: #6f8cff;
  --accent2: #f59e42;
  --danger: #ff6f7d;
  --shadow: 0 20px 55px rgba(0,0,0,.34);
}

html[data-theme="cobalt-light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel2: #f0f3fa;
  --line: #d8deea;
  --text: #172033;
  --muted: #68748a;
  --accent: #3858d6;
  --accent2: #d97722;
  --danger: #cf3f56;
  --shadow: 0 14px 38px rgba(35,49,83,.10);
}

html[data-theme="arctic-light"] {
  color-scheme: light;
  --bg: #f3f8fc;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel2: #edf5fb;
  --line: #cfdeea;
  --text: #132238;
  --muted: #60748a;
  --accent: #2563eb;
  --accent2: #0891b2;
  --danger: #dc2626;
  --shadow: 0 14px 38px rgba(30,64,175,.10);
}

html[data-theme="graphite-dark"] {
  color-scheme: dark;
  --bg: #111318;
  --sidebar: #16191f;
  --panel: #1d2129;
  --panel2: #262b35;
  --line: #383f4c;
  --text: #f5f7fb;
  --muted: #a5adba;
  --accent: #8b5cf6;
  --accent2: #f59e0b;
  --danger: #fb7185;
  --shadow: 0 20px 55px rgba(0,0,0,.32);
}

body {
  background:
    radial-gradient(circle at 84% -10%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 34%),
    var(--bg);
}

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 460px); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: linear-gradient(145deg, var(--accent), var(--accent2)); color: #fff; font-weight: 900; letter-spacing: .04em; box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 28%, transparent); }
.eyebrow { margin: 18px 0 6px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
.muted { color: var(--muted); }
.stack-form { display: grid; gap: 14px; margin-top: 22px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 800; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel2); color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 15px; border-radius: 11px; border: 1px solid transparent; font-weight: 900; cursor: pointer; }
.primary-button { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, #ffffff)); color: #fff; }
.secondary-button { background: var(--panel2); color: var(--text); border-color: var(--line); }
.full { width: 100%; }
.alert { margin: 16px 0; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel2); }
.alert.error { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); }
.alert.success { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { padding: 24px 18px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.sidebar-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: .75rem; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { color: var(--muted); margin-top: 3px; }
.nav { display: grid; gap: 7px; }
.nav a { padding: 11px 12px; border-radius: 10px; color: var(--muted); font-weight: 800; }
.nav a:hover, .nav a.active { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, var(--panel2)); }
.main { min-width: 0; padding: 26px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-select { min-width: 190px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.card .kpi { font-size: 1.8rem; font-weight: 900; margin: 8px 0 3px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.module-card { min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; }
.module-card .module-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--accent) 14%, var(--panel2)); color: var(--accent); font-weight: 900; }
.module-card small { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, var(--panel2)); color: var(--accent); font-size: .76rem; font-weight: 900; }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .main { padding: 18px; }
  .topbar { flex-direction: column; }
  .grid, .module-grid, .nav { grid-template-columns: 1fr; }
}
