/* ════════════════════════════════════════════════════════════════════════════
   Navegación compartida + tema "pro" (calendario, notas, recordatorios).
   Los cumpleaños mantienen el estilo original de Aztuzaiak (theme/app.css).
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --tabbar-h: 60px;
  --rail-w: 96px;

  --p-bg: #0B0B0E;
  --p-panel: #111115;
  --p-elev: #17171C;
  --p-hover: #1C1C22;
  --p-border: #222229;
  --p-border-2: #2D2D35;
  --p-text: #ECECF1;
  --p-text-2: #A1A1AC;
  --p-text-3: #6C6C78;
  --p-accent: #7C83FF;
  --p-accent-hover: #9097FF;
  --p-accent-weak: rgba(124, 131, 255, 0.14);
  --p-accent-ring: rgba(124, 131, 255, 0.4);
  --p-bday: #F472B6;
  --p-danger: #F87171;
  --p-ok: #4ADE80;
  --p-warn: #FBBF24;
  --p-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ── Pantallas ── */
.screen { height: 100vh; height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
html.nav-anim .screen.active { animation: screen-in 0.16s ease-out; }

/* Antes de que arranque nav.js, la pantalla visible la decide el atributo
   data-screen que pone el script del <head> según la URL. */
html:not(.nav-ready)[data-screen="screenCalendar"] #screenCalendar,
html:not(.nav-ready)[data-screen="screenNotes"] #screenNotes,
html:not(.nav-ready)[data-screen="screenHome"] #screenHome,
html:not(.nav-ready)[data-screen="screenSettings"] #screenSettings,
html:not(.nav-ready)[data-screen="screenHistory"] #screenHistory { display: flex; }
html:not(.nav-ready)[data-screen="screenCalendar"] .tabbar-item[data-screen="screenCalendar"],
html:not(.nav-ready)[data-screen="screenNotes"] .tabbar-item[data-screen="screenNotes"],
html:not(.nav-ready)[data-screen="screenHome"] .tabbar-item[data-screen="screenHome"],
html:not(.nav-ready)[data-screen="screenSettings"] .tabbar-item[data-screen="screenSettings"] { color: var(--p-text); }
@keyframes screen-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
h1 { margin: 0; }

/* ── Barra de navegación (móvil abajo, escritorio a la izquierda) ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(11, 11, 14, 0.94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--p-border);
  max-width: 480px; margin: 0 auto;
  font-family: 'Inter', system-ui, sans-serif;
}
.tabbar-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; color: var(--p-text-3); cursor: pointer;
  font-family: inherit; font-size: 10.5px; font-weight: 500;
  transition: color 0.15s;
}
.tabbar-item svg { transition: transform 0.15s var(--p-ease); }
.tabbar-item:active svg { transform: scale(0.88); }
.tabbar-item.active { color: var(--p-text); }
.tabbar-item.active svg { color: var(--p-accent); }

.fab { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
.toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 84px); }
.list { padding-bottom: 110px; }

/* ── Toast con acción (Deshacer) ── */
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding-right: 8px; }
.toast-action {
  background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: #4F46E5;
}

/* ════════════════════════════ TEMA PRO ════════════════════════════ */
.pro {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px; line-height: 1.45;
  color: var(--p-text); background: var(--p-bg);
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  -webkit-font-smoothing: antialiased;
}
.pro ::-webkit-scrollbar { width: 10px; height: 10px; }
.pro ::-webkit-scrollbar-thumb { background: #26262E; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.pro ::-webkit-scrollbar-track { background: transparent; }

.pro kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 500; line-height: 16px;
  color: var(--p-text-3); background: var(--p-panel);
  border: 1px solid var(--p-border-2); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 5px; min-width: 18px; text-align: center;
}

