/* ═══════════════════════════════════════════════════════════════
   app.css — AIVON AI Employee Dashboard
   Design: Premium dark, Satoshi font, gold brand (#C2A24F)
═══════════════════════════════════════════════════════════════ */

:root {
  --brand:           #C2A24F;
  --brand-light:     #D4B96A;
  --brand-dark:      #A88B3A;
  --brand-50:        rgba(194,162,79,0.06);
  --brand-100:       rgba(194,162,79,0.14);

  --bg-main:         #0A0F17;
  --bg-card:         #111827;
  --bg-surface:      #182030;
  --bg-header:       #0D1523;
  --bg-input:        rgba(255,255,255,0.05);

  --text-primary:    #F1F5F9;
  --text-secondary:  #94A3B8;
  --text-muted:      #4B5563;

  --border:          rgba(255,255,255,0.07);
  --border-subtle:   rgba(255,255,255,0.04);

  --sidebar-w:            260px;
  --sidebar-w-collapsed:  68px;
  --header-h:             60px;
  --radius-card:          14px;
  --shadow-card:          0 1px 4px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-hover:         0 4px 8px rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.5);
  --transition:           0.18s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  font-family: 'Satoshi', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  background: var(--bg-main);
  color: var(--text-primary);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition), transform var(--transition);
  background: linear-gradient(180deg, #070A0F 0%, #0A1018 50%, #080C14 100%);
  border-right: 1px solid rgba(194,162,79,0.08);
}
#sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  flex-shrink: 0;
  cursor: default;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(194,162,79,0.12);
  border: 1px solid rgba(194,162,79,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(194,162,79,0.12);
}
.sidebar-logo-text {
  overflow: hidden;
  transition: opacity var(--transition), width var(--transition);
}
.sidebar-logo-name {
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.sidebar-logo-sub {
  color: rgba(255,255,255,0.3);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }

.nav-section {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-section-label {
  color: rgba(255,255,255,0.22);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}
#sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.45);
  transition: all var(--transition);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  white-space: nowrap;
  margin-bottom: 1px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(194,162,79,0.1); color: #fff; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.6; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-label {
  overflow: hidden;
  transition: opacity var(--transition), width var(--transition);
  white-space: nowrap;
}
#sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-name {
  color: rgba(255,255,255,0.6);
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
}
#sidebar.collapsed .sidebar-user-name { opacity: 0; width: 0; }

/* ── Main content ──────────────────────────────────────────── */
#main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
#main-wrap.sidebar-collapsed { margin-left: var(--sidebar-w-collapsed); }

/* ── Header ────────────────────────────────────────────────── */
#header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
#page-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.header-icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.header-icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }

#header-credits-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
#header-credits-btn:hover { border-color: var(--brand); color: var(--brand); }

.lang-btns { display: flex; align-items: center; gap: 2px; }
.lang-btn {
  width: 34px; height: 30px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity var(--transition), background var(--transition);
  padding: 0;
}
.lang-btn .fi { width: 22px; height: 16px; border-radius: 2px; display: block; }
.lang-btn:hover { opacity: 0.75; background: rgba(255,255,255,0.07); }
.lang-btn.active { opacity: 1; background: rgba(255,255,255,0.07); }

/* ── Page content ──────────────────────────────────────────── */
#page-content { flex: 1; padding: 24px; overflow-y: auto; }

