:root {
  /* Paleta de colores del sistema de Apple (modo claro) */
  --ink: #000000;
  --ink-soft: #6d6d72;
  --paper: #f2f2f7;
  --card: #ffffff;
  --line: #d1d1d6;
  --accent: #007aff;
  --accent-deep: #0060cc;
  --ok: #34c759;
  --ok-bg: #e7f8ec;
  --warn: #ff9500;
  --warn-bg: #fff2e0;
  --danger: #ff3b30;
  --danger-bg: #ffece9;
  --accent-bg: #e5f1ff;
  --shadow-color: rgba(0, 0, 0, 0.12);
  font-size: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ffffff;
    --ink-soft: #98989d;
    --paper: #000000;
    --card: #1c1c1e;
    --line: #38383a;
    --accent: #0a84ff;
    --accent-deep: #3d9bff;
    --ok: #30d158;
    --ok-bg: #0f2b17;
    --warn: #ff9f0a;
    --warn-bg: #2e2007;
    --danger: #ff453a;
    --danger-bg: #2e1210;
    --accent-bg: #0c2540;
    --shadow-color: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --ink: #ffffff;
  --ink-soft: #98989d;
  --paper: #000000;
  --card: #1c1c1e;
  --line: #38383a;
  --accent: #0a84ff;
  --accent-deep: #3d9bff;
  --ok: #30d158;
  --ok-bg: #0f2b17;
  --warn: #ff9f0a;
  --warn-bg: #2e2007;
  --danger: #ff453a;
  --danger-bg: #2e1210;
  --accent-bg: #0c2540;
  --shadow-color: rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
/* pan-x/pan-y sin "pinch-zoom" ni "manipulation" desactiva tanto el
   pellizco para hacer zoom como el zoom por doble toque, dejando el scroll
   normal — el <meta viewport> solo (maximum-scale/user-scalable) no basta
   en Safari/iOS moderno, que lo ignora por accesibilidad desde iOS 10. */
html { overflow-x: hidden; touch-action: pan-x pan-y; }

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
}
button:active { opacity: 0.6; }

input, select, textarea {
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: none;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; min-height: 4.5rem; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.muted { color: var(--ink-soft); }
.error { color: var(--danger); }

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 0.75rem 1.2rem;
  font-weight: 600;
  font-size: 1rem;
}
.primary-btn:active { background: var(--accent-deep); opacity: 1; }

.ghost-btn {
  background: var(--accent-bg);
  border: none;
  border-radius: 14px;
  padding: 0.6rem 1.05rem;
  color: var(--accent);
  font-weight: 600;
}

.danger-btn {
  background: var(--danger-bg);
  color: var(--danger);
  border: none;
  border-radius: 14px;
  padding: 0.6rem 1.05rem;
  font-weight: 600;
}

/* Bloque repetible de "persona autorizada" en el formulario público de
   inscripción de Cayo Mambí Junior (ver frontend/inscripcion-junior.js) */
.autorizado-bloque {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0;
}

/* ---- Login ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--paper);
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 12px 32px var(--shadow-color);
  padding: 2.5rem;
  width: min(90vw, 380px);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: center;
}
.login-card h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.login-card form { display: flex; flex-direction: column; gap: 0.9rem; }

/* ---- App shell ---- */
.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  padding-top: calc(0.85rem + env(safe-area-inset-top));
  background: var(--card);
  background: color-mix(in srgb, var(--card) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.topbar-spacer { flex: 1; }

.menu-btn {
  background: var(--paper);
  border: none;
  border-radius: 10px;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--ink);
}

.account-menu { position: relative; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--paper);
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
.account-btn.icon-btn {
  padding: 0.5rem 0.65rem;
  font-size: 1.1rem;
}
.account-btn .caret { font-size: 0.7rem; color: var(--ink-soft); }
.icon-gear-wrap { display: flex; width: 20px; height: 20px; }
.icon-gear { width: 100%; height: 100%; }