/* Botones */
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 7px; flex-shrink: 0;
  border: 1px solid var(--p-border-2); background: var(--p-elev); color: var(--p-text);
  font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pbtn:hover { background: var(--p-hover); border-color: #3A3A44; }
.pbtn:active { transform: translateY(0.5px); }
.pbtn-primary { background: var(--p-accent); border-color: transparent; color: #fff; }
.pbtn-primary:hover { background: var(--p-accent-hover); border-color: transparent; }
.pbtn-primary kbd { background: transparent; color: rgba(255, 255, 255, 0.75); border-color: rgba(255, 255, 255, 0.28); }
.pbtn-block { width: 100%; justify-content: flex-start; height: 36px; }
.pbtn-block kbd { margin-left: auto; }
.pbtn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.pbtn-ghost-danger { background: transparent; border-color: transparent; color: var(--p-danger); padding: 0 8px; }
.pbtn-ghost-danger:hover { background: rgba(248, 113, 113, 0.1); border-color: transparent; }

.pibtn {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--p-border-2); background: var(--p-elev); color: var(--p-text-2);
  cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pibtn:hover { background: var(--p-hover); color: var(--p-text); }
.pibtn-sm { width: 26px; height: 26px; border-radius: 6px; border-color: transparent; background: transparent; }
.pibtn-danger:hover { color: var(--p-danger); }

.pgroup { display: inline-flex; }
.pgroup .pibtn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pgroup .pibtn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }

.pseg {
  display: inline-flex; padding: 2px; gap: 2px; flex-shrink: 0;
  background: var(--p-panel); border: 1px solid var(--p-border); border-radius: 8px;
}
.pseg button {
  height: 26px; padding: 0 11px; border-radius: 6px; border: none; background: none;
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--p-text-2); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.pseg button:hover { color: var(--p-text); }
.pseg button.active { background: var(--p-elev); color: var(--p-text); box-shadow: 0 0 0 1px var(--p-border-2), 0 1px 2px rgba(0, 0, 0, 0.4); }

.pro .wa-status-btn { height: 32px; padding: 0 10px; border-radius: 7px; flex-shrink: 0; }
.pro .wa-btn-text { font-size: 12px; }

.pfab .fab-main {
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--p-accent); color: #fff;
  box-shadow: 0 10px 28px rgba(124, 131, 255, 0.35);
}

/* ── Calendario: estructura ── */
.pc-layout { flex: 1; display: flex; min-height: 0; }
.pc-side { display: none; }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