.page { display: none; }
.page.active { display: block; animation: fadeUp 0.22s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Low credit banner ──────────────────────────────────────── */
#credit-alert-banner {
  display: none;
  background: linear-gradient(90deg, rgba(194,162,79,0.08), rgba(194,162,79,0.05));
  border-bottom: 1px solid rgba(194,162,79,0.2);
  padding: 8px 24px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--brand);
  text-align: center;
}
#credit-alert-banner button { color: var(--brand); }

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════════════════════════ */

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.1);
}
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.blue   { background: rgba(37,99,235,0.12);   color: #60A5FA; }
.kpi-icon.green  { background: rgba(22,163,74,0.12);   color: #34D399; }
.kpi-icon.purple { background: rgba(124,58,237,0.12);  color: #A78BFA; }
.kpi-icon.brand  { background: rgba(194,162,79,0.12);  color: var(--brand); }
.kpi-icon.orange { background: rgba(234,88,12,0.12);   color: #FB923C; }
.kpi-body { flex: 1; min-width: 0; }
.kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi-trend {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-trend.up      { color: #34D399; }
.kpi-trend.down    { color: #F87171; }
.kpi-trend.neutral { color: var(--text-secondary); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.card-subtitle { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 1px; }
.card-body { padding: 20px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-green  { background: rgba(52,211,153,0.12);  color: #34D399; }
.badge-blue   { background: rgba(96,165,250,0.12);  color: #60A5FA; }
.badge-orange { background: rgba(251,146,60,0.12);  color: #FB923C; }
.badge-red    { background: rgba(248,113,113,0.12); color: #F87171; }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-purple { background: rgba(167,139,250,0.12); color: #A78BFA; }
.badge-brand  { background: var(--brand-100);       color: var(--brand); }
.badge-yellow { background: rgba(250,204,21,0.12);  color: #FBBF24; }

/* ── Data Table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.data-table th {
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.data-table tbody tr.selected { background: var(--brand-50); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand);
  color: #000;
  box-shadow: 0 2px 8px rgba(194,162,79,0.3);
  font-weight: 600;
}
.btn-primary:hover { background: var(--brand-light); box-shadow: 0 4px 16px rgba(194,162,79,0.4); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.12); }
.btn-danger {
  background: rgba(248,113,113,0.1);
  color: #F87171;
  border: 1.5px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.15); }
.btn-sm  { padding: 5px 10px; font-size: 0.8125rem; border-radius: 6px; }
.btn-icon { padding: 7px; border-radius: 8px; background: none; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(194,162,79,0.12);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
select.form-input option { background: #182030; color: var(--text-primary); }
textarea.form-input { resize: vertical; }

/* ── Slide panel ────────────────────────────────────────────── */
#slide-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
  cursor: pointer;
}
#slide-overlay.open { display: block; }
#slide-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  background: var(--bg-card);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
  border-left: 1px solid var(--border);
}
#slide-panel.open { transform: translateX(0); }

/* Fix hardcoded borders inside slide panel HTML */
#slide-panel > div:first-child { border-bottom-color: var(--border) !important; }
#slide-panel > div:last-child  { border-top-color: var(--border) !important; }
#user-name-header { color: var(--text-secondary) !important; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Credit progress bar ────────────────────────────────────── */
.credit-bar-track { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.credit-bar-fill  { height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.credit-bar-fill.high   { background: linear-gradient(90deg, #22c55e, #4ade80); }
.credit-bar-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.credit-bar-fill.low    { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(194,162,79,0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: var(--text-primary); }
.page-btn.active { background: var(--brand); color: #000; border-color: var(--brand); font-weight: 600; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── FullCalendar overrides ─────────────────────────────────── */
.fc { color: var(--text-primary) !important; }
.fc-toolbar-title { font-size: 1rem !important; font-weight: 600 !important; font-family: inherit !important; color: var(--text-primary) !important; }
.fc-button { font-family: inherit !important; }
.fc-button-primary { background: var(--brand) !important; border-color: var(--brand) !important; color: #000 !important; }
.fc-button-primary:not(:disabled):hover { background: var(--brand-light) !important; }
.fc-button-primary:not(:disabled):active,
.fc-button-primary.fc-button-active { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; }
.fc-scrollgrid { border-color: var(--border) !important; }
.fc th, .fc td { border-color: var(--border) !important; }
.fc-day-today { background: rgba(194,162,79,0.06) !important; }
.fc-col-header-cell { background: rgba(255,255,255,0.02) !important; }
.fc-col-header-cell-cushion { color: var(--text-secondary) !important; font-size: 0.75rem !important; text-transform: uppercase !important; letter-spacing: 0.05em !important; }
.fc-daygrid-day-number { color: var(--text-secondary) !important; }
.fc-event { font-size: 0.75rem !important; }

/* ── ApexCharts overrides ───────────────────────────────────── */
.apexcharts-toolbar { display: none !important; }
.apexcharts-legend-text { font-family: inherit !important; font-size: 0.8rem !important; fill: var(--text-secondary) !important; color: var(--text-secondary) !important; }
.apexcharts-tooltip { background: var(--bg-surface) !important; border: 1px solid var(--border) !important; color: var(--text-primary) !important; font-family: inherit !important; }
.apexcharts-tooltip-title { background: rgba(255,255,255,0.04) !important; border-color: var(--border) !important; color: var(--text-primary) !important; }
.apexcharts-tooltip-text { color: var(--text-primary) !important; }
.apexcharts-xaxis-label, .apexcharts-yaxis-label { fill: var(--text-secondary) !important; }
.apexcharts-gridline { stroke: var(--border) !important; }
.apexcharts-canvas { background: transparent !important; }

/* ── Historial log ───────────────────────────────────────────── */
.historial-entry {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  cursor: pointer;
}
.historial-entry:last-child { border-bottom: none; }
.historial-entry:hover { color: var(--text-primary); }

/* ── Bottom nav (mobile) ────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════
   MOBILE OVERHAUL — PWA-quality responsive design
   Aplicacion nativa para movil, experiencia premium
══════════════════════════════════════════════════════════════ */

/* Bottom nav oculto por defecto (solo desktop) */
#bottom-nav { display: none; }

@media (max-width: 768px) {
  /* ── Variables movil ─────────────────────────────────────── */
  :root {
    --header-h:     56px;
    --bottom-nav-h: 62px;
  }

  /* ── Base ───────────────────────────────────────────────── */
  html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }
  body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Sidebar: overlay deslizante ────────────────────────── */
  #sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    z-index: 200;
    box-shadow: 6px 0 32px rgba(0,0,0,0.7);
    border-right: 1px solid rgba(194,162,79,0.15);
  }
  #sidebar.mobile-open { transform: translateX(0); }
  #sidebar.collapsed   { transform: translateX(-100%); width: 280px !important; }

  /* Overlay: inline styles en HTML usan !important para sobreescribir */
  #sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.55) !important;
    z-index: 199 !important;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: pointer;
  }

  /* ── Main wrap ──────────────────────────────────────────── */
  #main-wrap {
    margin-left: 0 !important;
    width: 100%;
    min-height: 100dvh;
  }

  /* ── Header movil ───────────────────────────────────────── */
  #header {
    height: var(--header-h);
    padding: 0 10px 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13,21,35,0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
  #page-title {
    font-size: 0.9375rem;
    font-weight: 700;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Flags mas pequenas, mantener funcionalidad */
  .lang-btns { gap: 0; }
  .lang-btn {
    width: 26px;
    height: 28px;
    border-radius: 4px;
    padding: 0;
  }
  .lang-btn .fi { width: 16px; height: 12px; }

  /* Credits badge compacto */
  #header-credits-btn {
    padding: 5px 9px;
    font-size: 0.75rem;
    border-radius: 8px;
    gap: 4px;
    min-height: 32px;
  }
  #header-credits-btn svg { width: 12px; height: 12px; }

  /* Botones de icono — touch target minimo 44px */
  .header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Page content ───────────────────────────────────────── */
  #page-content {
    padding: 14px;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    overflow-x: hidden;
  }

  /* ── Bottom nav — barra nativa ──────────────────────────── */
  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(13,21,35,0.97);
    border-top: 1px solid rgba(194,162,79,0.14);
    z-index: 150;
    padding-bottom: calc(var(--bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 28px rgba(0,0,0,0.45);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }
  .nav-item-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px 8px;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    min-height: 54px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: color 0.15s ease;
  }
  .nav-item-mobile:active { opacity: 0.7; }
  .nav-item-mobile.active { color: var(--brand); }
  .nav-item-mobile.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 2.5px;
    background: var(--brand);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 0 8px rgba(194,162,79,0.5);
  }
  .nav-item-mobile svg {
    width: 22px; height: 22px;
    stroke-width: 1.75;
    transition: transform 0.15s ease;
  }
  .nav-item-mobile.active svg { transform: scale(1.1); }
  .nav-item-mobile span { line-height: 1; }

  /* ── Banner de creditos bajos ───────────────────────────── */
  #credit-alert-banner {
    padding: 7px 14px;
    font-size: 0.8125rem;
  }

  /* ── KPI cards — grid 2x2 ───────────────────────────────── */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .kpi-card {
    padding: 14px 12px;
    gap: 10px;
    border-radius: 12px;
    flex-direction: column;
    align-items: flex-start;
  }
  .kpi-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
  }
  .kpi-icon svg { width: 17px; height: 17px; }
  .kpi-value { font-size: 1.625rem; }
  .kpi-label { font-size: 0.6875rem; }
  .kpi-trend { font-size: 0.6875rem; margin-top: 4px; }

  /* ── Cards ──────────────────────────────────────────────── */
  .card {
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
  }
  .card-header {
    padding: 12px 14px;
    gap: 8px;
  }
  .card-title { font-size: 0.875rem; }
  .card-subtitle { font-size: 0.75rem; }
  .card-body {
    padding: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Tablas — scroll horizontal ─────────────────────────── */
  .data-table {
    font-size: 0.8125rem;
    min-width: 420px;
  }
  .data-table th { padding: 8px 12px; font-size: 0.625rem; }
  .data-table td { padding: 10px 12px; }

  /* ── Botones — touch targets ────────────────────────────── */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
  }
  .btn-sm {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    border-radius: 8px;
  }
  .btn-icon {
    min-width: 40px;
    min-height: 40px;
    padding: 9px;
    border-radius: 10px;
  }

  /* ── Formularios — sin zoom en iOS ──────────────────────── */
  .form-input {
    min-height: 46px;
    padding: 11px 14px;
    font-size: 1rem;
    border-radius: 10px;
  }
  textarea.form-input { min-height: 88px; }
  select.form-input { min-height: 46px; }

  /* ── Toolbar (filtros) ──────────────────────────────────── */
  .toolbar {
    gap: 8px;
    margin-bottom: 12px;
  }
  .toolbar .form-input { font-size: 0.9375rem; }

  /* ── Slide panel — pantalla completa ────────────────────── */
  #slide-panel {
    width: 100% !important;
    border-left: none;
    border-radius: 0;
  }

  /* ── Modal — bottom sheet ───────────────────────────────── */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
    margin-top: auto;
    width: 100%;
    max-width: 100%;
    animation: slideUp 0.28s cubic-bezier(0.4,0,0.2,1);
  }
  @keyframes slideUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal-header { padding: 14px 16px; }
  .modal-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer .btn { flex: 1; justify-content: center; min-width: 120px; }

  /* ── Modal de llamada — meta grid ───────────────────────── */
  .grid.grid-cols-2.sm\:grid-cols-4 {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* ── Security modal — bottom sheet ──────────────────────── */
  .sec-overlay {
    align-items: flex-end !important;
    justify-content: stretch !important;
  }
  .sec-modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
    padding: 22px 18px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    max-height: 92dvh;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
  }

  /* ── Charts — una columna ───────────────────────────────── */
  .chart-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .analytics-grid { grid-template-columns: 1fr !important; gap: 12px; }

  /* ── Packages grid ──────────────────────────────────────── */
  .packages-grid { grid-template-columns: 1fr !important; gap: 10px; }

  /* ── Paginacion ─────────────────────────────────────────── */
  .pagination { gap: 3px; flex-wrap: wrap; }
  .page-btn {
    padding: 7px 10px;
    min-height: 38px;
    font-size: 0.8125rem;
    border-radius: 8px;
  }

  /* ── Table footer ───────────────────────────────────────── */
  .table-footer {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 12px 14px;
  }
  .table-footer .pagination { justify-content: center; }

  /* ── FullCalendar movil ─────────────────────────────────── */
  .fc-toolbar { flex-wrap: wrap; gap: 6px; }
  .fc-toolbar-title { font-size: 0.875rem !important; }
  .fc-button {
    padding: 5px 10px !important;
    font-size: 0.8125rem !important;
    min-height: 36px !important;
  }
  .fc-col-header-cell-cushion {
    font-size: 0.6875rem !important;
    padding: 4px 2px !important;
  }
  .fc-daygrid-day-number { font-size: 0.75rem !important; }
  .fc-event { font-size: 0.625rem !important; padding: 1px 3px !important; }

  /* ── Historial entries ──────────────────────────────────── */
  .historial-entry { padding: 10px 0; font-size: 0.875rem; }

  /* ── Badges ─────────────────────────────────────────────── */
  .badge { font-size: 0.625rem; padding: 2px 7px; }

  /* ── Ocultar en movil ───────────────────────────────────── */
  .sm-show { display: none !important; }
  #user-name-header { display: none !important; }
}

/* ── Desktop: sidebar visible, bottom nav oculto ─────────── */
@media (min-width: 769px) {
  #bottom-nav { display: none !important; }
  #sidebar { transform: none !important; }
}

/* ── iPhone SE y pantallas muy pequeñas (≤390px) ────────── */
@media (max-width: 390px) {
  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 12px 10px; }
  .kpi-value { font-size: 1.375rem; }
  .nav-item-mobile span { font-size: 0.5rem; }
  .nav-item-mobile svg { width: 20px; height: 20px; }
  #page-content { padding: 10px; }
  .card-body { padding: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   FASE 1 — Header + navegacion premium
══════════════════════════════════════════════════════════════ */

/* ── Header actions container ────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Lang cycle (mobile) — oculto en desktop ─────────────── */
.lang-cycle-btn {
  display: none;
  padding: 0 5px;
  min-width: 34px;
}
.lang-cycle-btn .fi {
  width: 22px; height: 16px;
  border-radius: 3px;
  display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

/* ── Logout desktop only (oculto en mobile) ──────────────── */
/* .header-logout-btn visible por defecto */

/* ── Boton hero CALL en bottom nav ───────────────────────── */
.nav-hero {
  position: relative;
  overflow: visible !important;
}
.nav-hero-ring {
  position: absolute;
  top: 2px; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1.5px solid rgba(194,162,79,0.22);
  pointer-events: none;
  animation: heroRingPulse 3s ease-in-out infinite;
}
@keyframes heroRingPulse {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50%       { opacity: 0;   transform: translateX(-50%) scale(1.18); }
}
.nav-hero-btn {
  width: 54px; height: 54px;
  background: linear-gradient(135deg, #D4B96A 0%, #C2A24F 60%, #A88B3A 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(194,162,79,0.4), 0 0 0 3px rgba(194,162,79,0.1);
  position: relative;
  top: -10px;
  transition: box-shadow 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.nav-hero-btn svg {
  width: 22px; height: 22px;
  color: #0A0F17;
  stroke-width: 2;
}
.nav-hero:active .nav-hero-btn {
  transform: scale(0.92) translateY(0px);
  box-shadow: 0 2px 10px rgba(194,162,79,0.3);
}
.nav-item-mobile.nav-hero span {
  position: relative;
  top: -8px;
  font-size: 0.5rem;
  color: var(--text-muted);
}
.nav-item-mobile.nav-hero.active span { color: var(--brand); }
.nav-item-mobile.nav-hero.active .nav-hero-btn {
  box-shadow: 0 6px 24px rgba(194,162,79,0.55), 0 0 0 4px rgba(194,162,79,0.14);
}
.nav-item-mobile.nav-hero::before { display: none !important; }

/* ── More sheet ──────────────────────────────────────────── */
.more-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #111827;
  border-radius: 20px 20px 0 0;
  z-index: 145;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.55);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: none; /* solo mobile */
}
.more-sheet.open { transform: translateY(0); }
.more-sheet-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  margin: 14px auto 2px;
}
.more-sheet-content { padding: 6px 0 16px; }
.more-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
  letter-spacing: -0.01em;
}
.more-sheet-item:active { background: rgba(255,255,255,0.04); }
.more-sheet-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.more-sheet-icon svg { width: 20px; height: 20px; color: var(--text-secondary); }
.more-sheet-icon-brand { background: rgba(194,162,79,0.1); border-color: rgba(194,162,79,0.15); }
.more-sheet-icon-brand svg { color: var(--brand); }
.more-sheet-icon-danger { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.15); }
.more-sheet-icon-danger svg { color: #F87171; }
.more-sheet-danger-item span { color: #F87171; }
.more-sheet-chevron {
  width: 16px; height: 16px;
  color: rgba(255,255,255,0.2);
  margin-left: auto;
  flex-shrink: 0;
}
.more-sheet-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 18px 20px;
}

/* ── Visibilidad mobile/desktop ──────────────────────────── */
@media (max-width: 768px) {
  .lang-btns-desktop { display: none !important; }
  .lang-cycle-btn { display: flex !important; }
  .header-logout-btn { display: none !important; }
  .more-sheet { display: block; }
  /* Bottom nav altura extra para el boton hero */
  #bottom-nav { align-items: flex-end; padding-top: 4px; }
}
@media (min-width: 769px) {
  .lang-cycle-btn { display: none !important; }
  .header-logout-btn { display: flex !important; }
  .more-sheet { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   FASE 2 — CRM + Calls: tablas -> tarjetas nativas movil
══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ─── CRM toolbar ─────────────────────────────────────────── */
  #page-crm .toolbar { flex-wrap: wrap; align-items: center; }
  #page-crm #crm-search {
    flex: 1 1 100% !important;
    max-width: none !important;
    order: 0;
  }
  #page-crm #crm-estado,
  #page-crm #crm-tipo {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
    order: 1;
    font-size: 0.875rem;
  }
  /* Boton "New client" en toolbar: ocultar en mobile (FAB lo reemplaza) */
  #page-crm .toolbar .btn-primary { display: none !important; }

  /* FAB nuevo cliente */
  #crm-fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 18px);
    right: 18px;
    z-index: 130;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, #9a7d30 100%);
    box-shadow: 0 4px 20px rgba(194,162,79,0.4), 0 2px 8px rgba(0,0,0,0.4);
    border: none;
    cursor: pointer;
    color: #0A0F17;
    display: flex !important;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s, box-shadow 0.18s;
  }
  #crm-fab:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(194,162,79,0.3);
  }

  /* Quitar scroll horizontal de los wrappers */
  #page-crm .overflow-x-auto,
  #page-calls .overflow-x-auto {
    overflow-x: visible !important;
    padding: 4px 0;
  }

  /* ─── CRM tabla -> lista de tarjetas ──────────────────────── */
  #page-crm .data-table {
    display: block !important;
    min-width: 0 !important;
    width: 100%;
  }
  #page-crm .data-table thead { display: none !important; }
  #page-crm .data-table tbody { display: block !important; }

  #page-crm .data-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    row-gap: 0;
    padding: 13px 16px;
    margin: 0 0 6px;
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
  }
  #page-crm .data-table tr:active { background: rgba(255,255,255,0.05); }
  #page-crm .data-table tr.selected {
    border-color: rgba(194,162,79,0.25);
    background: rgba(194,162,79,0.05);
  }

  #page-crm .data-table td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* 1: Nombre restaurante - titulo */
  #page-crm .data-table td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
  }
  /* 2: Encargado - segunda linea (era hidden, forzar visible) */
  #page-crm .data-table td:nth-child(2) {
    display: block !important;
    grid-column: 1; grid-row: 2;
  }
  /* 3: Telefono - ocultar en tarjeta */
  #page-crm .data-table td:nth-child(3) { display: none !important; }

  /* 4: Ciudad - tercera linea (era hidden, forzar visible) */
  #page-crm .data-table td:nth-child(4) {
    display: block !important;
    grid-column: 1; grid-row: 3;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
  }
  /* 5: Estado badge - esquina superior derecha */
  #page-crm .data-table td:nth-child(5) {
    display: flex !important;
    grid-column: 2; grid-row: 1;
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 2px !important;
    margin-bottom: 4px;
  }
  /* 6: Ultima llamada - derecha fila 2 (era hidden, forzar visible) */
  #page-crm .data-table td:nth-child(6) {
    display: block !important;
    grid-column: 2; grid-row: 2;
    font-size: 0.75rem;
    text-align: right;
  }
  /* 7: Proxima llamada - ocultar */
  #page-crm .data-table td:nth-child(7) { display: none !important; }

  /* Celdas colspan (loading / empty state) */
  #page-crm .data-table td[colspan] {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: block !important;
    text-align: center;
    white-space: normal;
  }


  /* ─── Calls toolbar ───────────────────────────────────────── */
  #page-calls .toolbar { flex-wrap: wrap; align-items: center; }
  #page-calls #calls-search {
    flex: 1 1 100% !important;
    max-width: none !important;
    order: 0;
  }
  #page-calls #calls-from,
  #page-calls #calls-to {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
    order: 1;
    font-size: 0.875rem;
  }
  #page-calls #calls-disposition {
    flex: 1 1 100%;
    width: auto !important;
    order: 2;
    font-size: 0.875rem;
  }

  /* ─── Calls tabla -> feed de tarjetas ─────────────────────── */
  #page-calls .data-table {
    display: block !important;
    min-width: 0 !important;
    width: 100%;
  }
  #page-calls .data-table thead { display: none !important; }
  #page-calls .data-table tbody { display: block !important; }

  #page-calls .data-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 0;
    padding: 13px 16px;
    margin: 0 0 6px;
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
  }
  #page-calls .data-table tr:active { background: rgba(255,255,255,0.05); }

  #page-calls .data-table td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* 1: Fecha - fila 2, izquierda (debajo del restaurante) */
  #page-calls .data-table td:nth-child(1) {
    grid-column: 1; grid-row: 2;
    font-size: 0.75rem;
    margin-top: 4px;
  }
  /* 2: Restaurante - titulo (fila 1, izquierda) */
  #page-calls .data-table td:nth-child(2) {
    grid-column: 1; grid-row: 1;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
  }
  /* 3: Telefono - ocultar */
  #page-calls .data-table td:nth-child(3) { display: none !important; }

  /* 4: Duracion - fila 2, derecha */
  #page-calls .data-table td:nth-child(4) {
    grid-column: 2; grid-row: 2;
    font-size: 0.75rem;
    text-align: right;
    margin-top: 4px;
  }
  /* 5: Resultado badge - fila 1, derecha */
  #page-calls .data-table td:nth-child(5) {
    display: flex !important;
    grid-column: 2; grid-row: 1;
    align-items: flex-start;
    justify-content: flex-end;
  }
  /* 6: Score - ocultar */
  #page-calls .data-table td:nth-child(6) { display: none !important; }

  /* Celdas colspan (loading / empty state) */
  #page-calls .data-table td[colspan] {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: block !important;
    text-align: center;
    white-space: normal;
  }
}