/* ---- Menú lateral (iPhone): Dashboard / Ponentes / Cerrar sesión ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(78vw, 280px);
  background: var(--card);
  box-shadow: 4px 0 24px var(--shadow-color);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}
.drawer-overlay.is-open .drawer-panel { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem 1.1rem;
  font-weight: 800;
  font-size: 1.15rem;
}
.drawer-close {
  background: var(--paper);
  border: none;
  border-radius: 50%;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 1.2rem;
  color: var(--ink-soft);
  line-height: 1;
}

.drawer-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.9rem 0.7rem;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.02rem;
  text-decoration: none;
  display: block;
}
.drawer-item:active { background: var(--paper); }
.drawer-item.is-active { background: var(--accent-bg); color: var(--accent); }
.drawer-item.is-danger { color: var(--danger); }
.drawer-panel hr { border: none; border-top: 1px solid var(--line); margin: 0.5rem 0; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 28px var(--shadow-color);
  min-width: 210px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  display: block;
}
.dropdown-item:active { background: var(--paper); }
.dropdown-item.is-active { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.dropdown-item.is-danger { color: var(--danger); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--line); margin: 0.3rem 0; }

.view { padding: 1.5rem; max-width: 1000px; margin: 0 auto; }
.view-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.view-header h2 { margin: 0; flex: 1; }

h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }

/* ---- Dashboard: tarjetas tipo widget de iOS ---- */
.stat-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
@media (orientation: landscape) {
  .stat-blocks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stat-block {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 2px 10px var(--shadow-color);
  padding: 1rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.3rem;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.stat-value.is-debt { color: var(--danger); }
.stat-value.is-clear { color: var(--ok); }
.stat-label { color: var(--ink-soft); font-weight: 600; font-size: 0.92rem; }
.stat-note { color: var(--ink-soft); font-size: 0.75rem; margin-top: 0.3rem; }

/* ---- Listas agrupadas estilo iOS (Ajustes/Contactos) ---- */
.ios-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow-color);
}
.ios-list-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ios-list-row:last-child { border-bottom: none; }
.ios-list-row:active { background: var(--paper); }
.ios-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.ios-list-title { font-weight: 600; font-size: 1rem; }
.ios-list-subtitle { font-size: 0.82rem; color: var(--ink-soft); }
.ios-chevron { color: var(--line); font-size: 1.2rem; flex-shrink: 0; }

.chip {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip.is-pagado { background: var(--ok-bg); color: var(--ok); }
.chip.is-pendiente { background: var(--danger-bg); color: var(--danger); }

.editar-inicio-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.editar-inicio-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--paper);
  border-radius: 12px;
  padding: 0.45rem;
}
.editar-inicio-item.is-oculto { opacity: 0.5; }
.editar-inicio-item.is-dragging {
  box-shadow: 0 10px 26px var(--shadow-color);
}
.editar-inicio-placeholder {
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.drag-handle {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ink-soft);
  padding: 0.4rem 0.5rem;
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
}

/* ---- Mini visualizador: previsualiza el recuadro tal cual se verá ---- */
.editar-inicio-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--card);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}
.editar-inicio-preview-value { font-weight: 800; font-size: 1rem; }
.editar-inicio-preview-label { font-size: 0.72rem; color: var(--ink-soft); font-weight: 600; }

.editar-inicio-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.3rem;
}
.editar-inicio-toggle input { width: 1.3rem; height: 1.3rem; accent-color: var(--ok); }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
}

/* ---- Historial de pagos ---- */
.search-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 2rem;
}
.search-wrap input {
  width: min(100%, 420px);
  text-align: center;
  font-size: 1.05rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
}

.historial-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow-color);
}
.historial-item {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}
.historial-item:last-child { border-bottom: none; }
.historial-item:active { background: var(--paper); }
.historial-item .historial-nombre { font-weight: 600; flex: 1; }
.historial-item .historial-fecha { color: var(--ink-soft); font-size: 0.85rem; }

/* ---- Ponente detalle ---- */
.detail-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 4px var(--shadow-color);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.detail-card h3 { margin: 0 0 0.9rem; font-size: 1rem; font-weight: 700; }
.stat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; margin: 0; }
.stat-list dt { color: var(--ink-soft); font-size: 0.85rem; }
.stat-list dd { margin: 0; font-weight: 700; font-size: 1.1rem; }

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

