:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-tint: #eef2ff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-danger: #ef4444;
  --radius: 16px;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

:root[data-theme="verde"] {
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-tint: #d1fae5;
}

:root[data-theme="rosa"] {
  --color-primary: #f43f5e;
  --color-primary-dark: #e11d48;
  --color-primary-tint: #ffe4e6;
}

:root[data-theme="azul"] {
  --color-primary: #0ea5e9;
  --color-primary-dark: #0284c7;
  --color-primary-tint: #e0f2fe;
}

:root[data-theme="naranja"] {
  --color-primary: #f97316;
  --color-primary-dark: #ea580c;
  --color-primary-tint: #ffedd5;
}

:root[data-theme="negro"] {
  --color-primary: #3f3f46;
  --color-primary-dark: #18181b;
  --color-primary-tint: #f4f4f5;
}

:root[data-theme="lavanda"] {
  --color-primary: #a78bfa;
  --color-primary-dark: #7c3aed;
  --color-primary-tint: #f5f3ff;
}

:root[data-theme="menta"] {
  --color-primary: #2dd4bf;
  --color-primary-dark: #0d9488;
  --color-primary-tint: #f0fdfa;
}

:root[data-theme="rosita"] {
  --color-primary: #f9a8d4;
  --color-primary-dark: #db2777;
  --color-primary-tint: #fdf2f8;
}

:root[data-theme="durazno"] {
  --color-primary: #fdba9a;
  --color-primary-dark: #ea6b47;
  --color-primary-tint: #fff1eb;
}

:root[data-theme="azulnoche"] {
  --color-primary: #475569;
  --color-primary-dark: #1e293b;
  --color-primary-tint: #f1f5f9;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-spin {
  animation: icon-spin 0.8s linear infinite;
}

@keyframes icon-spin {
  to { transform: rotate(360deg); }
}

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

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px calc(104px + env(safe-area-inset-bottom));
}