/* Desktop: FAB oculto */
@media (min-width: 769px) {
  #crm-fab { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   FASE 3 — Trigger: marcador nativo premium
══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Quitar max-width del wrapper desktop */
  #page-trigger > div {
    max-width: none !important;
    margin: 0 !important;
  }

  /* Card principal: transparente, sin borde */
  #page-trigger .card.mb-4 {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Ocultar titulo duplicado (ya esta en el page-title del header) */
  #page-trigger .card.mb-4 .card-header {
    display: none !important;
  }

  /* Card body: quitar padding, reducir gap */
  #page-trigger .card-body {
    padding: 0 !important;
    gap: 10px !important;
  }

  /* ─── Campo telefono: HERO ─────────────────────────────── */
  #page-trigger .card-body > div:first-child {
    background: var(--bg-surface);
    border: 2px solid rgba(194,162,79,0.35);
    border-radius: 18px;
    padding: 18px 20px 14px;
    box-shadow: 0 0 0 5px rgba(194,162,79,0.07);
    margin-bottom: 4px;
  }
  #page-trigger .card-body > div:first-child .form-label {
    font-size: 0.6875rem !important;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand) !important;
    margin-bottom: 10px;
    display: block;
  }
  #tr-phone {
    font-size: 1.875rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    min-height: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100%;
    caret-color: var(--brand);
  }
  #tr-phone:focus { outline: none; box-shadow: none !important; }
  #tr-phone::placeholder { color: rgba(255,255,255,0.18); font-weight: 300; }

  /* ─── Campos secundarios: mini-cards ──────────────────── */
  #page-trigger .card-body > div:nth-child(2),
  #page-trigger .card-body > div:nth-child(3),
  #page-trigger .card-body > div:nth-child(4) {
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 12px 16px 10px;
  }
  #page-trigger .card-body > div:nth-child(2) .form-label,
  #page-trigger .card-body > div:nth-child(3) .form-label,
  #page-trigger .card-body > div:nth-child(4) .form-label {
    font-size: 0.625rem !important;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted) !important;
    margin-bottom: 5px;
    display: block;
  }
  #tr-restaurant,
  #tr-contact {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    min-height: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 1rem !important;
    color: var(--text-primary) !important;
    width: 100%;
  }
  #tr-restaurant:focus,
  #tr-contact:focus { outline: none; box-shadow: none !important; }

  #tr-goal {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    min-height: 52px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 0.9375rem !important;
    color: var(--text-primary) !important;
    resize: none;
    width: 100%;
  }
  #tr-goal:focus { outline: none; box-shadow: none !important; }

  /* ─── Boton llamar: hero con anillo de pulso ──────────── */
  #trigger-btn {
    min-height: 64px !important;
    border-radius: 18px !important;
    font-size: 1.0625rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    justify-content: center !important;
    padding: 0 24px !important;
    gap: 14px !important;
    background: linear-gradient(135deg, var(--brand) 0%, #9a7d30 100%);
    color: #0A0F17;
    margin-top: 8px;
    animation: triggerPulse 2.5s ease-in-out infinite;
  }
  #trigger-btn:active {
    transform: scale(0.96) !important;
    animation: none;
  }
  #trigger-btn svg {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0;
  }

  @keyframes triggerPulse {
    0%, 100% {
      box-shadow: 0 6px 28px rgba(194,162,79,0.35),
                  0 2px 6px rgba(0,0,0,0.35),
                  0 0 0 0px rgba(194,162,79,0);
    }
    50% {
      box-shadow: 0 6px 28px rgba(194,162,79,0.45),
                  0 2px 6px rgba(0,0,0,0.35),
                  0 0 0 12px rgba(194,162,79,0.12);
    }
  }

  /* Status message */
  #trigger-status { border-radius: 12px !important; }

  /* Card "Calls this session" */
  #page-trigger .card:not(.mb-4) {
    border-radius: 14px;
    margin-top: 4px;
  }
}

