:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-border: #262b36;
  --text: #eef0f4;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #34d399;
  --danger: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.brand { font-weight: 700; font-size: 1.2rem; }

.tabs { display: flex; gap: 8px; }

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.screen.hidden { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 { margin-top: 0; font-size: 1.05rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.card-grid.two-col { grid-template-columns: 1fr 1fr; }

@media (max-width: 800px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .card-grid.two-col { grid-template-columns: 1fr; }
}

.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 0.75rem; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select {
  background: #0f1115;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}

input:focus, select:focus { outline: 1px solid var(--accent); }

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 12px;
}

.btn-primary:hover { opacity: 0.9; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form.stacked { flex-direction: column; align-items: stretch; }

.check-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.muted { color: var(--muted); font-size: 0.9rem; }

.onboarding-card { max-width: 640px; margin: 40px auto; }

.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

.checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #0f1115;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

.checklist li.done { border-color: var(--accent-2); }
.checklist li.done .dot { background: var(--accent-2); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--card-border); flex-shrink: 0; }

.ai-output {
  margin-top: 16px;
  padding: 16px;
  background: #0f1115;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.92rem;
  min-height: 20px;
}

.ai-output:empty { display: none; }

.ai-output.loading { color: var(--muted); font-style: italic; }

#historial-hoy .item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.9rem;
}

#historial-hoy .item:last-child { border-bottom: none; }

hr { border: none; border-top: 1px solid var(--card-border); margin: 20px 0; }
