/* ============================================================================
   BOTIQUÍN FAMILIAR - Sistema de Diseño Clínico y Farmacéutico (Vanilla CSS)
   Mobile-First, Modo Claro y Oscuro, Alta Legibilidad y Precisión Tipográfica
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta Modo Claro - Farmacia Suiza / Clínico Cálido */
  --bg-app: hsl(210, 25%, 97%);
  --bg-surface: hsl(0, 0%, 100%);
  --bg-surface-alt: hsl(210, 22%, 94%);
  --bg-surface-hover: hsl(210, 20%, 92%);
  --bg-elevated: hsl(0, 0%, 100%);
  --bg-input: hsl(0, 0%, 100%);

  --text-primary: hsl(215, 32%, 13%);
  --text-secondary: hsl(215, 18%, 36%);
  --text-muted: hsl(215, 14%, 50%);

  --border-subtle: hsl(214, 22%, 88%);
  --border-strong: hsl(214, 20%, 78%);

  /* Acento Principal: Verde Clínico / Esmeralda Farmacia */
  --primary: hsl(172, 82%, 28%);
  --primary-hover: hsl(172, 85%, 23%);
  --primary-soft: hsl(170, 55%, 93%);
  --primary-text: hsl(172, 85%, 22%);

  /* Semáforo de Vencimientos y Stock */
  --status-green-bg: hsl(152, 62%, 92%);
  --status-green-text: hsl(154, 78%, 22%);
  --status-green-border: hsl(152, 50%, 78%);

  --status-yellow-bg: hsl(42, 92%, 91%);
  --status-yellow-text: hsl(32, 88%, 26%);
  --status-yellow-border: hsl(40, 80%, 74%);

  --status-red-bg: hsl(354, 82%, 93%);
  --status-red-text: hsl(354, 78%, 32%);
  --status-red-border: hsl(354, 70%, 80%);

  /* Valuación Moneda Homogénea (Azul Financiero / INDEC) */
  --currency-bg: hsl(204, 75%, 93%);
  --currency-text: hsl(206, 85%, 26%);
  --currency-border: hsl(204, 65%, 80%);

  /* Sombras y Geometría */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --header-height: 62px;
  --bottom-nav-height: 66px;
}

[data-theme="dark"] {
  --bg-app: hsl(216, 28%, 9%);
  --bg-surface: hsl(216, 24%, 13%);
  --bg-surface-alt: hsl(216, 22%, 17%);
  --bg-surface-hover: hsl(216, 20%, 20%);
  --bg-elevated: hsl(216, 24%, 15%);
  --bg-input: hsl(216, 26%, 11%);

  --text-primary: hsl(210, 25%, 95%);
  --text-secondary: hsl(214, 16%, 72%);
  --text-muted: hsl(214, 12%, 54%);

  --border-subtle: hsl(216, 20%, 21%);
  --border-strong: hsl(216, 18%, 29%);

  --primary: hsl(168, 72%, 42%);
  --primary-hover: hsl(168, 74%, 48%);
  --primary-soft: hsl(172, 48%, 17%);
  --primary-text: hsl(166, 75%, 68%);

  --status-green-bg: hsl(154, 48%, 16%);
  --status-green-text: hsl(152, 72%, 68%);
  --status-green-border: hsl(154, 42%, 26%);

  --status-yellow-bg: hsl(38, 55%, 17%);
  --status-yellow-text: hsl(42, 92%, 72%);
  --status-yellow-border: hsl(38, 50%, 28%);

  --status-red-bg: hsl(354, 52%, 18%);
  --status-red-text: hsl(354, 88%, 76%);
  --status-red-border: hsl(354, 46%, 30%);

  --currency-bg: hsl(206, 52%, 17%);
  --currency-text: hsl(202, 85%, 74%);
  --currency-border: hsl(206, 45%, 28%);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 48px -8px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
  transition: background-color 0.2s ease, color 0.2s ease;
}

@media (min-width: 900px) {
  body {
    padding-bottom: 32px;
  }
}