/* ══════════════════════════════════════════════════════════════
   FASE 4 — Dashboard: KPI polish + llamadas recientes -> cards
══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ─── KPI cards: polish ────────────────────────────────── */

  /* Valor mas grande y prominente */
  #page-dashboard .kpi-value {
    font-size: 2rem;
    line-height: 1.1;
    margin-top: 4px;
  }
  /* Trend: mas visible */
  #page-dashboard .kpi-trend {
    font-size: 0.6875rem;
    margin-top: 6px;
    font-weight: 600;
  }
  /* Separador visual entre icono y cuerpo */
  #page-dashboard .kpi-card {
    gap: 12px;
  }
  /* Icono: ligeramente mas grande en dashboard */
  #page-dashboard .kpi-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  #page-dashboard .kpi-icon svg {
    width: 19px;
    height: 19px;
  }

  /* ─── Charts: mas compactos ────────────────────────────── */

  /* Reducir min-height de los charts en mobile */
  #page-dashboard #chart-calls-per-day,
  #page-dashboard #chart-clients-donut {
    min-height: 170px !important;
  }
  /* chart-grid gap mas ajustado */
  #page-dashboard .chart-grid {
    gap: 10px;
    margin-bottom: 12px;
  }
  /* Card body de charts: menos padding */
  #page-dashboard .chart-grid .card-body {
    padding: 10px 12px 12px !important;
  }
  /* Card header de charts: compacto */
  #page-dashboard .chart-grid .card-header {
    padding: 10px 14px !important;
  }

  /* ─── Llamadas recientes: tabla -> cards ────────────────── */

  /* Quitar scroll horizontal */
  #page-dashboard .card:last-child .overflow-x-auto {
    overflow-x: visible !important;
    padding: 4px 0;
  }

  /* Tabla -> block */
  #page-dashboard .card:last-child .data-table {
    display: block !important;
    min-width: 0 !important;
    width: 100%;
  }
  #page-dashboard .card:last-child .data-table thead {
    display: none !important;
  }
  #page-dashboard .card:last-child .data-table tbody {
    display: block !important;
  }

  /* Cada fila -> tarjeta */
  #recent-calls-body tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 0;
    padding: 13px 16px;
    margin: 0 0 6px;
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
  }
  #recent-calls-body tr:active { background: rgba(255,255,255,0.05); }
  #recent-calls-body tr:last-child { margin-bottom: 0; }

  /* Base de todas las celdas */
  #recent-calls-body td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* 1: Restaurante -> fila 1, izquierda (titulo) */
  #recent-calls-body td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
  }
  /* 2: Fecha -> fila 2, izquierda */
  #recent-calls-body td:nth-child(2) {
    grid-column: 1; grid-row: 2;
    font-size: 0.75rem;
    margin-top: 4px;
  }
  /* 3: Duracion -> fila 2, derecha */
  #recent-calls-body td:nth-child(3) {
    grid-column: 2; grid-row: 2;
    font-size: 0.75rem;
    text-align: right;
    margin-top: 4px;
  }
  /* 4: Badge resultado -> fila 1, derecha */
  #recent-calls-body td:nth-child(4) {
    display: flex !important;
    grid-column: 2; grid-row: 1;
    align-items: flex-start;
    justify-content: flex-end;
  }

  /* Celdas colspan (loading / empty state) */
  #recent-calls-body td[colspan] {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    display: block !important;
    text-align: center;
    white-space: normal;
  }

  /* ─── Boton "Ver todas" en card header ─────────────────── */
  #page-dashboard .card:last-child .card-header {
    padding: 12px 16px !important;
  }
  #page-dashboard .card:last-child .card-header .btn-sm {
    font-size: 0.75rem;
    padding: 6px 12px;
    min-height: 32px;
  }
}