.year-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.year-switch .year-label { font-weight: 800; font-size: 1.1rem; min-width: 4ch; text-align: center; }
.year-switch button {
  background: var(--paper);
  border: none;
  border-radius: 8px;
  width: 2.2rem;
  height: 2.2rem;
  font-weight: 700;
  color: var(--accent);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.7rem;
}
.month-cell {
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  text-align: left;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.month-cell.is-pagado { background: var(--ok-bg); }
.month-cell.is-suspendido { background: var(--warn-bg); }
.month-cell .month-name { font-weight: 700; }
.month-cell .month-status { font-size: 0.8rem; color: var(--ink-soft); }
.month-cell.is-pagado .month-status { color: var(--ok); font-weight: 600; }
.month-cell.is-suspendido .month-status { color: var(--warn); font-weight: 600; }

/* ---- Calendario anual: cuadrícula de 12 meses coloreada por estado ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.7rem;
}
.calendar-cell {
  border: none;
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  text-align: left;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: inherit;
}
.calendar-cell.is-pendiente { cursor: pointer; }
.calendar-cell-name { font-weight: 700; }
.calendar-cell-status { font-size: 0.8rem; color: var(--ink-soft); }
.calendar-cell.is-fuera-temporada { background: var(--line); opacity: 0.6; }
.calendar-cell.is-completo { background: var(--ok-bg); }
.calendar-cell.is-completo .calendar-cell-status { color: var(--ok); font-weight: 600; }
.calendar-cell.is-pendiente { background: var(--danger-bg); }
.calendar-cell.is-pendiente .calendar-cell-status { color: var(--danger); font-weight: 600; }

/* ---- Modales: hojas que suben desde abajo en iPhone (bottom sheet),
   tarjeta centrada en iPad/pantallas anchas — como los sheets de iOS. ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
  transition: background 0.25s ease;
}
.modal-overlay.is-open { background: rgba(0, 0, 0, 0.45); }
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 0.5rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom));
  width: 100%;
  position: relative;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
#recibo-modal .modal-card {
  max-height: 97vh;
  min-height: 88vh;
  padding-left: 1rem;
  padding-right: 1rem;
  display: flex;
  flex-direction: column;
}
#recibo-modal .firma-recibo-grid { flex: 1; }
#recibo-modal .firma-block { flex: 1; display: flex; flex-direction: column; }
#recibo-modal .firma-recibo { flex: 1; width: 100%; height: 100%; aspect-ratio: auto; }
.modal-card::before {
  content: "";
  display: block;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin: 0.6rem auto 1rem;
}
.modal-overlay.is-open .modal-card { transform: translateY(0); }
.modal-card h2 { margin-top: 0.2rem; }
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: var(--paper);
  border: none;
  border-radius: 50%;
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink-soft);
}
.modal-card form { display: flex; flex-direction: column; gap: 0.9rem; }
.modal-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }

@media (min-width: 768px) {
  .modal-overlay { align-items: center; padding: 1rem; }
  .modal-card {
    width: min(90vw, 420px);
    border-radius: 20px;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    transition: transform 0.22s ease, opacity 0.22s ease;
    box-shadow: 0 20px 60px var(--shadow-color);
  }
  .modal-card::before { display: none; }
  .modal-overlay.is-open .modal-card { transform: translateY(0) scale(1); opacity: 1; }
  #firma-modal .modal-card { width: min(94vw, 520px); }
  #recibo-modal .modal-card { width: min(96vw, 780px); }
}

.firma-block { margin-bottom: 1.1rem; }
.firma-block label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.firma-canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  border-radius: 10px;
  background: #fff;
  touch-action: none;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.firma-recibo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

/* Las dos firmas del recibo: apiladas en vertical, una al lado de la otra
   (pagadora primero) en horizontal. */
.firma-recibo-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
@media (orientation: landscape) {
  .firma-recibo-grid { flex-direction: row; }
  .firma-recibo-grid .firma-block { flex: 1; margin-bottom: 0; }
}
.firma-block .link-btn { margin-top: 0.35rem; }

/* ---- Selector de método: control segmentado estilo iOS ---- */
.metodo-choice {
  display: flex;
  gap: 0.2rem;
  background: var(--paper);
  border-radius: 12px;
  padding: 0.2rem;
}
.metodo-choice button {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--ink);
}
.metodo-choice button:active {
  background: var(--card);
  box-shadow: 0 1px 4px var(--shadow-color);
  opacity: 1;
}

