/* Paleta Lovernails ------------------------------------- */
:root {
  --bg: #EBC4CC;
  --bg-soft: #F2D5DB;
  --leaf: #E89AA3;
  --leaf-dark: #D67F8B;
  --accent: #E91E80;
  --accent-soft: #F8B0C8;
  --paper: #FBF2E8;
  --paper-line: rgba(74, 42, 53, 0.09);
  --ink: #4A2A35;
  --ink-soft: #7E5A66;
  --gold: #D4AF7A;
  --shadow: 0 12px 36px rgba(74, 42, 53, 0.22);
  --radius: 18px;
  --serif: "Georgia", "Lora", "Crimson Pro", serif;
  --hand: "Allura", "Great Vibes", "Snell Roundhand", cursive;
}

[x-cloak] { display: none !important; }
body[x-cloak] > * { display: none !important; }

body {
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 210, 217, 0.7), transparent 55%),
    radial-gradient(circle at 88% 82%, rgba(232, 162, 172, 0.55), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  font-family: var(--serif);
  overflow-x: hidden;
}

/* Login --------------------------------------------------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(380px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--accent-soft);
  border-radius: calc(var(--radius) - 4px);
  pointer-events: none;
  opacity: 0.5;
}

.login-logo {
  width: 130px;
  height: 130px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg-soft);
}

.login-card h1 {
  font-family: var(--hand);
  font-size: 3.2rem;
  background: linear-gradient(135deg, #F8B0C8 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  font-weight: 400;
}

.login-card .tagline {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  font-style: italic;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: var(--ink-soft);
  gap: 0.3rem;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--accent-soft);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 30, 128, 0.12);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.btn-primary, .btn-secondary {
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #F490B6 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(233, 30, 128, 0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(233, 30, 128, 0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--accent-soft);
}

.error {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0;
  text-align: center;
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
  padding: 0;
}

/* Diario -------------------------------------------------- */
.diary {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
}

/* En portrait (móvil/tablet vertical) la diary ocupa casi todo el ancho
   para que el spread semanal aproveche al máximo el espacio horizontal */
@media (orientation: portrait) {
  .diary {
    max-width: min(96vw, 980px);
    padding: 0.75rem 0.5rem 1rem;
  }
}

/* Pull-to-refresh indicator estilo iOS */
.ptr-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + 0.5rem);
  left: 50%;
  --ptr-d: -60px;
  transform: translate(-50%, var(--ptr-d));
  width: 46px;
  height: 46px;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(74, 42, 53, 0.22);
  display: grid;
  place-items: center;
  color: var(--accent);
  z-index: 200;
  transition: opacity 0.2s, transform 0.25s ease;
  opacity: 0;
  pointer-events: none;
}
.ptr-indicator.ptr-active { opacity: 1; }
.ptr-indicator.ptr-ready {
  background: linear-gradient(135deg, #F490B6 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 18px rgba(233, 30, 128, 0.4);
}
.ptr-indicator.ptr-loading svg {
  animation: ptrSpin 0.8s linear infinite !important;
  transform: none !important;
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}
.ptr-indicator svg {
  transition: transform 0.05s linear;
}

/* Botón flotante de Ajustes — esquina inferior izquierda, simétrico al FAB */
.settings-floating {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
  left: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid rgba(216, 132, 145, 0.45);
  color: var(--accent);
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(74, 42, 53, 0.18);
  z-index: 50;
  transition: transform 0.2s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.settings-floating:hover, .settings-floating:active {
  transform: rotate(60deg) scale(1.05);
  box-shadow: 0 6px 18px rgba(74, 42, 53, 0.28);
}

.diary-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0 1.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--paper);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(74, 42, 53, 0.15);
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
}

.icon-btn:hover { background: var(--bg-soft); transform: scale(1.05); }
.settings-link { text-decoration: none; }

