/* ZARD Energia — Apple-inspired, azul, dark/light/system. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --border: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.1);
  --positive: #1f9d55;
  --danger: #d70015;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: -apple-system, "SF Pro Text", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --border: rgba(255, 255, 255, 0.1);
    --text: #f5f5f7; --muted: #98989d; --accent: #339af0; --accent-soft: rgba(51, 154, 240, 0.16);
    --positive: #30d158; --danger: #ff453a; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --border: rgba(255, 255, 255, 0.1);
  --text: #f5f5f7; --muted: #98989d; --accent: #339af0; --accent-soft: rgba(51, 154, 240, 0.16);
  --positive: #30d158; --danger: #ff453a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2 { letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.positive { color: var(--positive); }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px; background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-size: 17px; }
.brand span { color: var(--accent); }
.brand-lg { font-size: 28px; margin-bottom: 4px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; }
.nav a[aria-current="page"], .nav a:hover { color: var(--text); background: var(--surface-2); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions form { margin: 0; }
.who { color: var(--muted); font-size: 14px; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font: 600 15px var(--font); cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 16px var(--font); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--accent-soft); }
.flash-error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { margin-bottom: 24px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); padding: 36px 32px; border-radius: 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow); }
.auth-card form { margin-top: 28px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-accent { background: var(--accent); color: #fff; border-color: transparent; }
.stat-accent .stat-label { color: rgba(255, 255, 255, 0.8); }
.stat-label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0 0 16px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge { align-self: flex-start; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.empty { text-align: center; padding: 64px 16px; }
.empty h1, .empty h2 { margin-bottom: 8px; }
.empty .btn { margin-top: 20px; }
.empty-inline { margin: 0 0 16px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--accent); margin: 0; letter-spacing: -0.04em; }

@media (max-width: 768px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .who { display: none; }
  .container { padding: 24px 16px 48px; }
  .cards { grid-template-columns: 1fr; }
}