/* ══════════════════════════════════════════════════════════════
   FIX — Bottom nav fijo en iOS + KPI cards compactos
══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ─── Fix iOS: position:fixed roto por overflow-x:hidden en body ─── */
  /* translateZ(0) fuerza capa de compositing propia → nav siempre fijo */
  #bottom-nav {
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }

  /* ─── KPI cards: layout horizontal compacto ─────────────────────── */

  /* Revertir flex-direction column del overhaul mobile */
  #page-dashboard .kpi-grid .kpi-card {
    flex-direction: row !important;
    align-items: center !important;
    padding: 11px 12px !important;
    gap: 10px !important;
    min-height: 0;
  }

  /* Icono mas pequeno */
  #page-dashboard .kpi-grid .kpi-icon {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    flex-shrink: 0;
  }
  #page-dashboard .kpi-grid .kpi-icon svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Cuerpo de la KPI card */
  #page-dashboard .kpi-grid .kpi-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
  }

  /* Label arriba, pequeno */
  #page-dashboard .kpi-grid .kpi-label {
    font-size: 0.5625rem !important;
    line-height: 1.2;
    order: -1;
  }

  /* Valor: grande pero no exagerado */
  #page-dashboard .kpi-grid .kpi-value {
    font-size: 1.375rem !important;
    line-height: 1.1;
    margin-top: 0 !important;
  }

  /* Trend: ocultar en mobile para ganar espacio */
  #page-dashboard .kpi-grid .kpi-trend {
    display: none !important;
  }

  /* Grid de KPI: gap mas ajustado */
  #page-dashboard .kpi-grid {
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   FIX — Sidebar + hamburger ocultos en mobile (bottom nav suficiente)
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar                              { display: none !important; }
  #sidebar-overlay                      { display: none !important; }
  #header button[onclick="toggleSidebar()"] { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   POLISH — Cards elegantes + FAB iOS fix + Calendario dark iOS
══════════════════════════════════════════════════════════════ */

/* ── FAB: fix iOS position:fixed (mismo bug que bottom-nav) ── */
@media (max-width: 768px) {
  #crm-fab {
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}

/* ── FullCalendar: CSS variables dark theme ───────────────── */
:root {
  --fc-border-color: rgba(255,255,255,0.06);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255,255,255,0.02);
  --fc-today-bg-color: rgba(194,162,79,0.07);
  --fc-small-font-size: 0.75em;
  --fc-event-bg-color: rgba(59,130,246,0.25);
  --fc-event-border-color: rgba(59,130,246,0.6);
  --fc-event-text-color: #93c5fd;
  --fc-list-event-hover-bg-color: rgba(255,255,255,0.04);
  --fc-highlight-color: rgba(194,162,79,0.1);
  --fc-non-business-color: rgba(255,255,255,0.015);
}

