:root {
  --bg: #0b0b0d;
  --bg-elev: #141418;
  --bg-card: #1a1a20;
  --bg-card-hover: #22222a;
  --line: #2c2c34;
  --text: #f4f1ea;
  --muted: #9a9588;
  --accent: #e8b84a;
  --accent-dim: rgba(232, 184, 74, 0.16);
  --success: #3ecf8e;
  --danger: #e85d4c;
  --discipline: #c9a0dc;
  --fitness: #e8b84a;
  --mindset: #7eb8ff;
  --work: #ff9f6b;
  --growth: #3ecf8e;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
body {
  min-height: 100dvh;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px; /* avoid iOS zoom */
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }

#app { min-height: 100dvh; }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(12px + var(--safe-t)) 16px 10px;
  background: linear-gradient(to bottom, #0b0b0d 70%, rgba(11,11,13,0.88) 100%);
  backdrop-filter: blur(10px);
}
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.logo {
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--accent);
  margin: 0;
}
.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--text);
  font-size: 20px;
}
.icon-btn:active { background: var(--bg-card); }
.icon-btn[aria-label="Settings"] { font-size: 22px; }
.header-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn.text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: auto;
  padding: 0 8px;
  color: var(--muted);
}
.icon-btn.text:active { color: var(--text); }

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 4px;
}
.date-label {
  flex: 1;
  text-align: center;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}
.date-label strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.date-label span {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.today-chip {
  display: none;
  margin: 4px auto 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 36px;
}
.today-chip.show { display: inline-flex; align-items: center; }

.progress {
  margin: 10px 16px 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-row b { color: var(--text); font-weight: 700; }
.bar {
  height: 8px;
  background: #2a2a30;
  border-radius: 99px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9a227, var(--accent));
  border-radius: 99px;
  transition: width 0.35s ease;
}
.progress.done { border-color: rgba(62, 207, 142, 0.4); }
.progress.done .bar > i { background: var(--success); }

/* Main */
.main {
  padding: 14px 16px calc(108px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.install-banner {
  background: var(--accent-dim);
  border: 1px solid rgba(232, 184, 74, 0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.install-banner p { margin: 0; font-size: 14px; line-height: 1.4; flex: 1; }
.install-banner button.link {
  color: var(--accent);
  font-weight: 700;
  min-height: 32px;
}
button.link, .link {
  color: var(--accent);
  font-weight: 700;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: inherit;
}


.category {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 8px;
}
.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}
.cat-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  flex: 1;
}
.cat-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.cat-count.done { color: var(--success); }

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 8px 8px 8px 14px;
  border-top: 1px solid var(--line);
  width: 100%;
  text-align: left;
}
.task:active { background: var(--bg-card-hover); }
.check {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 2px solid #6a675e;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 16px;
  font-weight: 800;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.task.done .check {
  background: var(--success);
  border-color: var(--success);
  color: #0b0b0d;
}
.task-body { flex: 1; min-width: 0; }
.task-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.task.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.streak {
  margin-top: 3px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.more {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 20px;
  letter-spacing: 2px;
}
.more:active { background: var(--bg); color: var(--text); }

.add-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.add-inline:active { color: var(--accent); background: var(--bg-card-hover); }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin: 0 0 8px; font-size: 20px; }
.empty p { margin: 0 0 20px; line-height: 1.45; }

/* FAB */
.fab-wrap {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--safe-b));
  z-index: 30;
  display: flex;
  gap: 8px;
}
.fab {
  flex: 1;
  min-height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: #1a1406;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(232, 184, 74, 0.28);
}
.fab:active { transform: scale(0.98); }
.fab-side {
  min-width: 56px;
  min-height: 56px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1.1;
  text-align: center;
  padding: 6px;
}

/* Sheets & modals */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.scrim.center { align-items: center; padding: 24px; }
.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--bg-elev);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + var(--safe-b));
  max-height: min(92dvh, 920px);
  overflow: auto;
  animation: up 0.22s ease;
}
.scrim.center .sheet {
  border-radius: 24px;
  animation: pop 0.22s ease both;
  padding: 28px 22px 22px;
  background: #1c1c24;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}
@keyframes up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.handle {
  width: 40px;
  height: 4px;
  background: #3a3a42;
  border-radius: 99px;
  margin: 6px auto 14px;
}
.sheet h3 {
  margin: 0 0 14px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 0;
}
.toggle span { font-weight: 650; }
.switch {
  width: 52px;
  height: 32px;
  border-radius: 99px;
  background: #3a3a42;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}
.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  background: white;
  border-radius: 50%;
  transition: left 0.15s;
}
.switch.on { background: var(--accent); }
.switch.on i { left: 23px; }

.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
  background: var(--accent);
  color: #1a1406;
}
.btn.ghost {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger {
  background: rgba(232, 93, 76, 0.16);
  color: #ff8d80;
}
.btn:active { transform: scale(0.98); }

.row-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 4px 10px 0;
  border-bottom: 1px solid var(--line);
}
.row-card .meta { flex: 1; min-width: 0; }
.row-card .meta b { display: block; font-size: 16px; }
.row-card .meta small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.pill {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

/* Quote celebration */
.quote-card { text-align: center; }
.kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
}
.kicker.big { color: var(--success); }
.quote-card blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.quote-card .author {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.quote-card .context {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.quote-list .item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.quote-list .item q {
  font-family: var(--serif);
  font-size: 16px;
  quotes: none;
  display: block;
  line-height: 1.4;
}
.quote-list .item small { color: var(--muted); display: block; margin-top: 6px; }

.theme-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}
.theme-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.theme-tabs button.on {
  background: var(--accent);
  color: #1a1406;
  border-color: var(--accent);
}

.hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}
.ol-steps {
  margin: 0 0 16px;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.55;
}
.ol-steps li { margin: 8px 0; }

.hidden-date {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

@media (min-width: 720px) {
  .top, .main { max-width: 560px; margin-left: auto; margin-right: auto; }
  .fab-wrap { left: 50%; right: auto; width: 528px; transform: translateX(-50%); }
}

/* Language switcher and long-text layout */
html, body { overflow-x: hidden; }
.top-row { flex-wrap: wrap; }
.logo { min-width: 0; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 68%; }
.icon-btn.text { letter-spacing: 0.04em; font-size: 10.5px; padding: 0 6px; white-space: nowrap; }
html[lang="es"] .icon-btn.text,
html[lang="fil"] .icon-btn.text { letter-spacing: 0.02em; }
.progress-row { gap: 8px; flex-wrap: wrap; }
.install-banner { flex-wrap: wrap; }
.install-actions { flex-shrink: 0; }
.fab { padding: 0 16px; line-height: 1.2; }
.btn { padding: 8px 12px; line-height: 1.2; }
.quote-card blockquote { font-size: clamp(18px, 5.4vw, 24px); overflow-wrap: break-word; }
.task-title, .hint, .context, .sheet h3, .item q { overflow-wrap: break-word; }
.cat-head h2 { overflow-wrap: break-word; min-width: 0; }
.lang-list { display: flex; flex-direction: column; gap: 8px; }
.lang-option {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  padding: 0 16px;
  font-weight: 700;
  font-size: 16px;
}
.lang-option.on {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.backup-nudge {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.backup-nudge p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}
.nudge-close {
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.nudge-close:active { background: var(--bg); color: var(--text); }
.backup-meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.backup-overdue {
  color: var(--accent);
  margin: -4px 0 12px;
}
