/* ===== Tokens ===== */
:root {
  --bg: #0b0d10;
  --surface: #15181d;
  --surface-2: #1e2229;
  --border: #2a2f37;
  --text: #e8eaed;
  --text-muted: #9aa1ab;
  --accent: #22d3ee;
  --accent-contrast: #062a31;
  --danger: #f87171;
  --success: #4ade80;

  --radius: 14px;
  --gap: 16px;
  --tabbar-h: 60px;
  --topbar-h: 52px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;

  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(var(--gap) + var(--safe-right)) 0 calc(var(--gap) + var(--safe-left));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.25rem; font-weight: 700; }

/* ===== Conteúdo ===== */
.view {
  padding: var(--gap) calc(var(--gap) + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + var(--gap)) calc(var(--gap) + var(--safe-left));
  max-width: 720px;
  margin: 0 auto;
  outline: none;
}

/* ===== Tabbar (inferior) ===== */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
}

.tab svg { width: 24px; height: 24px; }

.tab[aria-current="page"] { color: var(--accent); }

/* ===== Componentes ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}

.card h2 { font-size: 1.05rem; margin-bottom: 8px; }
.card p { margin: 0; }

.muted { color: var(--text-muted); }

.empty {
  text-align: center;
  padding: 48px var(--gap);
  color: var(--text-muted);
}

.empty svg { width: 48px; height: 48px; opacity: 0.5; margin-bottom: 12px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
  cursor: pointer;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  font-size: 0.9rem;
}

.toast.erro { border-color: var(--danger); }
.toast.ok { border-color: var(--success); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform 0.1s ease; }
}