@media (max-width: 768px) {

  /* ── Calendario: layout del card ──────────────────────── */
  #page-calendar .card { border-radius: 16px !important; }
  #page-calendar .card-body { padding: 10px 6px !important; }

  /* ── Toolbar ────────────────────────────────────────── */
  .fc .fc-toolbar { margin-bottom: 10px !important; align-items: center; }
  .fc .fc-toolbar-title {
    font-size: 1.0625rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em;
  }
  .fc .fc-button {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    color: var(--text-muted) !important;
    border-radius: 8px !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    padding: 5px 9px !important;
    height: 30px !important;
    box-shadow: none !important;
    text-transform: none !important;
  }
  .fc .fc-button-primary:not(:disabled).fc-button-active,
  .fc .fc-button-primary:not(:disabled):active,
  .fc .fc-button:focus {
    background: var(--brand) !important;
    color: #0A0F17 !important;
    border-color: var(--brand) !important;
    box-shadow: none !important;
  }
  .fc .fc-prev-button, .fc .fc-next-button {
    width: 30px !important;
    padding: 0 !important;
    justify-content: center;
  }

  /* ── Cabecera dias (L M X J V S D) ──────────────────── */
  .fc-col-header-cell { background: transparent !important; border: none !important; }
  .fc-col-header-cell-cushion {
    color: rgba(255,255,255,0.35) !important;
    font-size: 0.625rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 4px 0 6px !important;
    text-decoration: none !important;
  }

  /* ── Celdas del dia ──────────────────────────────────── */
  .fc-daygrid-day { background: transparent !important; }
  .fc-daygrid-day.fc-day-today { background: rgba(194,162,79,0.07) !important; }
  .fc-daygrid-day-frame { min-height: 46px !important; }
  .fc-daygrid-day-top { justify-content: center !important; }
  .fc-daygrid-day-number {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 2px auto 0 !important;
    float: none !important;
  }
  .fc-day-today .fc-daygrid-day-number {
    background: var(--brand) !important;
    color: #0A0F17 !important;
    font-weight: 700 !important;
  }
  .fc-day-other .fc-daygrid-day-number { opacity: 0.28 !important; }

  /* ── Eventos: puntos iOS ────────────────────────────── */
  .fc-daygrid-day-events {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 1px 2px 3px !important;
    min-height: 0 !important;
  }
  .fc-daygrid-event-harness { flex-shrink: 0 !important; margin: 0 !important; }
  a.fc-daygrid-event {
    width: 6px !important;
    height: 6px !important;
    min-height: 0 !important;
    border-radius: 50% !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  .fc-daygrid-event .fc-event-main { display: none !important; }
  .fc-daygrid-more-link {
    font-size: 0.6rem !important;
    color: var(--text-muted) !important;
    line-height: 1 !important;
  }

  /* ── Grid borders ─────────────────────────────────── */
  .fc-scrollgrid { border: none !important; }
  .fc-scrollgrid-section > * { border-color: rgba(255,255,255,0.04) !important; }
  td.fc-daygrid-day { border-color: rgba(255,255,255,0.04) !important; }
  .fc-scrollgrid-sync-table { width: 100% !important; }

  /* ── Vista lista (cuando user cambia) ─────────────── */
  .fc-list { border: none !important; }
  .fc-list-table { border: none !important; }
  .fc-list-day-cushion {
    background: rgba(255,255,255,0.03) !important;
    color: var(--text-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 8px 12px !important;
  }
  .fc-list-event:hover td { background: rgba(255,255,255,0.03) !important; }
  .fc-list-event-title { color: var(--text-primary) !important; }
  .fc-list-event-time { color: var(--text-muted) !important; font-size: 0.75rem !important; }
  .fc-list-event-dot { border-width: 5px !important; }
  .fc-list-empty-cushion { color: var(--text-muted) !important; font-size: 0.875rem !important; }

  /* ── Leyenda debajo del calendario ───────────────── */
  .calendar-legend {
    padding: 10px 16px !important;
    gap: 16px !important;
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
  }

  /* ── Cards Calls + CRM: mejoras visuales ────────────── */

  /* Accent border izquierdo por resultado */
  #page-calls .data-table tr {
    border-left: 3px solid transparent !important;
    padding-left: 14px !important;
  }
  #page-calls .data-table tr:has(.badge-success) { border-left-color: #22c55e !important; }
  #page-calls .data-table tr:has(.badge-warning) { border-left-color: #f59e0b !important; }
  #page-calls .data-table tr:has(.badge-danger)  { border-left-color: #ef4444 !important; }
  #page-calls .data-table tr:has(.badge-secondary) { border-left-color: rgba(255,255,255,0.15) !important; }

  /* Mejor contraste de fondo de card */
  #page-calls .data-table tr,
  #page-crm .data-table tr {
    background: rgba(255,255,255,0.038) !important;
    border-color: rgba(255,255,255,0.07) !important;
  }
  #page-calls .data-table tr:active,
  #page-crm .data-table tr:active {
    background: rgba(255,255,255,0.065) !important;
  }

  /* Nombre (col principal) mas legible */
  #page-calls .data-table td:nth-child(2),
  #page-crm .data-table td:nth-child(1) {
    letter-spacing: -0.01em !important;
  }

  /* Fecha / info secundaria mas sutil */
  #page-calls .data-table td:nth-child(1),
  #page-crm .data-table td:nth-child(2),
  #page-crm .data-table td:nth-child(4) {
    opacity: 0.65 !important;
  }

  /* Date inputs del toolbar de llamadas: aspecto uniforme */
  #page-calls #calls-from,
  #page-calls #calls-to {
    -webkit-appearance: none;
    appearance: none;
    min-height: 40px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 10px !important;
    padding: 0 10px !important;
    font-size: 0.8rem !important;
    color: var(--text-secondary) !important;
  }
  #page-calls #calls-from::-webkit-date-and-time-value,
  #page-calls #calls-to::-webkit-date-and-time-value {
    text-align: left;
    color: var(--text-muted);
  }

  /* Toolbar wrapper: fondo unificado */
  #page-calls .toolbar {
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    padding: 10px 10px 8px;
    border: 1px solid rgba(255,255,255,0.05);
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  #page-crm .toolbar {
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    padding: 10px 10px 8px;
    border: 1px solid rgba(255,255,255,0.05);
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  /* Paginacion mas compacta */
  #page-calls .pagination-bar,
  #page-crm .pagination-bar {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    padding: 8px 0 !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   FIX2 — Cards espaciado + CRM toolbar + Calendario paneles
══════════════════════════════════════════════════════════════ */

/* ── Panel eventos del dia ──────────────────────────────── */
.cal-day-panel {
  margin-top: 12px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
}
.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cal-day-title-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.cal-day-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.cal-day-group { padding: 10px 16px 4px; }
.cal-day-group:not(:first-child) { padding-top: 8px; }
.cal-day-group-title {
  display: flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cal-day-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cal-day-event-row:last-child { border-bottom: none; padding-bottom: 6px; }
.cal-day-event-row:active { opacity: 0.7; }
.cal-day-event-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}
.cal-day-event-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 12px;
}
.cal-day-empty {
  padding: 20px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

@media (max-width: 768px) {

  /* ── Espaciado entre tarjetas: mas aire ────────────────── */
  #page-calls .data-table tr { margin-bottom: 10px !important; }
  #page-crm   .data-table tr { margin-bottom: 10px !important; }
  #recent-calls-body tr      { margin-bottom: 10px !important; }

  /* ── CRM toolbar: mostrar boton + como icono cuadrado ──── */
  /* Sobreescribir el display:none de FASE 2 */
  #page-crm .toolbar .btn-primary {
    display: flex !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    margin-left: 0 !important;
  }
  /* Ocultar el texto, dejar solo el icono SVG */
  #page-crm .toolbar .btn-primary span { display: none !important; }
  /* FAB ya no hace falta (boton en toolbar) */
  #crm-fab { display: none !important; }

  /* ── FullCalendar timeGrid dark theme ───────────────────── */
  .fc-timegrid-slot { background: transparent !important; border-color: rgba(255,255,255,0.04) !important; }
  .fc-timegrid-slot-label { color: rgba(255,255,255,0.3) !important; font-size: 0.65rem !important; }
  .fc-timegrid-col { border-color: rgba(255,255,255,0.04) !important; }
  .fc-timegrid-axis { border-color: rgba(255,255,255,0.04) !important; }
  .fc-timegrid-col-frame { background: transparent !important; }
  .fc-timegrid-now-indicator-line { border-color: var(--brand) !important; }
  .fc-timegrid-now-indicator-arrow { border-top-color: var(--brand) !important; }
  .fc-timegrid-event {
    border-radius: 6px !important;
    padding: 2px 4px !important;
    font-size: 0.75rem !important;
    border: none !important;
    background: rgba(59,130,246,0.3) !important;
    color: #93c5fd !important;
  }

  /* ── FC title: puntero para indicar que es clickable ───── */
  .fc-toolbar-title {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .fc-toolbar-title:active { opacity: 0.7; }
}

/* ══════════════════════════════════════════════════════════════
   FIX3 — Toolbar CRM grid explicito + cards con mas aire
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── CRM toolbar: CSS Grid para control exacto ──────────
     Row 1: [search  search  search ]
     Row 2: [estado  tipo    +button]
  ─────────────────────────────────────────────────────────── */
  #page-crm .toolbar {
    display: grid !important;
    grid-template-columns: 1fr 1fr 42px !important;
    grid-template-rows: auto auto !important;
    gap: 8px !important;
    /* Anular propiedades flexbox anteriores */
    flex-wrap: unset !important;
    align-items: unset !important;
    flex-direction: unset !important;
  }
  #page-crm #crm-search {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    /* Anular flex anteriores */
    flex: unset !important;
    max-width: none !important;
    order: unset !important;
    width: 100% !important;
  }
  #page-crm #crm-estado {
    grid-column: 1 !important;
    grid-row: 2 !important;
    flex: unset !important;
    order: unset !important;
    width: 100% !important;
    min-width: 0 !important;
    font-size: 0.8125rem !important;
  }
  #page-crm #crm-tipo {
    grid-column: 2 !important;
    grid-row: 2 !important;
    flex: unset !important;
    order: unset !important;
    width: 100% !important;
    min-width: 0 !important;
    font-size: 0.8125rem !important;
  }
  /* Boton +: columna 3, misma fila que filtros */
  #page-crm .toolbar .btn-primary {
    grid-column: 3 !important;
    grid-row: 2 !important;
    order: unset !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    justify-content: center !important;
    align-items: center !important;
    margin-left: 0 !important;
    flex-shrink: 0 !important;
  }
  #page-crm .toolbar .btn-primary span { display: none !important; }
  #crm-fab { display: none !important; }

  /* ── Calls toolbar: grid tambien ────────────────────────
     Row 1: [search  search  search ]
     Row 2: [from    to      ]
     Row 3: [disposition     ]
  ─────────────────────────────────────────────────────────── */
  #page-calls .toolbar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto auto !important;
    gap: 8px !important;
    flex-wrap: unset !important;
    align-items: unset !important;
  }
  #page-calls #calls-search {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    flex: unset !important;
    max-width: none !important;
    order: unset !important;
    width: 100% !important;
  }
  #page-calls #calls-from {
    grid-column: 1 !important;
    grid-row: 2 !important;
    flex: unset !important;
    order: unset !important;
    width: 100% !important;
    min-height: 38px !important;
  }
  #page-calls #calls-to {
    grid-column: 2 !important;
    grid-row: 2 !important;
    flex: unset !important;
    order: unset !important;
    width: 100% !important;
    min-height: 38px !important;
  }
  #page-calls #calls-disposition {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    flex: unset !important;
    order: unset !important;
    width: 100% !important;
  }

  /* ── Cards: más separación visible ─────────────────────── */
  #page-crm   .data-table tr { margin-bottom: 16px !important; }
  #page-calls .data-table tr { margin-bottom: 16px !important; }
  #recent-calls-body tr       { margin-bottom: 14px !important; }

  /* Fondo card con más contraste respecto a la página */
  #page-crm   .data-table tr,
  #page-calls .data-table tr {
    background: rgba(255,255,255,0.055) !important;
    border: 1px solid rgba(255,255,255,0.09) !important;
  }

  /* Padding interno generoso */
  #page-crm   .data-table tr { padding: 14px 16px !important; }
  #page-calls .data-table tr { padding: 14px 14px 14px 16px !important; }
}