.date-block {
  flex: 1;
  text-align: center;
  position: relative;
  background: var(--paper);
  border: 1px solid rgba(216, 132, 145, 0.35);
  border-radius: 16px;
  padding: 0.45rem 0.85rem 0.55rem;
  box-shadow: 0 2px 8px rgba(74, 42, 53, 0.12);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.date-weekday {
  font-family: var(--serif);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

.date-day {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  font-weight: 700;
  color: #2D1820;
  margin: 0;
  text-transform: capitalize;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.date-picker {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  width: 100%;
  z-index: 2;
}

/* Página del diario --------------------------------------- */
.page-stack {
  position: relative;
  flex: 1;
  perspective: 1800px;
  perspective-origin: center center;
}

.page {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 2.25rem 1.75rem 2.5rem;
  box-shadow:
    0 1px 0 var(--paper-line),
    var(--shadow);
  position: relative;
  background-image: repeating-linear-gradient(
    var(--paper) 0,
    var(--paper) 31px,
    var(--paper-line) 32px
  );
  min-height: 520px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.page::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent-soft);
  opacity: 0.4;
}

/* Animaciones de paso de página — disolvencia muy suave con leve giro y deslizamiento */
.page--turning.page--next {
  transform-origin: left center;
  animation: pageTurnNext 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.page--turning.page--prev {
  transform-origin: right center;
  animation: pageTurnPrev 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageTurnNext {
  0% {
    transform: rotateY(0) translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
  40% {
    transform: rotateY(-14deg) translateX(-22px) scale(0.985);
    opacity: 0;
    filter: blur(0.6px);
  }
  60% {
    transform: rotateY(14deg) translateX(22px) scale(0.985);
    opacity: 0;
    filter: blur(0.6px);
  }
  100% {
    transform: rotateY(0) translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes pageTurnPrev {
  0% {
    transform: rotateY(0) translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
  40% {
    transform: rotateY(14deg) translateX(22px) scale(0.985);
    opacity: 0;
    filter: blur(0.6px);
  }
  60% {
    transform: rotateY(-14deg) translateX(-22px) scale(0.985);
    opacity: 0;
    filter: blur(0.6px);
  }
  100% {
    transform: rotateY(0) translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

/* Sombra muy sutil del doblez (apenas perceptible) */
.page--turning::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(74, 42, 53, 0.04) 0%, transparent 22%);
  opacity: 0;
  animation: pageShade 1.2s ease-in-out forwards;
}
.page--turning.page--prev::after {
  background: linear-gradient(270deg, rgba(74, 42, 53, 0.04) 0%, transparent 22%);
}
@keyframes pageShade {
  0% { opacity: 0; }
  40% { opacity: 1; }
  60% { opacity: 1; }
  100% { opacity: 0; }
}

.page-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(225deg, var(--bg-soft) 50%, transparent 50%);
  border-bottom-right-radius: var(--radius);
  pointer-events: none;
}

.page-empty {
  display: grid;
  place-items: center;
  gap: 1rem;
  min-height: 380px;
  text-align: center;
}

.empty-text {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* Entrada (cita-card) -------------------------------------- */
.entry {
  position: relative;
  padding: 0.9rem 1rem 0.9rem 1.1rem;
  margin: 0.7rem 0 0.7rem 30px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(216, 132, 145, 0.25);
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 6px rgba(74, 42, 53, 0.1);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.entry:hover, .entry:active {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(74, 42, 53, 0.15);
}

.entry + .entry { margin-top: 0.85rem; }

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.entry-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #2D1820;
  margin: 0;
  letter-spacing: -0.01em;
}

.entry-time {
  display: inline-block;
  background: linear-gradient(135deg, #C71668 0%, var(--accent) 100%);
  color: white;
  font-family: ui-monospace, monospace;
  font-size: 1rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  margin-right: 0.55rem;
  vertical-align: middle;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 6px rgba(199, 22, 104, 0.3);
}

.entry-client {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0.25rem 0;
  font-style: italic;
}

.editor-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 0.2rem;
  margin-bottom: 0.5rem;
  width: fit-content;
}

.editor-tab {
  background: none;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.editor-tab.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(74, 42, 53, 0.1);
}

.editor-title {
  font-family: var(--hand);
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0 0 .5rem;
  text-align: center;
}

/* Toggle "Con clienta" / "Personal" */
.kind-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  background: var(--bg-soft);
  padding: 0.25rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}
.kind-btn {
  background: none;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s;
}
.kind-btn.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(74, 42, 53, 0.08);
  font-weight: 600;
}

/* Selector de hora estilo rueda iOS */
.wheel-picker-wrap {
  margin: 0.5rem 0;
}

.wheel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--bg-soft);
  padding: 0.3rem;
  border-radius: 14px;
  margin-bottom: 0.6rem;
}
.wheel-tabs.has-error {
  border: 2px solid var(--accent);
}

.wheel-tab {
  background: none;
  border: none;
  border-radius: 11px;
  padding: 0.6rem 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--ink-soft);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.wheel-tab:active { transform: scale(0.97); }

.wheel-tab.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(74, 42, 53, 0.08);
}

.wheel-tab-label {
  font-size: 0.75rem;
  font-weight: 500;
}

.wheel-tab-value {
  font-family: ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.wheel-tab.active .wheel-tab-value { color: var(--accent); }

/* Rueda con dos columnas */
.wheel-picker {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: white;
  border: 1px solid var(--accent-soft);
  border-radius: 18px;
  height: 200px;
  overflow: hidden;
}

.wheel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(251, 242, 232, 0.95) 0%, rgba(255, 251, 246, 0) 35%, rgba(255, 251, 246, 0) 65%, rgba(251, 242, 232, 0.95) 100%);
}
.wheel-overlay::before, .wheel-overlay::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: var(--accent-soft);
}
.wheel-overlay::before { top: 80px; }
.wheel-overlay::after { top: 120px; }

.wheel-col {
  height: 200px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
}
.wheel-col::-webkit-scrollbar { display: none; }

.wheel-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.wheel-item, .wheel-spacer {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-family: ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.15s, transform 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.wheel-spacer { color: transparent; pointer-events: none; }

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
}

.btn-share {
  background: white;
  border: 1px solid var(--accent-soft);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  transition: all 0.15s;
  font: inherit;
  color: var(--ink);
}
.btn-share:hover, .btn-share:active {
  border-color: var(--accent);
  background: var(--bg-soft);
  transform: scale(0.99);
}
.btn-share .share-icon {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--accent);
}
.btn-share .share-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
}
.btn-share .share-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.paylink-box {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin: 0.75rem 0;
  border: 1px dashed var(--accent-soft);
  text-align: left;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}