.pc-toolbar {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--p-border); flex-shrink: 0;
}
.pc-toolbar-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-title {
  flex: 1; min-width: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-title::first-letter { text-transform: uppercase; }

.pquick, .psearch {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px; border-radius: 7px;
  background: var(--p-panel); border: 1px solid var(--p-border-2); color: var(--p-text-3);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.pquick:focus-within, .psearch:focus-within { border-color: var(--p-accent-ring); box-shadow: 0 0 0 3px var(--p-accent-weak); color: var(--p-accent); }
.pquick input, .psearch input {
  flex: 1; min-width: 0; height: 100%; background: none; border: none; outline: none;
  font-family: inherit; font-size: 13px; color: var(--p-text);
}
.pquick input::placeholder, .psearch input::placeholder { color: var(--p-text-3); }
.pseg-desktop { display: none; }

.pc-cal { flex: 1; min-height: 0; }

/* ── Minicalendario ── */
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; padding-left: 4px; }
.mini-title { font-size: 13px; font-weight: 600; }
.mini-title::first-letter { text-transform: uppercase; }
.mini-nav { display: flex; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-wd { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--p-text-3); line-height: 24px; text-transform: uppercase; }
.mini-day {
  position: relative; height: 30px; border: none; border-radius: 6px; background: none; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--p-text-2);
  transition: background 0.1s;
}
.mini-day:hover { background: var(--p-hover); color: var(--p-text); }
.mini-day.other { color: var(--p-text-3); opacity: 0.55; }
.mini-day.today { color: var(--p-accent); font-weight: 700; }
.mini-day.focus { background: var(--p-accent); color: #fff; font-weight: 600; }
.mini-day.busy::after {
  content: ''; position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--p-accent);
}
.mini-day.focus.busy::after { background: #fff; }

/* ── Próximos ── */
.pside-title { font-size: 11px; font-weight: 600; color: var(--p-text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px 4px; }
.up-item {
  display: flex; gap: 10px; width: 100%; padding: 7px 8px; border: none; border-radius: 7px;
  background: none; color: var(--p-text); font-family: inherit; text-align: left; cursor: pointer;
  transition: background 0.1s;
}
.up-item:hover { background: var(--p-hover); }
.up-bar { width: 3px; min-height: 32px; align-self: stretch; border-radius: 2px; background: var(--p-accent); flex-shrink: 0; }
.up-item.bday .up-bar { background: var(--p-bday); }
.up-main { display: flex; flex-direction: column; min-width: 0; }
.up-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-when { font-size: 12px; color: var(--p-text-3); }
.up-when::first-letter { text-transform: uppercase; }
.up-empty { font-size: 12px; color: var(--p-text-3); padding: 4px; }

.plegend { margin-top: auto; display: flex; gap: 14px; font-size: 12px; color: var(--p-text-3); padding: 0 4px; }
.plegend > span { display: inline-flex; align-items: center; }
.plegend-dot { width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.plegend-dot.rem { background: var(--p-accent); }
.plegend-dot.bday { background: var(--p-bday); }

/* ── FullCalendar: tema oscuro ── */
.pro .fc {
  --fc-border-color: var(--p-border);
  --fc-page-bg-color: var(--p-bg);
  --fc-neutral-bg-color: var(--p-panel);
  --fc-neutral-text-color: var(--p-text-3);
  --fc-today-bg-color: rgba(124, 131, 255, 0.05);
  --fc-now-indicator-color: #F87171;
  --fc-highlight-color: rgba(124, 131, 255, 0.14);
  --fc-list-event-hover-bg-color: var(--p-hover);
  --fc-event-bg-color: var(--p-accent);
  --fc-event-border-color: var(--p-accent);
  --fc-event-text-color: #fff;
  --fc-event-selected-overlay-color: rgba(255, 255, 255, 0.08);
  --fc-small-font-size: 11px;
  font-size: 12.5px;
  height: 100%;
}
.pro .fc a { color: inherit; text-decoration: none; }
.pro .fc-theme-standard .fc-scrollgrid { border: none; }
.pro .fc-theme-standard td, .pro .fc-theme-standard th { border-color: var(--p-border); }

.pro .fc .fc-col-header-cell { background: var(--p-bg); }
.pro .fc .fc-col-header-cell-cushion {
  padding: 9px 4px; font-size: 11px; font-weight: 600; color: var(--p-text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.pro .fc .fc-timegrid .fc-day-today .fc-col-header-cell-cushion,
.pro .fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion { color: var(--p-accent); }

/* Mes */
.pro .fc .fc-daygrid-day-top { flex-direction: row; }
.pro .fc .fc-daygrid-day-number {
  margin: 5px 6px 2px; padding: 1px 6px; border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--p-text-2);
}
.pro .fc .fc-day-today .fc-daygrid-day-number { background: var(--p-accent); color: #fff; font-weight: 600; }
.pro .fc .fc-day-other .fc-daygrid-day-top { opacity: 0.4; }
.pro .fc .fc-daygrid-day.fc-day-other { background: rgba(255, 255, 255, 0.012); }
.pro .fc .fc-daygrid-day-frame { transition: background 0.1s; }
.pro .fc .fc-daygrid-day:hover .fc-daygrid-day-frame { background: rgba(255, 255, 255, 0.015); }
.pro .fc .fc-daygrid-event { margin: 1px 4px 0; font-size: 12px; }
.pro .fc .fc-daygrid-dot-event { padding: 1px 4px; border-radius: 4px; color: var(--p-text); }
.pro .fc .fc-daygrid-dot-event:hover { background: var(--p-hover); }
.pro .fc .fc-daygrid-dot-event .fc-event-time { color: var(--p-text-3); font-weight: 500; }
.pro .fc .fc-daygrid-dot-event .fc-event-title { font-weight: 500; }
.pro .fc .fc-daygrid-more-link { margin: 1px 6px; font-size: 11px; font-weight: 500; color: var(--p-text-2); }
.pro .fc .fc-daygrid-more-link:hover { background: var(--p-hover); }

/* Eventos */
.pro .fc .ev-reminder { --fc-event-bg-color: rgba(124, 131, 255, 0.17); --fc-event-border-color: #7C83FF; --fc-event-text-color: #DADCFF; }
.pro .fc .ev-bday { --fc-event-bg-color: rgba(244, 114, 182, 0.15); --fc-event-border-color: #F472B6; --fc-event-text-color: #FBCFE8; }
.pro .fc .is-failed { --fc-event-border-color: #F87171; }
.pro .fc .is-done { opacity: 0.45; }
.pro .fc .is-done .fc-event-title, .pro .fc .is-done .fc-list-row-title { text-decoration: line-through; }
.pro .fc .fc-h-event, .pro .fc .fc-v-event { border-width: 0 0 0 3px; border-radius: 4px; }
.pro .fc .fc-h-event .fc-event-main { padding: 1px 5px; font-weight: 500; }
.pro .fc .fc-v-event { box-shadow: 0 0 0 1px var(--p-bg); }
.pro .fc .fc-v-event .fc-event-main-frame { flex-direction: row; align-items: baseline; gap: 6px; padding: 4px 7px; }
.pro .fc .fc-v-event .fc-event-time { flex-shrink: 0; margin: 0; font-size: 11px; opacity: 0.75; }
.pro .fc .fc-v-event .fc-event-title-container { min-width: 0; }
.pro .fc .fc-v-event .fc-event-title { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pro .fc .fc-event-mirror { opacity: 0.85; }
.pro .fc .fc-event-dragging { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }

/* Semana / día */
.pro .fc .fc-timegrid-slot { height: 2.75em; }
.pro .fc .fc-timegrid-slot-minor { border-top-style: dotted; border-top-color: #1A1A20; }
.pro .fc .fc-timegrid-slot-label { vertical-align: top; }
.pro .fc .fc-timegrid-slot-label-cushion { font-size: 11px; color: var(--p-text-3); padding: 3px 8px 0; }
.pro .fc .fc-timegrid-axis-cushion { color: var(--p-text-3); }
.pro .fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.pro .fc .fc-timegrid-now-indicator-arrow { border-width: 5px 0 5px 6px; border-top-color: transparent; border-bottom-color: transparent; }
.pro .fc .fc-timegrid-col.fc-day-today { background: rgba(124, 131, 255, 0.035); }

/* Agenda */
.pro .fc .fc-list { border: none; }
.pro .fc .fc-list-day-cushion { background: var(--p-bg); padding: 14px 16px 6px; }
.pro .fc .fc-list-day th { border: none; }
.pro .fc .fc-list-day-text, .pro .fc .fc-list-day-side-text { font-size: 12px; font-weight: 600; color: var(--p-text); }
.pro .fc .fc-list-day-side-text { color: var(--p-text-3); font-weight: 500; }
.pro .fc .fc-list-day.fc-day-today .fc-list-day-text { color: var(--p-accent); }
.pro .fc .fc-list-day-text { display: inline-block; }
.pro .fc .fc-list-day-text::first-letter { text-transform: uppercase; }
.pro .fc .fc-list-event td { border: none; padding: 10px 16px; vertical-align: middle; }
.pro .fc .fc-list-event { cursor: pointer; }
.pro .fc .fc-list-event-time { width: 1%; color: var(--p-text-2); font-size: 12.5px; }
.pro .fc .fc-list-event-graphic { padding-left: 0; padding-right: 4px; }
.pro .fc .fc-list-event-dot { border-width: 4px; border-radius: 2px; }
/* width:100% + max-width:0 obliga a la celda a encoger y recortar con elipsis */
.pro .fc .fc-list-event-title { width: 100%; max-width: 0; font-size: 13.5px; font-weight: 500; }
.pro .fc .fc-list-empty { background: transparent; color: var(--p-text-3); font-size: 13px; }
.fc-list-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fc-list-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fc-list-row-title, .fc-list-row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-list-row-title { font-weight: 500; }
.fc-list-row-sub { font-size: 12px; color: var(--p-text-3); font-weight: 400; }

.pcheck {
  width: 22px; height: 22px; flex-shrink: 0; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--p-border-2); background: none; color: transparent; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s var(--p-ease);
}
.pcheck:hover { border-color: var(--p-accent); }
.pcheck:active { transform: scale(0.85); }
.pcheck.on { background: var(--p-accent); border-color: var(--p-accent); color: #fff; }

/* Popover de "+N más" */
.pro .fc .fc-popover {
  background: var(--p-elev); border: 1px solid var(--p-border-2); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); overflow: hidden; z-index: 25;
}
.pro .fc .fc-popover-header { background: var(--p-panel); padding: 8px 10px; font-size: 12px; font-weight: 600; }
.pro .fc .fc-popover-body { padding: 6px 2px; }

/* ── Notas ── */
.notes-layout { flex: 1; display: flex; min-height: 0; }
.notes-list-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pn-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px; flex-shrink: 0; }
.pn-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.pn-count { font-size: 12px; color: var(--p-text-3); margin-top: 1px; }
.psearch { flex: none; margin: 0 12px 8px; }
.notes-list { padding: 2px 8px 110px; }
.pgroup-label { font-size: 11px; font-weight: 600; color: var(--p-text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 10px 6px; }

.note-card {
  padding: 11px 12px; border-radius: 10px; cursor: pointer; margin-bottom: 7px;
  background: var(--p-panel); border: 1px solid var(--p-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  /* La pulsación larga abre la previsualización, no el menú de selección. */
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.note-card:hover { background: var(--p-hover); border-color: var(--p-border-2); }
.note-card.peeking { border-color: var(--p-accent-ring); }
.note-card.active {
  background: var(--p-elev); border-color: var(--p-border-2);
  box-shadow: inset 2px 0 0 var(--p-accent), 0 1px 2px rgba(0, 0, 0, 0.25);
}
.note-card-top { display: flex; align-items: center; gap: 6px; }
.note-card-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-card-pin { color: var(--p-accent); display: flex; flex-shrink: 0; }
.note-card-pin svg { width: 12px; height: 12px; }
.note-card-date { font-size: 11px; color: var(--p-text-3); flex-shrink: 0; }
.note-card-snippet {
  font-size: 12.5px; color: var(--p-text-2); line-height: 1.45; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-preview {
  position: fixed; z-index: 61; width: 320px; max-height: 60vh;
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: var(--p-elev); border: 1px solid var(--p-border-2); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: scale(0.97); pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.note-preview.show { opacity: 1; transform: none; }
.note-preview-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.note-preview-meta { font-size: 11px; color: var(--p-text-3); }
.note-preview-body {
  position: relative; margin-top: 2px; font-size: 13px; line-height: 1.5;
  color: var(--p-text-2); white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden;
}
.note-preview-body:empty::before { content: attr(data-empty); color: var(--p-text-3); font-style: italic; }
/* Degradado cuando el texto no cabe entero */
.note-preview.clipped .note-preview-body::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
  background: linear-gradient(transparent, var(--p-elev));
}
.note-preview-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.5);
  opacity: 0; transition: opacity 0.12s ease;
}
.note-preview-backdrop.show { opacity: 1; }
/* En móvil la previsualización se centra en pantalla */
.note-preview.sheet {
  width: auto; left: 16px; right: 16px; top: 50%; transform: translateY(-50%) scale(0.97);
  max-height: 65vh;
}
.note-preview.sheet.show { transform: translateY(-50%); }

.pchips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  background: var(--p-panel); border: 1px solid var(--p-border-2); color: var(--p-text-2);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pchip:hover { background: var(--p-hover); color: var(--p-text); }
.pchip.on {
  background: var(--p-accent-weak); border-color: var(--p-accent-ring); color: var(--p-accent);
}
.pfield-hint { font-size: 11.5px; color: var(--p-text-3); line-height: 1.4; }

.pempty { display: flex; flex-direction: column; gap: 4px; padding: 48px 16px; text-align: center; font-size: 13px; color: var(--p-text-3); }
.pempty strong { color: var(--p-text-2); font-weight: 500; }

.notes-editor-pane { display: none; flex: 1; flex-direction: column; min-width: 0; min-height: 0; background: var(--p-bg); }
.note-editor-head {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px;
  border-bottom: 1px solid var(--p-border); flex-shrink: 0;
}
.note-crumbs { flex: 1; min-width: 0; display: flex; gap: 6px; font-size: 13px; color: var(--p-text-3); white-space: nowrap; overflow: hidden; }
.note-crumbs-sep { color: var(--p-border-2); }
#noteCrumb { color: var(--p-text); overflow: hidden; text-overflow: ellipsis; }
.note-saved { font-size: 12px; color: var(--p-text-3); flex-shrink: 0; }
.note-pin.active { color: var(--p-accent); background: var(--p-accent-weak); border-color: var(--p-accent-ring); }
.note-editor-body { flex: 1; overflow-y: auto; }
.note-sheet { max-width: 760px; margin: 0 auto; padding: 22px 18px 120px; }
.note-title-input {
  width: 100%; padding: 0; background: none; border: none; outline: none; color: var(--p-text);
  font-family: inherit; font-size: 26px; font-weight: 700; letter-spacing: -0.025em;
}
.note-meta { font-size: 12px; color: var(--p-text-3); margin: 8px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--p-border); }
.note-content-input {
  display: block; width: 100%; min-height: 50vh; padding: 0; resize: none; overflow: hidden;
  background: none; border: none; outline: none; color: #D6D6DE;
  font-family: inherit; font-size: 15px; line-height: 1.75; letter-spacing: -0.003em;
}
.note-title-input::placeholder, .note-content-input::placeholder { color: var(--p-text-3); }
.note-placeholder { display: none; }

/* Móvil: lista o editor, uno cada vez */
.notes-layout.editing .notes-list-pane { display: none; }
.notes-layout.editing .notes-editor-pane { display: flex; animation: screen-in 0.16s ease-out; }
.notes-layout.editing ~ .notes-fab { display: none; }
body.note-editing .tabbar { display: none; }
body.note-editing #screenNotes { padding-bottom: 0; }

/* ── Sheet de recordatorio ── */
#reminderBackdrop { z-index: 50; }
#reminderSheet { z-index: 51; }
.psheet { background: var(--p-panel); border-color: var(--p-border-2); }
.psheet .sheet-handle { background: var(--p-border-2); }
.psheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 18px; flex-shrink: 0; }
.psheet-title { font-size: 12px; font-weight: 600; color: var(--p-text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.psheet-body { flex: 1; overflow-y: auto; padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.pfield { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.pfield-row { display: flex; gap: 10px; }
.pfield-time { flex: 0 0 120px; }
.plabel { font-size: 12px; font-weight: 500; color: var(--p-text-2); }
.pinput {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 7px;
  background: var(--p-bg); border: 1px solid var(--p-border-2); color: var(--p-text);
  font-family: inherit; font-size: 13.5px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.pinput:focus { border-color: var(--p-accent-ring); box-shadow: 0 0 0 3px var(--p-accent-weak); }
.pinput-title {
  height: 44px; padding: 0; border: none; background: none; box-shadow: none !important;
  font-size: 19px; font-weight: 600; letter-spacing: -0.015em;
}
.pinput-title::placeholder { color: var(--p-text-3); }
.pselect {
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236C6C78' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.ptextarea { height: 76px; padding: 8px 10px; resize: none; line-height: 1.5; }
.preceiver { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left; color: var(--p-text); }
.preceiver svg { color: var(--p-text-3); flex-shrink: 0; }
.reminder-status:empty { display: none; }
.reminder-status { font-size: 12px; }
.pstatus { margin-right: 8px; font-weight: 500; }
.pstatus.sent { color: var(--p-ok); }
.pstatus.failed { color: var(--p-danger); }
.pstatus.missed { color: var(--p-warn); }
.psheet-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--p-border); flex-shrink: 0; }
.psheet-spacer { flex: 1; }
.psheet-foot .pbtn-primary kbd { margin-left: 2px; }

/* ── Móvil ── */
@media (max-width: 899px) {
  .pro kbd { display: none; }
  .pc-toolbar .wa-status-btn { width: 32px; padding: 0; justify-content: center; }
  .pc-toolbar .wa-btn-text { display: none; }
  .psheet-foot .pbtn:not(.pbtn-primary):not(.pbtn-ghost-danger):not(#r_doneBtn) { display: none; }
  .psheet-foot .pbtn-primary { flex: 0 0 auto; padding: 0 20px; height: 38px; }
  .psheet .pinput { height: 40px; font-size: 16px; }
  .psheet .pinput-title { height: 44px; font-size: 19px; }
  .psheet .ptextarea { height: 80px; }
  .pro .fc .fc-toolbar { display: none; }
  .pro .fc .fc-daygrid-day-number { margin: 3px 2px 1px; padding: 1px 5px; font-size: 11.5px; }
  .pro .fc .fc-daygrid-event { margin: 1px 2px 0; font-size: 10.5px; }
  .pro .fc .fc-daygrid-dot-event .fc-event-time { display: none; }
  .pro .fc .fc-daygrid-event-dot { margin: 0 3px 0 1px; border-width: 3px; }
}

/* ══════════════════════════ ESCRITORIO ══════════════════════════ */
@media (min-width: 900px) {
  body { max-width: none; padding-left: var(--rail-w); }

  .tabbar {
    top: 0; right: auto; bottom: 0; width: var(--rail-w); height: auto; max-width: none;
    padding: 14px 0; margin: 0;
    display: flex; flex-direction: column; gap: 4px; align-items: center;
    border-top: none; border-right: 1px solid var(--p-border);
    background: #0E0E12;
  }
  .tabbar-item { width: calc(var(--rail-w) - 14px); height: 56px; border-radius: 10px; font-size: 10.5px; padding: 0 3px; }
  .tabbar-item span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar-item:hover { background: var(--p-hover); color: var(--p-text-2); }
  .tabbar-item.active { background: var(--p-elev); box-shadow: inset 0 0 0 1px var(--p-border-2); }
  .tabbar-item:last-child { margin-top: auto; }
  body.note-editing .tabbar { display: flex; }

  .screen { padding-bottom: 0; }

  .fab { right: 28px; bottom: 28px; }
  .toast { bottom: 28px; left: calc(50% + var(--rail-w) / 2); }

  /* Calendario */
  .pc-side {
    display: flex; flex-direction: column; gap: 22px;
    width: 268px; flex-shrink: 0; padding: 16px 14px;
    background: var(--p-panel); border-right: 1px solid var(--p-border); overflow-y: auto;
  }
  .pc-toolbar { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; }
  .pc-toolbar-row { flex: 1; }
  .pc-toolbar-row2 { flex: 0 1 auto; min-width: 0; }
  .pc-title { flex: 0 0 auto; font-size: 19px; margin-left: 4px; }
  .pc-toolbar-row { min-width: 0; }
  .pc-toolbar-row .wa-status-btn { margin-left: auto; width: 32px; padding: 0; justify-content: center; }
  .pc-toolbar-row .wa-btn-text { display: none; }
  .pquick { width: 340px; flex: 0 1 340px; min-width: 160px; }
  .pseg-desktop { display: inline-block; }
  .pc-cal { padding: 0 0 0 0; }
  .pfab { display: none; }
  .pro .fc .fc-daygrid-day-frame { min-height: 100%; }

  /* Notas */
  .notes-list-pane,
  .notes-layout.editing .notes-list-pane { display: flex; flex: 0 0 320px; background: var(--p-panel); border-right: 1px solid var(--p-border); }
  .notes-layout.editing .notes-editor-pane { animation: none; }
  .notes-list { padding-bottom: 32px; }
  .notes-editor-pane { display: flex; }
  .notes-back, .notes-fab { display: none; }
  .notes-layout:not(.editing) .note-editor-head,
  .notes-layout:not(.editing) .note-editor-body { display: none; }
  .notes-layout:not(.editing) .note-placeholder {
    display: flex; flex-direction: column; flex: 1; align-items: center; justify-content: center; gap: 12px;
    font-size: 13.5px; color: var(--p-text-3);
  }
  .note-placeholder svg { opacity: 0.5; }
  .note-placeholder-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
  .note-sheet { padding: 48px 56px 140px; }
  .note-title-input { font-size: 32px; }
  .note-editor-head { padding: 0 20px; }


  /* Sheets como diálogos centrados */
  .sheet {
    top: 50%; bottom: auto; left: calc(50% + var(--rail-w) / 2); right: auto;
    width: 480px; max-height: 86vh; margin: 0; padding-bottom: 0;
    border-radius: 14px; border: 1px solid var(--border);
    transform: translate(-50%, -48%) scale(0.98); opacity: 0; visibility: hidden;
    transition: transform 0.18s var(--p-ease), opacity 0.14s, visibility 0.18s;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; visibility: visible; }
  .psheet { width: 460px; border-color: var(--p-border-2); }
  .sheet-handle { display: none; }
  .sheet-header { padding-top: 18px; }
  .confirm-backdrop { align-items: center; padding-left: var(--rail-w); }
  .confirm-box { max-width: 420px; border-radius: 20px; border: 1px solid var(--border); padding-top: 18px; }
  .confirm-handle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═══════════════ PANTALLAS DE AZTUZAIAK: VERSIÓN DE ESCRITORIO ═══════════════
   Mismo estilo original (lima, DM Sans/Serif); sólo cambia la maquetación.
   En el móvil no se aplica nada de esto. */
.header-add-btn { display: none; }

@media (min-width: 900px) {
  /* ── Cumpleaños: cabecera + barra lateral (resumen y tipos) + rejilla ── */
  #screenHome.active,
  html:not(.nav-ready)[data-screen="screenHome"] #screenHome {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "stats  search"
      "tabs   list";
  }
  #screenHome .header { grid-area: header; padding: 18px 28px; }
  #screenHome .header-title { font-size: 22px; }
  .header-add-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 14px; margin-left: 4px; border-radius: 10px; border: none;
    background: var(--accent); color: #000; cursor: pointer;
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
    transition: opacity 0.15s, transform 0.15s;
  }
  .header-add-btn:hover { opacity: 0.9; }
  .header-add-btn:active { transform: scale(0.97); }
  #screenHome .icon-btn:hover, #screenHome .wa-status-btn:hover { border-color: var(--border-hover); }

  #screenHome .stats {
    grid-area: stats; gap: 6px; padding: 20px 14px 6px;
    background: var(--surface); border-bottom: none; border-right: 1px solid var(--border);
  }
  #screenHome .stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 7px 8px; gap: 0; min-width: 0; }
  #screenHome .stat-val { font-size: 18px; line-height: 1.3; }
  #screenHome .stat-lbl { font-size: 10.5px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  #screenHome .tabs {
    grid-area: tabs; flex-direction: column; gap: 2px;
    overflow-x: hidden; overflow-y: auto; padding: 14px 12px 24px;
    background: var(--surface); border-bottom: none; border-right: 1px solid var(--border);
  }
  #screenHome .tab {
    padding: 10px 12px; margin: 0; border-bottom: none; border-radius: 10px;
    transition: background 0.12s, color 0.12s;
  }
  #screenHome .tab:hover { background: var(--card); color: var(--text); }
  #screenHome .tab.active { background: var(--card); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
  #screenHome .tab-count { margin-left: auto; }

  #screenHome .search-wrap { grid-area: search; align-self: end; padding: 20px 28px 6px; }
  #screenHome .search { max-width: 520px; transition: border-color 0.15s; }
  #screenHome .search:focus-within { border-color: rgba(200, 241, 53, 0.4); }
  #screenHome .screen-body { grid-area: list; }
  #screenHome .list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px; align-items: start; padding: 6px 28px 48px;
  }
  #screenHome .list > .section-header,
  #screenHome .list > .empty,
  #screenHome .list > .loader { grid-column: 1 / -1; }
  #screenHome .section-header { padding: 14px 0 0; }
  #screenHome .person-card { margin-bottom: 0; transition: border-color 0.15s, transform 0.15s; }
  #screenHome .person-card:hover { border-color: var(--border-hover); }
  #screenHome .pc-btn { white-space: nowrap; }
  #screenHome .pc-btn-test { flex: 1.3; }
  #screenHome .pc-btn-del { flex: 0 0 40px; }
  #screenHome .pc-btn:hover { border-color: var(--border-hover); color: var(--text); }
  #screenHome .pc-btn-del:hover { border-color: transparent; color: var(--danger); background: rgba(255, 77, 77, 0.16); }
  #screenHome .pc-btn-test:hover { color: var(--green-send); background: rgba(34, 197, 94, 0.16); }
  #screenHome .fab { display: none; }

  /* ── Ajustes e historial: cabecera ancha + contenido centrado ── */
  #screenSettings .settings-header,
  #screenHistory .settings-header { padding: 22px max(28px, calc((100% - 1040px) / 2 + 28px)) 18px; }
  #screenSettings .settings-title,
  #screenHistory .settings-title { font-size: 24px; }

  /* Ajustes: secciones en dos columnas (sin partir ninguna tarjeta) */
  #screenSettings .settings-body {
    columns: 2 380px; column-gap: 24px;
    max-width: 1040px; margin: 0 auto; padding: 28px 28px 48px;
  }
  #screenSettings .settings-section { display: inline-block; width: 100%; margin-bottom: 24px; break-inside: avoid; }
  #screenSettings .row-btn:hover, #screenSettings .lang-btn:hover { border-color: var(--border-hover); color: var(--text); }
  #screenSettings .settings-add-btn:hover { background: var(--card); color: var(--text); }

  /* Historial: rejilla de tarjetas */
  #screenHistory .settings-body { max-width: 1040px; margin: 0 auto; padding: 28px 28px 48px; }
  #historyList { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
  #historyList > .loader, #historyList > .empty { grid-column: 1 / -1; }
  #historyList .log-card { margin-bottom: 0; }
  #historyLoadMoreBtn { max-width: 280px !important; margin: 20px auto 0 !important; }
}