/* ---- Sub-navegación de la Tienda (Productos/Categorías/Pedidos) ---- */
.tienda-subnav {
  display: flex;
  gap: 0.2rem;
  background: var(--paper);
  border-radius: 12px;
  padding: 0.2rem;
  margin-bottom: 1.25rem;
}
.tienda-subnav a {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.5rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
}
.tienda-subnav a.is-active { background: var(--card); box-shadow: 0 1px 4px var(--shadow-color); color: var(--accent); }

/* ---- Chips de filtro (ej. estado de pedidos) ---- */
.filter-chips { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 1.25rem; -webkit-overflow-scrolling: touch; }
.filter-chip {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}
.filter-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.producto-fotos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -0.3rem 0 0.2rem;
}
.foto-thumb {
  position: relative;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow-color);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-thumb .foto-remove {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* ---- Editor de tallas (alta/edición de producto) ---- */
.tallas-editor { display: flex; flex-direction: column; gap: 0.5rem; }
.talla-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.talla-row input[type="text"] { flex: 1.2; }
.talla-row input[type="number"] { flex: 1; }
.talla-row button {
  flex-shrink: 0;
  background: var(--danger-bg);
  color: var(--danger);
  border: none;
  border-radius: 8px;
  width: 2.2rem;
  height: 2.2rem;
  font-weight: 700;
}

/* ---- Estado de conexión en tiempo real ---- */
.live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink-soft);
  display: inline-block;
}
.live-dot.is-live { background: var(--ok); }

/* ---- Dock flotante inferior — solo iPhone en vertical. Sustituye al
   hamburguesa + panel deslizante en ese caso concreto; en horizontal (y en
   iPad/pantallas anchas, que ya tienen su rail) todo sigue igual. ---- */
.tab-dock { display: none; }

@media (max-width: 767px) and (orientation: portrait) {
  #btn-menu, .drawer-overlay { display: none !important; }
  .tab-dock {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 40;
    padding: 0.35rem;
    border-radius: 999px;
    background: var(--card);
    background: color-mix(in srgb, var(--card) 78%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 10px 28px var(--shadow-color);
  }
  .view { padding-bottom: calc(1.5rem + 5.5rem + env(safe-area-inset-bottom)); }
}

.dock-item {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: none;
  flex-shrink: 0;
}
.dock-item.is-active { background: var(--paper); color: var(--ink); }
.dock-icon { width: 22px; height: 22px; display: flex; }
.dock-icon svg { width: 100%; height: 100%; }

/* ---- Rail lateral fijo para iPad/pantallas anchas — sustituye al menú
   hamburguesa + panel deslizante, que se queda para iPhone. ---- */
.ipad-rail { display: none; }

@media (min-width: 768px) {
  .ipad-rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 226px;
    background: var(--card);
    background: color-mix(in srgb, var(--card) 82%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--line);
    padding: 1rem 0.7rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    padding-left: calc(0.7rem + env(safe-area-inset-left));
    z-index: 25;
    transition: width 0.2s ease;
    overflow-y: auto;
  }
  #btn-menu, .drawer-overlay { display: none !important; }
  .topbar, .view { margin-left: 226px; transition: margin-left 0.2s ease; }

  body.rail-collapsed .ipad-rail { width: 76px; }
  body.rail-collapsed .topbar,
  body.rail-collapsed .view { margin-left: 76px; }
  body.rail-collapsed .rail-label,
  body.rail-collapsed .rail-logo { display: none; }
  body.rail-collapsed .rail-item { justify-content: center; }
  body.rail-collapsed .rail-top { justify-content: center; }
  body.rail-collapsed .rail-collapse-btn svg { transform: rotate(180deg); }
}

.rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem 1.3rem;
  flex-shrink: 0;
}
.rail-logo {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.rail-collapse-btn {
  background: var(--paper);
  border: none;
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.rail-collapse-btn svg { width: 16px; height: 16px; transition: transform 0.2s ease; }

.rail-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.7rem;
  margin-top: 0.7rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  width: 100%;
}
.rail-item:active { background: var(--paper); opacity: 1; }
.rail-item.is-active { background: var(--accent); color: #fff; }
.rail-item.is-danger { color: var(--danger); }
.rail-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; }
.rail-icon svg { width: 100%; height: 100%; }
.rail-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