.share-buttons .btn-primary,
.share-buttons .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
  padding: 0.7rem 1rem;
}
.share-buttons svg { flex-shrink: 0; }

.share-btn-wa {
  background: linear-gradient(135deg, #25D366 0%, #1DA851 100%) !important;
  color: white !important;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3) !important;
}
.share-btn-wa:hover {
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4) !important;
}

.wheel-item.disabled {
  color: var(--accent-soft);
  opacity: 0.35;
  pointer-events: none;
  text-decoration: line-through;
  text-decoration-color: rgba(233, 30, 128, 0.35);
}

.wheel-sep {
  font-family: ui-monospace, monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0 0.5rem;
  z-index: 1;
}

.field-error {
  color: var(--accent);
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
  padding: 0.4rem 0.6rem;
  background: #fdecf2;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}
.server-error {
  margin-top: 0.75rem;
  background: #f8d6dc;
  color: #b8334a;
  border-color: #b8334a;
}

.field-bad input, .field-bad textarea {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(233, 30, 128, 0.12);
}

.new-client-form {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0.5rem 0;
}

.selected-client {
  background: #d4f4dd;
  color: #1f7b45;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.95rem;
}

.time-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.time-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.client-search {
  position: relative;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(74, 42, 53, 0.12);
  margin-top: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
}

.autocomplete-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px dashed var(--accent-soft);
  color: var(--ink);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-soft); }

