:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --text: #14161f;
  --muted: #646a7d;
  --border: #e2e5ee;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-text: #ffffff;
  --danger-bg: #fdecec;
  --danger-text: #a12424;
  --shadow: 0 1px 2px rgba(20, 22, 31, .04), 0 8px 24px rgba(20, 22, 31, .06);
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a23;
    --text: #e8eaf1;
    --muted: #9298ab;
    --border: #2a2f3d;
    --accent: #6d66f0;
    --accent-hover: #827cf4;
    --danger-bg: #3a1c1f;
    --danger-text: #f3a5a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 600; margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }

/* ---- login ---- */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.card .brand { margin-bottom: 24px; }
.card .muted { margin: 0 0 24px; }

form { margin: 0; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input[type="text"], input[type="password"] {
  display: block; width: 100%;
  margin: 0 0 16px; padding: 10px 12px;
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

button {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 8px;
  padding: 10px 16px;
  background: var(--accent); color: var(--accent-text);
  transition: background .15s;
}
button:hover { background: var(--accent-hover); }
button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.card button { width: 100%; margin-top: 8px; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); padding: 6px 12px; }
button.ghost:hover { background: var(--bg); }

.alert {
  background: var(--danger-bg); color: var(--danger-text);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 16px;
  font-size: 14px;
}
.foot { font-size: 13px; margin-top: 20px; }

/* ---- dashboard ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar form { display: flex; align-items: center; gap: 12px; }
.who { font-size: 14px; }

.dash { max-width: 960px; margin: 0 auto; padding: 32px 24px 48px; }
.dash > .muted { margin: 0 0 24px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.tile .num { font-size: 32px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.02em; }
.tile .muted { margin: 0; font-size: 14px; }
.panel ul { margin: 12px 0 0; padding-left: 20px; }
.panel li { margin: 6px 0; }

@media (max-width: 520px) {
  .card { padding: 24px 20px; }
  .topbar { padding: 12px 16px; }
  .who { display: none; }
  .dash { padding: 24px 16px 40px; }
}