/* ══════════════════════════════════════════════════════════════
   FIX4 — Calendario: modal centrado, sin subrayado, X grande
══════════════════════════════════════════════════════════════ */

/* ── Modal "Ir a fecha": fix iOS position:fixed + z-index alto ── */
#cal-picker-overlay {
  -webkit-transform: translate3d(0, 0, 0) !important;
  transform: translate3d(0, 0, 0) !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  z-index: 250 !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Mismo fix para TODOS los modal-overlay (evita el mismo bug en otros modales) */
.modal-overlay {
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ── Quitar subrayado del titulo del calendario ──────────────── */
.fc-toolbar-title {
  text-decoration: none !important;
  cursor: pointer !important;
}
.fc-toolbar-title:active { opacity: 0.65 !important; }

/* ── X del panel de dia: mas grande y visible ─────────────────── */
.cal-day-close-btn {
  width: 36px !important;
  height: 36px !important;
  background: rgba(255,255,255,0.14) !important;
  border-radius: 50% !important;
  border: none !important;
  color: var(--text-primary) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
  /* Area de toque extendida 8px en todas direcciones */
  position: relative !important;
}
.cal-day-close-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
}
.cal-day-close-btn svg {
  width: 16px !important;
  height: 16px !important;
}

/* ── Header del panel: mas padding para que el X respire ────── */
.cal-day-header {
  padding: 14px 16px 12px !important;
  gap: 12px !important;
}

/* FIX5 - Slide panel mobile: empieza bajo header, X siempre visible */
@media (max-width: 768px) {
  #slide-panel {
    top: var(--header-h, 56px) !important;
    width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-left: none !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 16px 16px 0 0 !important;
  }
  #slide-panel > div:first-child {
    padding: 14px 16px !important;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 5;
  }
  #slide-panel > div:first-child h2 {
    font-size: 1rem !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
  }
  #slide-panel > div:first-child button {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.1) !important;
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  #slide-panel > div:first-child button svg {
    width: 18px !important;
    height: 18px !important;
  }
  #slide-panel > div:last-child {
    padding-bottom: calc(var(--bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
  }
  #slide-overlay {
    top: var(--header-h, 56px) !important;
  }
}

/* FIX6 - Dia seleccionado por el usuario (distinto al dia de hoy) */
.fc-day-selected .fc-daygrid-day-number {
  background: rgba(255,255,255,0.18) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: 50% !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
/* Si hoy tambien esta seleccionado, el dorado de hoy tiene prioridad */
.fc-day-today.fc-day-selected .fc-daygrid-day-number {
  background: var(--brand) !important;
  color: #0A0F17 !important;
}

/* ═══════════════════════════════════════════════════════
   WIDGET SYSTEM (Paso 3)
   ═══════════════════════════════════════════════════════ */

/* -- hw-bar: barra con boton personalizar -- */
.hw-bar {
  display: flex;
  justify-content: flex-end;
  padding: 2px 0 6px;
}
.hw-customize-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-size: 0.8125rem;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.hw-customize-btn:hover {
  background: rgba(255,255,255,0.13);
  color: var(--text-primary);
}

/* -- Contenedor widget -- */
.home-widget[data-hidden="true"] { display: none !important; }
.hw-clickable { cursor: pointer; user-select: none; }
.hw-clickable:active { opacity: 0.82; }
.hw-card .card-header { cursor: inherit; }

/* -- Widget today: grid 2x2 o 4x1 -- */
.hw-today-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px 0 2px;
}
@media (max-width: 480px) {
  .hw-today-body { grid-template-columns: repeat(2, 1fr); }
}
.hw-today-stat {
  text-align: center;
  padding: 10px 4px 6px;
}
.hw-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.hw-stat-value.hw-ok    { color: #10b981; }
.hw-stat-value.hw-brand { color: var(--brand); }
.hw-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* -- Widget upcoming -- */
.hw-upcoming-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 8px;
}
.hw-upcoming-item:last-child { border-bottom: none; }
.hw-upcoming-name {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hw-upcoming-date {
  font-size: 0.75rem;
  color: var(--brand);
  white-space: nowrap;
  flex-shrink: 0;
}

/* -- Widget top clients -- */
.hw-client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.hw-client-item:last-child { border-bottom: none; }
.hw-client-item:hover .hw-client-name { color: var(--brand); }
.hw-client-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700;
  flex-shrink: 0;
}
.hw-client-info { flex: 1; min-width: 0; }
.hw-client-name {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.15s;
}
.hw-client-sub { font-size: 0.75rem; color: var(--text-muted); }

/* -- Widget mini calendario -- */
.hw-mini-cal { font-size: 0.8125rem; }
.hw-mc-head {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}
.hw-mc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.hw-mc-dname {
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 2px 0 4px;
  font-weight: 600;
}
.hw-mc-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
  position: relative;
}
.hw-mc-day.hw-mc-today {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.hw-mc-day.hw-mc-other { color: rgba(255,255,255,0.18); }
.hw-mc-day.hw-mc-event::after {
  content: '';
  position: absolute;
  bottom: 1px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--brand);
}
.hw-mc-day.hw-mc-today.hw-mc-event::after { background: rgba(255,255,255,0.6); }

/* -- Empty state -- */
.hw-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 16px;
  font-size: 0.875rem;
  margin: 0;
}

/* -- Modal personalizar -- */
.hw-cust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.hw-cust-item:last-child { border-bottom: none; }
.hw-cust-label {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
}
.hw-cust-toggle {
  position: relative;
  width: 38px; height: 22px;
  background: rgba(255,255,255,0.15);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  border: none;
  padding: 0;
  outline: none;
}
.hw-cust-toggle.on { background: var(--brand); }
.hw-cust-toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.hw-cust-toggle.on::after { transform: translateX(16px); }
.hw-cust-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hw-cust-arrows button {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  border: none; border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  padding: 0;
  transition: background 0.15s;
}
.hw-cust-arrows button:hover { background: rgba(255,255,255,0.15); }
.hw-cust-arrows button:disabled { opacity: 0.25; cursor: default; }

/* ═══════════════════════════════════════════════════════
   WIDGET EDIT MODE (Paso 3b) - drag & drop inline
   ═══════════════════════════════════════════════════════ */

/* Fix: modal personalizar - siempre muestra el boton guardar */
#home-customize-modal .modal-box {
  max-height: 88vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
#hw-customize-list {
  overflow-y: auto;
  flex: 1;
}