.entry-mood {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.entry-body {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #5A3D49;
  font-size: 1.05rem;
  margin-top: 0.3rem;
}

.entry-actions {
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(216, 132, 145, 0.3);
  display: flex;
  gap: 1rem;
  font-size: 1.05rem;
  flex-wrap: wrap;
}

.entry-actions .link {
  padding: 0.25rem 0;
  font-weight: 500;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

/* Editor -------------------------------------------------- */
.entry-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 30px;
}

.editor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-buttons {
  display: flex;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.2rem;
  transition: background 0.2s, box-shadow 0.2s;
}

.editor-buttons.flash-attention {
  animation: flashEditorBtns 1.5s ease-in-out;
}

@keyframes flashEditorBtns {
  0%, 100% { background: transparent; box-shadow: none; }
  20% { background: rgba(233, 30, 128, 0.15); box-shadow: 0 0 0 4px rgba(233, 30, 128, 0.18); }
  40% { background: transparent; box-shadow: 0 0 0 0 rgba(233, 30, 128, 0); }
  60% { background: rgba(233, 30, 128, 0.15); box-shadow: 0 0 0 4px rgba(233, 30, 128, 0.18); }
  80% { background: transparent; box-shadow: 0 0 0 0 rgba(233, 30, 128, 0); }
}

/* FAB ----------------------------------------------------- */
.fab {
  position: fixed;
  /* Mismo bottom y misma medida que .settings-floating → alineación perfecta */
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #F490B6 0%, var(--accent) 100%);
  color: white;
  font-size: 1.8rem;
  font-weight: 300;
  box-shadow: 0 6px 20px rgba(233, 30, 128, 0.4);
  display: grid;
  place-items: center;
  z-index: 5;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:hover, .fab:active {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(233, 30, 128, 0.5);
}

.diary-footer {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  border-top: 1px dashed var(--accent-soft);
}

.footer-brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, #F490B6 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  letter-spacing: 0.01em;
}

.footer-links {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.78rem;
}

.footer-links .link { font-size: 0.78rem; padding: 0; min-height: 0; }

.footer-divider {
  color: var(--accent-soft);
  font-weight: bold;
}

.footer-tag {
  margin: 0;
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.02em;
  opacity: 0.75;
}

/* ===========================================================
   VISTA SEMANAL — cuaderno con espiral central, dos columnas
   Diseñada portrait/móvil 9:16 (selfie), también funciona en
   tablet/desktop. La idea es ver la semana de un vistazo como
   en una agenda física: pestaña con día a un lado, hoja a otro.
   =========================================================== */

.week-spread {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  margin: 0;
  /* Llena hasta justo encima del FAB/footer para que la libreta no quede a medias */
  min-height: calc(100vh - 220px);
  filter: drop-shadow(0 12px 24px rgba(74, 42, 53, 0.18));
  transform-origin: center top;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s, filter 0.3s;
  will-change: transform, opacity;
  isolation: isolate;
}

.week-spread.page--turning {
  opacity: 0;
  filter: drop-shadow(0 18px 28px rgba(74, 42, 53, 0.22)) blur(2px);
}
.week-spread.page--turning.page--next { transform: translateX(-12px) rotateY(-6deg); }
.week-spread.page--turning.page--prev { transform: translateX(12px)  rotateY(6deg); }

/* Doble columna con encuadernación al medio */
.spread-cols {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: transparent;
  width: 100%;
  flex: 1;
  min-height: 0;
}

/* Espiral central (anillas) — vive dentro de .spread-cols, así nunca
   se sale del cuaderno por arriba ni por abajo */
.spread-binding {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 12px 0;
  z-index: 5;
  pointer-events: none;
}
.spread-binding .ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B8C5C7 0%, #6E7E80 60%, #4D5C5E 100%);
  box-shadow:
    inset 0 -2px 3px rgba(0,0,0,0.35),
    inset 0 2px 2px rgba(255,255,255,0.6),
    0 1px 2px rgba(0,0,0,0.2);
  border: 1px solid rgba(60, 70, 72, 0.5);
}