/* ============================================================================
   PANTALLA DE BLOQUEO Y AUTENTICACIÓN (Contraseña Maestra APP_PASSWORD)
   ============================================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border: 1px solid var(--status-red-border);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============================================================================
   BARRA SUPERIOR Y ESTADO OFFLINE ("Funcionando sin conexión")
   ============================================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.header-inner {
  max-width: 1340px;
  margin: 0 auto;
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

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

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

/* Indicador Discreto Sin Conexión - Texto Exacto Obligatorio */
.offline-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  background: var(--status-yellow-bg);
  color: var(--status-yellow-text);
  border: 1px solid var(--status-yellow-border);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.offline-indicator.hidden {
  display: none !important;
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sync-badge:hover {
  background: var(--bg-surface-hover);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(154, 70%, 40%);
}

/* Navegación Escritorio y Móvil */
.desktop-nav {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.desktop-nav-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.nav-tab-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.mobile-nav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 2px;
}

.mobile-nav-btn.active {
  color: var(--primary);
  font-weight: 700;
}

@media (min-width: 900px) {
  .desktop-nav {
    display: block;
  }
  .mobile-bottom-nav {
    display: none;
  }
}

/* ============================================================================
   CONTENEDOR PRINCIPAL Y RESUMEN EJECUTIVO
   ============================================================================ */
.app-container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 20px 16px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .kpi-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================================
   CONTROLES, BOTONES, FORMULARIOS Y BUSCADOR INSTANTÁNEO
   ============================================================================ */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
  background: var(--bg-surface);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

@media (min-width: 768px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box .input {
  padding-left: 38px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

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

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

.btn-secondary {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

.btn-danger {
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border-color: var(--status-red-border);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ============================================================================
   GRILLA DE MEDICAMENTOS Y TARJETAS DE INVENTARIO
   ============================================================================ */
.meds-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 680px) {
  .meds-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1080px) {
  .meds-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.med-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.med-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.med-card.expired {
  border-left: 4px solid var(--status-red-text);
}

.med-card.expiring-soon {
  border-left: 4px solid var(--status-yellow-text);
}

.med-card.valid-expiry {
  border-left: 4px solid var(--status-green-text);
}

.med-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.med-brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}

.med-generic {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-text);
  margin-top: 2px;
}

.med-format-pill {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* Bloque de Cálculo Automático de Stock (Desglose + Total) */
.med-stock-box {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stock-breakdown {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stock-total-pill {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-surface);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

/* Semáforo de Vencimiento y Moneda Homogénea */
.med-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-green {
  background: var(--status-green-bg);
  color: var(--status-green-text);
  border-color: var(--status-green-border);
}

.badge-yellow {
  background: var(--status-yellow-bg);
  color: var(--status-yellow-text);
  border-color: var(--status-yellow-border);
}

.badge-red {
  background: var(--status-red-bg);
  color: var(--status-red-text);
  border-color: var(--status-red-border);
}

.badge-currency {
  background: var(--currency-bg);
  color: var(--currency-text);
  border-color: var(--currency-border);
  font-family: var(--font-mono);
}

.med-valuation-box {
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--currency-bg);
  color: var(--currency-text);
  border: 1px solid var(--currency-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.valuation-homogenea {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
}

.med-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.med-location {
  font-size: 0.76rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   MÓDULO FAMILIAR: PERFILES, TRATAMIENTOS Y TOMAS SIMULTÁNEAS
   ============================================================================ */
.family-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

.member-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}

.treatments-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 980px) {
  .treatments-layout {
    grid-template-columns: 1.35fr 1fr;
  }
}

.treatment-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.treatment-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.treatment-title {
  font-size: 1.02rem;
  font-weight: 800;
}

.simultaneous-pills-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.simultaneous-pill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
}

.pill-dose-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
}

/* ============================================================================
   CARGA MASIVA / EDITOR OFFLINE (Consumo Cero de Cuota)
   ============================================================================ */
.bulk-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 860px) {
  .bulk-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.bulk-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

.bulk-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
  font-size: 0.84rem;
}

.bulk-table th {
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bulk-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.bulk-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.83rem;
}

.bulk-input.mono {
  font-family: var(--font-mono);
}

.bulk-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
}

/* ============================================================================
   MODALES Y AUTOCOMPLETADO DEL CATÁLOGO ARGENTINO
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-dialog {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 560px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.catalog-suggestions {
  margin-top: 6px;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.catalog-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
}

.catalog-item:hover {
  background: var(--primary-soft);
}

/* ============================================================================
   CONFIGURADOR DE WIDGETS MÓVILES Y TABLA IPC
   ============================================================================ */
.widget-config-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .widget-config-layout {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.url-output-box {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 12px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin: 10px 0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 78px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 900px) {
  .toast-container {
    bottom: 24px;
  }
}

.toast {
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  max-width: 360px;
}