/* -- Modo edicion: contorno punteado en widgets -- */
.hw-edit-mode .home-widget {
  position: relative;
  outline: 1px dashed rgba(255,255,255,0.18) !important;
  outline-offset: 1px;
  border-radius: 12px;
  transition: outline-color 0.2s;
}
/* Widgets ocultos siguen visibles en modo edicion (semitransparentes) */
.hw-edit-mode .home-widget[data-hidden="true"] {
  display: block !important;
  opacity: 0.35;
}
/* Deshabilitar clicks en tarjetas mientras se edita */
.hw-edit-mode .hw-clickable {
  pointer-events: none;
}
.hw-edit-mode .kpi-card {
  pointer-events: none;
}

/* -- Edit bar: barra de controles sobre cada widget -- */
.hw-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  touch-action: none;
  user-select: none;
}
.hw-drag-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}
.hw-drag-grip:active { cursor: grabbing; }
.hw-edit-label {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hw-vis-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.hw-vis-toggle.hw-vis-on {
  color: var(--brand);
  background: rgba(139,26,26,0.18);
}
.hw-vis-toggle:hover { background: rgba(255,255,255,0.14); }

/* -- Widget siendo arrastrado -- */
.hw-dragging {
  opacity: 0.55 !important;
  outline-color: var(--brand) !important;
  outline-style: solid !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  z-index: 50;
  position: relative;
}

/* -- Boton Listo (verde) -- */
.hw-done-btn {
  background: rgba(16,185,129,0.15) !important;
  color: #10b981 !important;
  border-color: rgba(16,185,129,0.4) !important;
}
.hw-done-btn:hover {
  background: rgba(16,185,129,0.25) !important;
}

/* -- Ajuste: card dentro de edit bar no duplica border-radius top -- */
.hw-edit-mode .home-widget > .card {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}
.hw-edit-mode .home-widget > div:not(.hw-edit-bar) > .kpi-grid,
.hw-edit-mode .home-widget[data-widget-id="widget-kpis"] .kpi-grid {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* ── WIDGET_SPACING_FIX: espacio entre widgets ── */
.home-widget + .home-widget {
  margin-top: 12px;
}
/* Tambien espacio entre hw-bar y el primer widget */
.hw-bar + .home-widget {
  margin-top: 4px;
}

/* ── MINI CAL COMPACT: calendario mas pequeno ── */
#widget-mini-cal .card-body {
  padding: 8px 12px 10px !important;
}
.hw-mc-grid {
  gap: 1px !important;
}
.hw-mc-dname {
  font-size: 0.6rem !important;
  padding: 1px 0 3px !important;
}
.hw-mc-day {
  font-size: 0.68rem !important;
  /* Reducir aspect-ratio para que las celdas sean mas bajas */
  min-height: 22px;
  aspect-ratio: auto !important;
  height: 22px;
}
.hw-mc-head {
  font-size: 0.75rem !important;
  margin-bottom: 4px !important;
}

/* ── MINICAL_CIRCLE_FIX: circulo perfecto para dia actual ── */
.hw-mc-day {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  aspect-ratio: auto !important;
  height: 24px !important;
  min-height: unset !important;
  background: none !important;
}
.hw-mc-day span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}
.hw-mc-day.hw-mc-today span {
  background: var(--brand);
  color: #fff !important;
  font-weight: 700;
}
.hw-mc-day.hw-mc-other span {
  color: rgba(255,255,255,0.2);
}
/* Punto de evento: en el div contenedor, no en el span */
.hw-mc-day.hw-mc-event {
  position: relative;
}
.hw-mc-day.hw-mc-event::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--brand);
}
.hw-mc-day.hw-mc-today.hw-mc-event::after {
  background: rgba(255,255,255,0.7);
}

/* ── HW_BAR_CENTER_FIX ─────────────────────────────────── */
.hw-bar {
  display: flex !important;
  justify-content: center !important;
  padding: 20px 16px 0 16px !important;
  margin-bottom: 0 !important;
}
/* Espacio extra al final del dashboard para que el boton
   no quede tapado por la barra de navegacion inferior */
#page-dashboard {
  padding-bottom: calc(var(--bottom-nav-h, 72px) + env(safe-area-inset-bottom, 0px) + 24px) !important;
}
.hw-customize-btn {
  min-width: 160px;
}

/* ══════════════════════════════════════════════════════════════
   REVOLUT_STYLE: floating nav + header scroll + gradients
   ══════════════════════════════════════════════════════════════ */

/* ── 1. Gradiente de fondo (solo movil) ──── */
@media (max-width: 768px) {
  body {
    background: #080d17;
  }
  #page-content {
    background: linear-gradient(180deg,
      rgba(16, 24, 44, 0.6) 0%,
      rgba(8, 13, 23, 0) 40%
    );
  }
}

/* ── 2. Bottom nav flotante (isla pill) ──── */
@media (max-width: 768px) {
  #bottom-nav {
    left:   12px !important;
    right:  12px !important;
    bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 28px !important;
    border-top: none !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    padding-bottom: 4px !important;
    box-shadow:
      0 8px 40px rgba(0,0,0,0.55),
      0 0 0 1px rgba(194,162,79,0.08),
      inset 0 1px 0 rgba(255,255,255,0.05) !important;
    background: rgba(10,16,28,0.92) !important;
  }

  /* Mas espacio en el contenido para compensar el gap del nav */
  #page-content {
    padding-bottom: calc(var(--bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px) + 30px) !important;
  }
  /* Mismo fix para el dashboard */
  #page-dashboard {
    padding-bottom: calc(var(--bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px) + 40px) !important;
  }
}

/* ── 3. Header scroll effect ──── */
@media (max-width: 768px) {
  #header {
    transition: background 0.25s ease, box-shadow 0.25s ease !important;
  }
  #header.hdr-scrolled {
    background: rgba(7, 12, 22, 0.99) !important;
    box-shadow: 0 1px 0 rgba(194,162,79,0.1), 0 4px 24px rgba(0,0,0,0.6) !important;
  }
}

/* ── 4. Header botones mas redondeados / glass ──── */
@media (max-width: 768px) {
  .header-icon-btn {
    border-radius: 50% !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
  }
  .header-icon-btn:active {
    background: rgba(255,255,255,0.12) !important;
    transform: scale(0.93);
  }
  .lang-btn {
    border-radius: 8px !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
  }
  #header-credits-btn {
    border-radius: 20px !important;
    background: rgba(194,162,79,0.1) !important;
  }
}

/* ── 5. Nav items — active indicator mas sutil ──── */
@media (max-width: 768px) {
  .nav-item-mobile.active::before {
    width: 20px !important;
    border-radius: 3px !important;
    opacity: 0.9 !important;
  }
  /* Pill activo debajo del icono en lugar de linea arriba */
  .nav-item-mobile:not(.nav-hero) {
    border-radius: 16px;
    transition: background 0.2s ease;
  }
  .nav-item-mobile:not(.nav-hero).active {
    background: rgba(194,162,79,0.08) !important;
  }
}

/* DESKTOP_TABLE_FOOTER */
@media (min-width: 769px) {
  .table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
  }
  #crm-count { padding-left: 4px; min-width: fit-content; }
}

/* ── PROFILE_MODAL_MOBILE: perfil como pagina en movil ──────────── */
@media (max-width: 768px) {
  #profile-modal-box {
    max-height: 95dvh !important;
    border-radius: 20px 20px 0 0 !important;
  }
  /* Inputs del perfil: area de toque mas grande en movil */
  #profile-modal-box input {
    padding: 11px 13px !important;
    font-size: 1rem !important;
  }
  /* Grid de 1 columna en pantallas estrechas */
  #profile-modal-box .grid-2col {
    grid-template-columns: 1fr !important;
  }
}

/* MODAL_ZINDEX_MOBILE_FIX: modal por encima del bottom-nav (z-index 150) */
@media (max-width: 768px) {
  .modal-overlay {
    z-index: 210 !important;
    align-items: flex-end;
    padding: 0;
    padding-bottom: 0 !important;
  }
  .modal-overlay .modal-box {
    border-radius: 20px 20px 0 0 !important;
    max-height: 93dvh !important;
    max-width: 100% !important;
    width: 100%;
    margin: 0;
  }
}