.spread-col {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
  padding: 0.5rem 0;
  min-width: 0;
  height: 100%;
}
.spread-col--left {
  border-radius: 14px 6px 6px 14px;
  border-right: 1px dashed rgba(74, 42, 53, 0.18);
  /* Margen exterior para que la pestaña sobresalga sin restar al papel */
  margin-left: 32px;
}
.spread-col--right {
  border-radius: 6px 14px 14px 6px;
  margin-right: 32px;
}

/* Cada celda de día = pestaña lateral (absoluta) + hoja a todo el ancho */
.day-cell {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  margin: 4px 0;
}

.spread-col--left .day-cell { padding-right: 14px; }
.spread-col--right .day-cell { padding-left: 14px; }

/* Pestaña: absoluta, fuera del papel — el papel ocupa todo el ancho de la columna */
.day-tab {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--paper);
  border: 1px solid rgba(216, 132, 145, 0.35);
  color: var(--ink);
  font-family: var(--serif);
  cursor: pointer;
  padding: 8px 0;
  box-shadow: 0 2px 6px rgba(74, 42, 53, 0.10);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  z-index: 2;
}
.day-tab:active { transform: translateY(-50%) scale(0.96); }

.day-tab--left {
  left: -34px;
  border-radius: 8px 0 0 8px;
  border-right: none;
}
.day-tab--right {
  right: -34px;
  border-radius: 0 8px 8px 0;
  border-left: none;
}
.day-tab-dow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}
.day-tab-num {
  font-size: 1.45rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  color: #2D1820;
}

.day-tab--today {
  background: linear-gradient(135deg, #F490B6 0%, var(--accent) 100%);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(233, 30, 128, 0.35);
}
.day-tab--today .day-tab-dow,
.day-tab--today .day-tab-num { color: #fff; }

/* Hoja con líneas dentro de cada día */
.day-paper {
  flex: 1;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 23px,
    var(--paper-line) 23px,
    var(--paper-line) 24px
  );
  border-radius: 4px;
  padding: 8px 10px 6px;
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 24px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  min-height: 110px;
  position: relative;
}

.day-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 24px;
  border-bottom: none;
}
.day-line--empty {
  color: transparent;
}

/* Cabecera vista semanal: solo etiqueta + mes/año */
.week-block {
  cursor: default;
}
.week-today {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--accent);
}

/* FAB en vista semanal: lleva al día de hoy en modo edición */
.fab--week {
  position: fixed;
  z-index: 60;
}

/* Lengüeta "volver a la semana" — pestaña sobresaliendo del top
   de la página, estilo separador de agenda real */
.page-tab-back {
  /* anular el botón gris por defecto de iOS Safari */
  -webkit-appearance: none !important;
  appearance: none !important;
  position: absolute;
  top: -22px;
  left: 28px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, #F490B6 0%, #E91E80 100%) !important;
  background-color: #E91E80 !important;
  color: #fff !important;
  border: none !important;
  outline: none;
  padding: 5px 14px 8px 11px;
  border-radius: 8px 8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 -3px 10px rgba(74, 42, 53, 0.18);
  z-index: 3;
  transition: transform 0.12s, box-shadow 0.12s, padding 0.12s;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 1px 1px rgba(74, 42, 53, 0.18);
}
.page-tab-back::after {
  /* sombrita inferior que une la lengüeta con el papel */
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(180deg, rgba(0,0,0,0.12), transparent);
  border-radius: 0 0 8px 8px;
}
.page-tab-back:hover, .page-tab-back:active {
  transform: translateY(-2px);
  box-shadow: 0 -5px 14px rgba(233, 30, 128, 0.3);
}
.page-tab-arrow {
  font-size: 1.2rem;
  line-height: 1;
  font-style: normal;
  font-weight: 700;
}
.page-tab-label {
  text-transform: lowercase;
}