.app-header {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.greeting {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.app-header h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.app-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-header-add {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.btn-header-add svg {
  width: 18px;
  height: 18px;
  display: block;
}

.model-status {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  margin: -8px 0 14px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  display: flex;
  background: var(--color-surface);
  border-radius: 999px;
  padding: 8px 6px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 10px 2px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-icon svg {
  width: 1em;
  height: 1em;
  display: block;
}

.nav-item.active {
  color: var(--color-primary);
}

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

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip-icon {
  width: 13px;
  height: 13px;
  display: flex;
  opacity: 0.85;
}

.chip-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chip-count {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
}

.chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
}

.chip-all.active {
  background: var(--color-text);
  color: #fff;
}

.chip.cat-escuela { background: #eef2ff; color: #4338ca; }
.chip.cat-trabajo { background: #dbeafe; color: #1d4ed8; }
.chip.cat-casa { background: #dcfce7; color: #15803d; }
.chip.cat-otro { background: #f1f5f9; color: #475569; }
.chip.cat-purple { background: #f3e8ff; color: #7e22ce; }
.chip.cat-teal { background: #ccfbf1; color: #0f766e; }

.chip.cat-escuela.active { background: #4338ca; color: #fff; box-shadow: 0 4px 10px rgba(67, 56, 202, 0.35); }
.chip.cat-trabajo.active { background: #1d4ed8; color: #fff; box-shadow: 0 4px 10px rgba(29, 78, 216, 0.35); }
.chip.cat-casa.active { background: #15803d; color: #fff; box-shadow: 0 4px 10px rgba(21, 128, 61, 0.35); }
.chip.cat-otro.active { background: #475569; color: #fff; box-shadow: 0 4px 10px rgba(71, 85, 105, 0.35); }
.chip.cat-purple.active { background: #7e22ce; color: #fff; box-shadow: 0 4px 10px rgba(126, 34, 206, 0.35); }
.chip.cat-teal.active { background: #0f766e; color: #fff; box-shadow: 0 4px 10px rgba(15, 118, 110, 0.35); }

.category-group {
  margin-bottom: 24px;
}

.category-group-header {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.category-group-header .icon {
  width: 14px;
  height: 14px;
}

.category-group-header.cat-escuela { background: #eef2ff; color: #4338ca; }
.category-group-header.cat-trabajo { background: #dbeafe; color: #1d4ed8; }
.category-group-header.cat-casa { background: #dcfce7; color: #15803d; }
.category-group-header.cat-otro { background: #f1f5f9; color: #475569; }
.category-group-header.cat-purple { background: #f3e8ff; color: #7e22ce; }
.category-group-header.cat-teal { background: #ccfbf1; color: #0f766e; }

.subject-group {
  margin-bottom: 14px;
}

.subject-group:last-child {
  margin-bottom: 0;
}

.subject-group-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 0 0 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.task-item {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: opacity 180ms ease, transform 180ms ease;
}

.task-item.enter {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

.task-item.leave {
  opacity: 0;
  transform: translateX(24px) scale(0.98);
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.task-body { flex: 1; cursor: pointer; }

.task-title {
  font-weight: 600;
  margin: 0 0 6px;
}

.task-description {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: -3px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge .icon {
  width: 12px;
  height: 12px;
}

.badge.date { background: #fef3c7; color: #b45309; }
.badge.no-date { background: #f1f5f9; color: var(--color-text-muted); }
.badge.overdue { background: #fee2e2; color: var(--color-danger); }
.badge.reminder { background: #ede9fe; color: #6d28d9; }

.badge.cat-escuela { background: #eef2ff; color: #4338ca; }
.badge.cat-trabajo { background: #dbeafe; color: #1d4ed8; }
.badge.cat-casa { background: #dcfce7; color: #15803d; }
.badge.cat-otro { background: #f1f5f9; color: #475569; }

.task-delete {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-delete .icon {
  width: 16px;
  height: 16px;
}

.task-pin {
  background: none;
  border: none;
  color: var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-pin .icon {
  width: 17px;
  height: 17px;
}

.task-pin.pinned {
  color: #f59e0b;
}

.task-pin.pinned .icon svg {
  fill: #f59e0b;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  margin-top: 60px;
  font-size: 15px;
}

.view-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.view-header-row h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-back svg {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-save-detail {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
}

.btn-save-detail svg {
  width: 18px;
  height: 18px;
  display: block;
}

.record-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
}

.record-pulse-ring {
  position: absolute;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  pointer-events: none;
}

.record-stage.recording .record-pulse-ring {
  animation: recording-pulse 1.8s ease-out infinite;
}

.record-stage.paused .record-pulse-ring {
  animation-play-state: paused;
  opacity: 0;
}

.record-stage.paused .record-avatar {
  opacity: 0.6;
}

.record-pulse-ring-delay {
  animation-delay: 0.9s;
}

.record-hold-btn {
  position: relative;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: 2px dashed var(--color-primary);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.record-hold-icon {
  display: flex;
}

.record-hold-icon svg {
  width: 48px;
  height: 48px;
  display: block;
}

.record-hold-btn.recording {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.record-avatar {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.record-avatar .avatar-svg {
  width: 100%;
  height: 100%;
}

.record-start-wrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.record-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  margin: 4px 0 18px;
}

.record-waveform .wave-bar {
  width: 3px;
  min-height: 4px;
  border-radius: 999px;
  background: var(--color-primary);
  transition: height 90ms ease;
}

.record-controls {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 36px;
  margin-top: 8px;
}

.record-ctrl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.record-ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.record-ctrl-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.record-ctrl-btn-primary {
  width: 64px;
  height: 64px;
  background: var(--color-primary);
  color: #fff;
  cursor: default;
}

.record-ctrl-btn-primary svg {
  width: 24px;
  height: 24px;
}

.record-ctrl-stop {
  color: #ef4444;
}

.record-ctrl-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.record-ctrl-label-stop {
  color: #ef4444;
}

.folder-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.folder-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--color-bg);
  font-size: 14px;
  font-weight: 600;
}

.folder-manage-item span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-manage-item .icon {
  width: 15px;
  height: 15px;
  color: var(--color-text-muted);
}

.folder-delete-btn {
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-delete-btn .icon {
  width: 16px;
  height: 16px;
}

.folder-empty-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 4px 0;
}

.folder-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.folder-add-row input {
  flex: 1;
}

.task-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: 90%;
  max-width: 420px;
}

.task-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.custom-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  margin: 0;
}

.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 999;
}

.add-choice-dialog {
  border: none;
  border-radius: 24px 24px 0 0;
  padding: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: fixed;
  inset: auto 0 0 0;
  animation: sheet-up 220ms ease;
}

.add-choice-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--color-border);
  margin: 10px auto 4px;
}

.add-choice-body {
  display: flex;
  flex-direction: column;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  gap: 10px;
}

.add-choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  border: none;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.add-choice-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
}

.add-choice-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.push-prompt-avatar {
  width: 84px;
  height: 84px;
  margin: 4px auto 4px;
}

.push-prompt-avatar .avatar-svg {
  width: 100%;
  height: 100%;
}

.push-prompt-title {
  text-align: center;
  font-size: 18px;
  margin: 4px 0 6px;
}

.push-prompt-text {
  text-align: center;
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin: 0 0 16px;
  line-height: 1.4;
}

.push-prompt-allow {
  width: 100%;
}

.add-choice-cancel {
  margin-top: 4px;
  padding: 12px;
  border-radius: 14px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.task-dialog form,
#view-settings {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#view-settings {
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.task-dialog form h2,
#view-settings h2 {
  margin: 0 0 12px;
}

.settings-section-title {
  margin: 18px 0 4px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-section-title:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.theme-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.theme-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 14px 0 0;
}

.theme-group-label:first-of-type {
  margin-top: 6px;
}

.theme-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.theme-swatch.active {
  border-color: var(--color-text);
}

.theme-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.theme-verde { background: linear-gradient(135deg, #10b981, #059669); }
.theme-rosa { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.theme-azul { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.theme-naranja { background: linear-gradient(135deg, #f97316, #ea580c); }
.theme-negro { background: linear-gradient(135deg, #3f3f46, #18181b); }
.theme-lavanda { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.theme-menta { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.theme-rosita { background: linear-gradient(135deg, #f9a8d4, #db2777); }
.theme-durazno { background: linear-gradient(135deg, #fdba9a, #ea6b47); }
.theme-azulnoche { background: linear-gradient(135deg, #475569, #1e293b); }

.task-dialog form label,
#view-settings label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 10px;
}

.task-dialog form input,
.task-dialog form select,
.task-dialog form textarea,
#view-settings input,
#view-settings select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 15px;
  font-family: inherit;
  width: 100%;
}

.autogrow {
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  max-height: 160px;
}

#view-add-text {
  padding: 4px 4px 24px;
  display: flex;
  flex-direction: column;
}

.type-selector {
  display: flex;
  gap: 6px;
  margin: 4px 0 4px;
}

.type-selector-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 4px;
  border-radius: 10px;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.type-selector-btn .icon {
  width: 14px;
  height: 14px;
}

.type-selector-btn.active {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
}

.section-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
}

.section-tab {
  flex: 1;
  padding: 9px 4px;
  border-radius: 10px;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.section-tab.active {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
}

.search-bar {
  margin: 0 0 16px;
}

.search-bar input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  color: var(--color-text);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.detail-timestamp {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 4px 0 14px;
}

.note-title-input {
  border: none;
  background: none;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  padding: 0;
  margin: 0 0 8px;
  font-family: inherit;
  width: 100%;
}

.note-title-input::placeholder {
  color: var(--color-text-muted);
  font-weight: 700;
}

.note-title-input:focus,
.note-body-input:focus {
  outline: none;
}

.note-body-input {
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  padding: 0;
  margin: 0;
  font-family: inherit;
  width: 100%;
  min-height: 140px;
}

.note-body-input:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  pointer-events: none;
}

.note-body-input img {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
  display: block;
}

.note-body-input ul {
  margin: 6px 0;
  padding-left: 22px;
}

.note-body-input li {
  margin-bottom: 4px;
}

.rte-toolbar {
  display: flex;
  gap: 6px;
  margin: 12px 0 14px;
}

.rte-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: none;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.rte-btn .icon,
.rte-btn svg {
  width: 17px;
  height: 17px;
}

.rte-btn:active {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
}

.detail-meta {
  background: var(--color-bg);
  border-radius: 14px;
  padding: 2px 12px;
  margin: 6px 0 22px;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
}

#pendiente-fields .detail-meta-row:last-of-type {
  border-bottom: none;
}

.detail-meta > .detail-meta-row:last-child {
  border-bottom: none;
}

.detail-meta-row label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}

.detail-meta-row label .icon {
  width: 15px;
  height: 15px;
  color: var(--color-primary-dark);
  flex-shrink: 0;
}

.detail-meta-value {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.detail-meta-value-split {
  gap: 6px;
  flex-wrap: wrap;
}

.detail-meta-row select,
.detail-meta-row input {
  border: none;
  background: none;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  font-family: inherit;
  text-align: right;
  width: auto;
  max-width: 100%;
}

.detail-meta-row select:focus,
.detail-meta-row input:focus {
  outline: none;
  color: var(--color-text);
}

.detail-meta #input-subject-custom {
  margin-top: 6px;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 4px;
}

.detail-meta .field-hint {
  margin: 6px 0 8px;
  font-size: 11.5px;
}


.btn-preview {
  margin-top: 16px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-preview .icon {
  width: 16px;
  height: 16px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 150ms ease;
}

.voice-progress-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 4px 0 0;
  text-align: center;
}

.daily-tip {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
}

.progress-hero {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.progress-hero .streak-number {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  margin: 0 0 4px;
}

.progress-hero p {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  opacity: 0.95;
}

.progress-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.progress-section-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.progress-section-value {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.progress-stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.progress-stat {
  flex: 1;
  background: var(--color-surface);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.progress-stat .stat-number {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary-dark);
}

.progress-stat .stat-label {
  display: block;
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.briefing-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.briefing-card p {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}

.btn-listen {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-listen .icon {
  width: 15px;
  height: 15px;
}

.btn-voice {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 2px dashed var(--color-primary);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 4px;
}

.voice-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  margin: 6px 0 4px;
}

.voice-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 6px 0 14px;
  text-align: center;
}

@keyframes recording-pulse {
  0% { transform: scale(0.6); opacity: 0.45; }
  100% { transform: scale(1.6); opacity: 0; }
}

#input-date.field-missing {
  border-color: #f59e0b;
  background: #fffbeb;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary.pulse {
  animation: pulse 0.6s ease-in-out 3;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

#onboarding-dialog,
#tutorial-dialog {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: #ffffff;
  padding: max(28px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}

#onboarding-dialog[open],
#tutorial-dialog[open] {
  display: flex;
  flex-direction: column;
}

#onboarding-dialog::backdrop,
#tutorial-dialog::backdrop {
  background: #ffffff;
}

#onboarding-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
}

.onboarding-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow-y: auto;
}

#tutorial-steps {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow-y: auto;
}

.onboarding-dialog h2 {
  text-align: center;
}

.onboarding-intro {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0 0 6px;
}

.onboarding-submit {
  width: 100%;
}

.onboarding-step .dialog-actions button {
  flex: 1;
}

.onboarding-welcome-avatar {
  width: 100px;
  height: 100px;
  margin: 8px auto 16px;
  opacity: 0;
  animation: onboarding-welcome-in 0.5s ease 0.1s forwards,
             splash-wave 0.6s ease-in-out 0.7s 2;
  transform-origin: 50% 85%;
}

.onboarding-welcome-avatar .avatar-svg {
  width: 100%;
  height: 100%;
}

.onboarding-welcome-title {
  text-align: center;
  opacity: 0;
  animation: onboarding-welcome-in 0.5s ease 0.5s forwards;
}

.onboarding-step[data-step="0"] .onboarding-intro {
  opacity: 0;
  animation: onboarding-welcome-in 0.5s ease 0.65s forwards;
}

.onboarding-step[data-step="0"] .dialog-actions {
  opacity: 0;
  animation: onboarding-welcome-in 0.5s ease 0.95s forwards;
}

@keyframes onboarding-welcome-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutorial-step {
  text-align: center;
  padding: 8px 0 4px;
}

.tutorial-step h2 {
  margin: 0 0 6px;
}

.tutorial-text {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 14px;
}

.tutorial-shot-wrap {
  position: relative;
  width: 100%;
  max-width: 230px;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  border: 6px solid #111827;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  background: #fff;
}

.tutorial-shot-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.tutorial-highlight {
  position: absolute;
  border: 3px solid #fbbf24;
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3), 0 0 0 9999px rgba(15, 23, 42, 0.45);
  pointer-events: none;
  animation: tutorial-pulse 1.6s ease-in-out infinite;
}

@keyframes tutorial-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.tutorial-callout {
  position: absolute;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  padding: 8px 12px;
  border-radius: 10px;
  width: max-content;
  max-width: 180px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.tutorial-callout-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.tutorial-callout.arrow-top .tutorial-callout-arrow {
  top: -6px;
  border-bottom: 6px solid #111827;
}

.tutorial-callout.arrow-bottom .tutorial-callout-arrow {
  bottom: -6px;
  border-top: 6px solid #111827;
}

.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 4px;
}

.tutorial-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
}

.tutorial-dots span.active {
  background: var(--color-primary);
  width: 18px;
  border-radius: 999px;
}

.tutorial-actions {
  justify-content: space-between;
}

.tutorial-actions button {
  flex: 1;
}

.settings-save {
  width: 100%;
  margin-top: 20px;
}

.settings-divider {
  border-top: 1px solid var(--color-border);
  margin: 24px 0 4px;
}

.settings-card {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-top: 24px;
}

.settings-card .settings-section-title {
  margin-top: 0;
}

.settings-saved-label {
  text-align: center;
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 13px;
  margin: 8px 0 0;
}

.field-error {
  color: var(--color-danger);
  font-size: 12px;
  margin: 4px 0 0;
}

.field-hint {
  color: var(--color-text-muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.note-item {
  padding-left: 16px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-nav h2 {
  margin: 0;
  font-size: 17px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

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

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.calendar-day.is-today {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
}

.calendar-day.is-selected {
  background: var(--color-primary);
  color: #fff;
}

.calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-primary-dark);
}

.calendar-day.is-selected .calendar-dot {
  background: #fff;
}

.calendar-dot.is-overdue {
  background: var(--color-danger);
}

.avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 16px 0 6px;
}

.avatar-intro .avatar-svg {
  width: 72px;
  height: 72px;
}

.avatar-caption {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.avatar-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: avatar-blink 4.2s ease-in-out infinite;
}

.avatar-eye:nth-of-type(2) {
  animation-delay: 0.08s;
}

.avatar-mouth {
  transform-box: fill-box;
  transform-origin: center;
}

.avatar-speaking .avatar-mouth {
  animation: avatar-talk 0.32s ease-in-out infinite;
}

@keyframes avatar-talk {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.45); }
}

@keyframes avatar-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}

.avatar-sway {
  transform-box: fill-box;
  transform-origin: center;
  animation: avatar-sway 3.2s ease-in-out infinite;
}

@keyframes avatar-sway {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(-3deg) translateY(-2px); }
}

.avatar-hand {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-hand-right {
  animation: avatar-wave 6s ease-in-out infinite;
}

@keyframes avatar-wave {
  0%, 78%, 100% { transform: rotate(0deg); }
  83% { transform: rotate(-18deg) translateY(-3px); }
  88% { transform: rotate(8deg); }
  93% { transform: rotate(-8deg); }
}

.avatar-touched .avatar-hand-left {
  transform: translate(24px, -30px) rotate(-18deg);
}

.avatar-touched .avatar-hand-right {
  animation: none;
  transform: translate(-24px, -30px) rotate(18deg);
}

.companion-fab {
  position: fixed;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 2px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  touch-action: none;
  z-index: 12;
  transition: left 200ms ease, right 200ms ease, bottom 200ms ease;
}

.companion-fab.nav-hidden {
  bottom: calc(20px + env(safe-area-inset-bottom));
}

.companion-fab.dragging {
  transition: none;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.3);
}

.companion-avatar-fab {
  width: 100%;
  height: 100%;
}

.faq-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.faq-header h2 {
  margin: 0;
  font-size: 18px;
  flex: 1;
}

.faq-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.chat-dialog {
  height: 72vh;
  max-height: 640px;
  display: flex;
}

.chat-dialog .faq-body {
  height: 100%;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
}

.chat-msg-bot {
  align-self: flex-start;
  background: var(--color-bg);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-shrink: 0;
}

.chat-input-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  color: var(--color-text);
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

.faq-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
}

.faq-answer {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.splash-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 999;
  transition: opacity 400ms ease;
}

.splash-screen.hide {
  opacity: 0;
  pointer-events: none;
}

.splash-avatar-wrap {
  width: 110px;
  height: 110px;
  transform-origin: 50% 85%;
  animation: splash-wave 1.6s ease-in-out infinite;
}

.splash-avatar-wrap .avatar-svg {
  width: 100%;
  height: 100%;
}

.splash-welcome {
  color: var(--color-primary);
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
}

.splash-cursor {
  display: inline-block;
  width: 2px;
  height: 24px;
  margin-left: 3px;
  background: var(--color-primary);
  animation: splash-blink 0.8s step-end infinite;
}

@keyframes splash-blink {
  50% { opacity: 0; }
}

@keyframes splash-wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* ==========================================================================
   Desktop / web layout — mobile is untouched below this breakpoint.
   ========================================================================== */
@media (min-width: 900px) {
  body {
    background: var(--color-bg);
  }

  .app {
    max-width: 1000px;
    padding: 40px 40px 40px calc(96px + 40px);
  }

  .app-header h1 {
    font-size: 28px;
  }

  .app-header {
    margin-bottom: 28px;
  }

  /* Give the content its own defined panel instead of floating loose in the wide shell. */
  main {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 36px 40px;
    box-shadow: var(--shadow);
  }

  /* Bottom pill nav becomes a fixed left sidebar rail. */
  .bottom-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 96px;
    height: 100vh;
    max-width: none;
    transform: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    border-radius: 0;
    box-shadow: 2px 0 20px rgba(15, 23, 42, 0.08);
    padding: 0;
    z-index: 10;
  }

  .nav-item {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
  }

  .nav-item .nav-icon {
    font-size: 24px;
  }

  /* Card lists flow into columns instead of a single stacked column. */
  .task-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-items: start;
    gap: 14px;
  }

  /* Form-heavy views stay a comfortable reading width even in the wider shell. */
  #view-add-text,
  #view-add-voice,
  #view-settings,
  #view-progress {
    max-width: 560px;
    margin: 0 auto;
  }
}

.birthday-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 400ms ease;
  overflow: hidden;
}

.birthday-overlay.hide {
  opacity: 0;
  pointer-events: none;
}

.birthday-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.birthday-confetti span {
  position: absolute;
  top: -40px;
  left: calc(4% * var(--i));
  font-size: 22px;
  animation: birthday-fall 3.2s linear infinite;
  animation-delay: calc(var(--i) * 0.15s);
}

@keyframes birthday-fall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0.9; }
}

.birthday-card {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 32px 26px 26px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: birthday-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes birthday-pop {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.birthday-avatar {
  width: 90px;
  height: 90px;
  margin: 0 auto 14px;
  animation: splash-wave 1.4s ease-in-out infinite;
  transform-origin: 50% 85%;
}

.birthday-avatar .avatar-svg {
  width: 100%;
  height: 100%;
}

.birthday-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.birthday-card p {
  margin: 0 0 20px;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.birthday-card .btn-primary {
  width: 100%;
}
