/* ==========================================================================
   ListaCompra Familiar - Estilos Mobile-First + Modo Oscuro/Claro
   ========================================================================== */

:root {
  --bg: #f3f6f4;
  --bg-elevated: #ffffff;
  --bg-soft: #eaf0ec;
  --bg-glass: rgba(255, 255, 255, 0.84);
  --text: #0f1f17;
  --text-muted: #5a6d63;
  --border: #dde6e0;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-soft: rgba(16, 185, 129, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(15, 31, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 31, 23, 0.09);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1116;
    --bg-elevated: #131c24;
    --bg-soft: #1b2732;
    --bg-glass: rgba(19, 28, 36, 0.86);
    --text: #eef4f1;
    --text-muted: #8ea19a;
    --border: #243340;
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-soft: rgba(16, 185, 129, 0.18);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.16);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1116;
  --bg-elevated: #131c24;
  --bg-soft: #1b2732;
  --bg-glass: rgba(19, 28, 36, 0.86);
  --text: #eef4f1;
  --text-muted: #8ea19a;
  --border: #243340;
  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-soft: rgba(16, 185, 129, 0.18);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.86rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------- Inputs y botones base ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.quick-extras input,
.quick-extras select,
.setting-row select,
.voice-transcript-box input {
  width: 100%;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.quick-extras input:focus,
.quick-extras select:focus,
.voice-transcript-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.1s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

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

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.link-btn {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-soft);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
}

/* ---------- Pantallas Auth & Setup ---------- */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-header {
  text-align: center;
}

.brand-logo {
  display: inline-flex;
  margin-bottom: 10px;
}

.brand-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.brand-header p {
  margin: 6px 0 0;
  font-size: 0.92rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.segmented-btn {
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.segmented-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-dot.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4.5px var(--c);
}

.form-alert {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
}

.form-alert.success {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.helper-note {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.auth-footer {
  text-align: center;
}

/* ---------- Layout Principal ---------- */
.main-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
}

.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon {
  border-radius: 8px;
}

.topbar-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.sync-status.online .sync-dot {
  background: var(--primary);
}

.sync-status.offline .sync-dot {
  background: var(--danger);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-soft);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  max-width: 145px;
}

.user-pill-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-badge.sm {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 14px calc(88px + var(--safe-bottom));
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Caja de Añadir Rápido + Voz ---------- */
.quick-add-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding-right: 4px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease;
}

.quick-input-wrap:focus-within {
  border-color: var(--primary);
}

.quick-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 11px 12px;
  outline: none;
}

.inline-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.inline-icon-btn.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-voice,
.btn-add {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.btn-voice {
  background: var(--primary-soft);
  color: var(--primary);
}

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

.btn-voice:active,
.btn-add:active {
  transform: scale(0.94);
}

.quick-extras {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
}

.quick-extras .full-span {
  grid-column: 1 / -1;
}

/* ---------- Buscador y Chips ---------- */
.list-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--text-muted);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  outline: none;
  color: var(--text);
  font-size: 0.92rem;
}

.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.chip-count {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* ---------- Grupos y Tarjetas de Producto ---------- */
.items-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.item-card.bought {
  opacity: 0.82;
}

.check-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  transition: all 0.15s ease;
}

.check-btn:hover {
  background: var(--primary-soft);
}

.item-card.bought .check-btn {
  background: var(--primary);
  color: #ffffff;
}

.item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.item-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.item-name {
  font-weight: 600;
  font-size: 1rem;
  word-break: break-word;
}

.item-card.bought .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.qty-pill {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.item-note {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-soft);
}

.item-action-btn.restore {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

/* ---------- Paneles y Tarjetas ---------- */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 2px 0 0;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card h3 {
  margin: 0;
  font-size: 1rem;
}

/* ---------- Historial ---------- */
.history-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-day-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-day-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0 4px;
}

.history-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-main {
  font-size: 0.92rem;
  line-height: 1.35;
}

.history-details {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-time {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.action-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  margin-right: 4px;
}

.action-tag.added { background: var(--primary-soft); color: var(--primary-hover); }
.action-tag.bought { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.action-tag.restored { background: rgba(245, 158, 11, 0.16); color: #d97706; }
.action-tag.edited { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.action-tag.deleted,
.action-tag.cleared { background: var(--danger-soft); color: var(--danger); }

/* ---------- Miembros / Ajustes ---------- */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.member-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.member-email {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row select {
  width: auto;
  min-width: 170px;
}

.account-actions {
  margin-top: 4px;
}

/* ---------- Navegación Inferior Móvil ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

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

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.nav-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-badge.muted-badge {
  background: var(--text-muted);
}

/* ---------- Modales / Bottom Sheets ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 0 0;
}

.bottom-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--bg-elevated);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.18s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

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

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
}

.audit-box {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

/* ---------- Modal de Voz ---------- */
.voice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 6px 0;
}

.mic-orb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.mic-orb:not(.listening) {
  background: var(--bg-soft);
  color: var(--text);
  box-shadow: none;
}

.mic-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  pointer-events: none;
}

.mic-orb.listening .mic-ring {
  animation: pulseRing 1.6s ease-out infinite;
}

.mic-orb.listening .mic-ring.delay {
  animation-delay: 0.7s;
}

@keyframes pulseRing {
  0% { transform: scale(0.92); opacity: 0.75; }
  100% { transform: scale(1.45); opacity: 0; }
}

.voice-status {
  margin: 0;
  font-weight: 600;
}

.voice-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.voice-parsed-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--text);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.voice-chip button {
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 2px;
}

.voice-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ---------- Estado vacío y Toasts ---------- */
.empty-state {
  text-align: center;
  padding: 40px 18px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.empty-state .empty-emoji {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.empty-state h3 {
  margin: 0 0 4px;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

.toast-container {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: fadeToast 0.18s ease-out;
}

.toast.error {
  background: var(--danger);
  color: #ffffff;
}

@keyframes fadeToast {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Adaptación escritorio ---------- */
@media (min-width: 680px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .bottom-sheet {
    border-radius: var(--radius-lg);
    padding: 18px 22px 22px;
  }

  .sheet-handle {
    display: none;
  }

  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 6px 10px;
  }

  .main-content {
    padding-bottom: 100px;
  }
}
