:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --amber-bg: #fef3c7;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 72px;
}

#app { max-width: 640px; margin: 0 auto; padding: 16px; }

.hidden { display: none !important; }

h1 { font-size: 1.4rem; margin: 4px 0 16px; }
h2 { font-size: 1.1rem; margin: 20px 0 10px; }

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

/* Tarjetas */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Formularios */
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 60px; }

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 11px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
button:active { transform: translateY(1px); }
button.secondary { background: #e2e8f0; color: var(--text); }
button.danger { background: var(--red); }
button.ghost { background: transparent; color: var(--primary); padding: 6px 8px; font-weight: 600; }
button.small { padding: 7px 10px; font-size: 0.85rem; }
button:disabled { opacity: 0.5; }
.btn-block { width: 100%; }

/* Login */
.login-wrap { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.login-wrap .logo { font-size: 3rem; text-align: center; }

/* Tareas */
.task { display: flex; align-items: flex-start; gap: 12px; }
.check {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border); background: #fff; flex: none;
  display: grid; place-items: center; font-size: 1rem; padding: 0;
  color: transparent;
}
.check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task.is-done .title { text-decoration: line-through; color: var(--muted); }
.title { font-weight: 600; }
.time { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; font-size: 0.72rem; padding: 2px 8px;
  border-radius: 999px; background: #e2e8f0; color: var(--muted); font-weight: 600;
}
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.red { background: #fee2e2; color: var(--red); }

/* Pestanas / chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 7px 12px; border-radius: 999px; background: #e2e8f0;
  color: var(--text); font-size: 0.85rem; font-weight: 600; border: none;
}
.chip.active { background: var(--primary); color: #fff; }

/* Navegacion inferior */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; background: none; color: var(--muted); font-size: 0.68rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; font-weight: 500; border-radius: 0;
}
.nav button span { font-size: 1.25rem; }
.nav button.active { color: var(--primary); }

/* Toast */
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 0.9rem; z-index: 50; max-width: 90%;
}
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.list-head { display: flex; justify-content: space-between; align-items: center; }
