/* ===============================================
   MIDIA GESTIÓN — MINIMAL edition
   Denser, flatter, tighter
   MG30.43 — bottom nav móvil + media queries responsive
   =============================================== */
:root {
  --brand-50:  #eefaf9;
  --brand-100: #d4f1ee;
  --brand-200: #a4e0dc;
  --brand-300: #6dcac6;
  --brand-400: #3eb0ac;
  --brand-500: #249691;
  --brand-600: #167571;
  --brand-700: #0f5854;
  --brand-800: #0a413e;
  --brand-900: #062b29;

  --ink-50:  #fafbfc;
  --ink-100: #f2f4f6;
  --ink-200: #e6e9ed;
  --ink-300: #d0d5dc;
  --ink-400: #9097a1;
  --ink-500: #636a75;
  --ink-600: #434951;
  --ink-700: #2a2e34;
  --ink-800: #171a1e;
  --ink-900: #0a0c0e;

  --success: #0f8f6f;
  --warning: #c68a2e;
  --danger:  #c83a3e;
  --info:    #4778c2;

  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-alt: #fafbfc;
  --border:      #ebeef1;
  --border-soft: #f2f4f6;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-full: 999px;

  --shadow-xs: 0 1px 1px rgba(15,20,27,.03);
  --shadow-sm: 0 1px 2px rgba(15,20,27,.04);
  --shadow-md: 0 2px 8px rgba(15,20,27,.05);
  --shadow-lg: 0 8px 24px rgba(15,20,27,.08);

  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg:          #0a0c0e;
  --surface:     #0f1215;
  --surface-alt: #0c0f12;
  --border:      #1d2126;
  --border-soft: #161a1e;

  --ink-50:  #0a0c0e;
  --ink-100: #0f1215;
  --ink-200: #171a1e;
  --ink-300: #2a2e34;
  --ink-400: #434951;
  --ink-500: #636a75;
  --ink-600: #9097a1;
  --ink-700: #d0d5dc;
  --ink-800: #e6e9ed;
  --ink-900: #fafbfc;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body, #root { min-height: 100%; }
/* MG20260520 #130 — Lock pantalla móvil: evita scroll horizontal y rebote */
html, body { overflow-x: hidden; overscroll-behavior-x: contain; }
@media (max-width: 768px) {
  html, body { overscroll-behavior: contain; }
  /* Evita zoom inadvertido por gestos */
  body { touch-action: pan-y; }
}
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink-800);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
::selection { background: var(--brand-200); color: var(--brand-900); }

/* ===============================================
   App shell
   =============================================== */
.app {
  display: grid;
  grid-template-columns: auto 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ===============================================
   Sidebar — narrow, flat
   =============================================== */
.sidebar {
  width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .18s ease;
  z-index: 10;
}
.sidebar.collapsed { width: 48px; }
.sidebar.collapsed .sidebar-scroll {
  /* MG30.43bv — sin scrollbar visible en modo colapsado */
  overflow-y: auto; padding: 4px 2px;
  scrollbar-width: none;
}
.sidebar.collapsed .sidebar-scroll::-webkit-scrollbar { display: none; width: 0; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-soft);
  min-height: 48px;
}
.sidebar-brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand-500);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-brand-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-900);
  letter-spacing: -.2px;
  line-height: 1.1;
}
.sidebar-brand-sub {
  font-size: 10px;
  color: var(--ink-500);
  margin-top: 1px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .nav-badge {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}
.sidebar.collapsed .nav-group-label {
  display: none;
}
.sidebar.collapsed .nav-group {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar.collapsed .nav-group:last-child { border-bottom: none; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 5px 0;
  font-size: 0;
  min-height: 30px;
}
.sidebar.collapsed .nav-item .nav-emoji,
.sidebar.collapsed .nav-item svg,
.sidebar.collapsed .nav-icon {
  font-size: 18px;
}
.sidebar.collapsed .nav-group { margin-bottom: 2px; padding-bottom: 2px; }
.sidebar.collapsed .sidebar-user { padding: 8px; justify-content: center; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-300) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 2px; }

.nav-group { margin-bottom: 6px; }
.nav-group-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-400);
  padding: 6px 8px 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  margin: 0;
  border-radius: var(--r-xs);
  color: var(--ink-700);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 12.5px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
  transition: background .1s, color .1s;
}
.nav-item:hover { background: var(--ink-100); color: var(--ink-900); }
.nav-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
[data-theme="dark"] .nav-item:hover { background: var(--ink-200); }
[data-theme="dark"] .nav-item.active {
  background: rgba(36,150,145,.15);
  color: var(--brand-300);
}
.nav-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  opacity: .85;
}
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 0px 5px;
  border-radius: var(--r-full);
  line-height: 1.4;
  min-width: 14px;
  text-align: center;
  background: var(--ink-200);
  color: var(--ink-700);
}
.nav-badge.hot { background: var(--danger); color: white; }

.sidebar.collapsed .nav-item { justify-content: center; padding: 8px 0; }

.sidebar-footer {
  border-top: 1px solid var(--border-soft);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background .1s;
}
.sidebar-user:hover { background: var(--ink-100); }
.sidebar-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #f4b46a, #e87d5a);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 9.5px;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--ink-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-user-org {
  font-size: 10px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: transparent;
  border: none;
  color: var(--ink-500);
  cursor: pointer;
  border-radius: var(--r-xs);
  font-size: 11px;
  transition: background .1s, color .1s;
  font-family: inherit;
}
.sidebar-collapse-btn:hover { background: var(--ink-100); color: var(--ink-800); }

/* ===============================================
   Main
   =============================================== */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 44px;
}
.topbar-title { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.topbar-breadcrumb {
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}
.topbar-breadcrumb > span { white-space: nowrap; }
.topbar-breadcrumb .sep { color: var(--ink-300); }
.topbar-breadcrumb .current { color: var(--ink-900); font-weight: 600; }

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

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--ink-100);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  width: 240px;
  color: var(--ink-500);
  font-size: 12px;
  cursor: text;
  transition: background .1s, border-color .1s;
}
.search-box:hover { background: var(--ink-200); }
.search-box:focus-within { background: var(--surface); border-color: var(--brand-300); }
.search-box input {
  border: none; background: transparent; outline: none; flex: 1;
  font-size: 12px; font-family: inherit; color: var(--ink-800); padding: 0;
}
.search-box kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0px 4px;
  color: var(--ink-500);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink-600);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background .1s, color .1s;
  position: relative;
}
.topbar-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.topbar-btn.icon { padding: 5px; }
.topbar-btn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  position: absolute;
  top: 4px; right: 4px;
}

.topbar-org {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--ink-100);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-800);
  cursor: pointer;
  transition: background .1s;
}
.topbar-org:hover { background: var(--ink-200); }
.topbar-org-flag {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(180deg, #aa151b 0% 33%, #f1bf00 33% 66%, #aa151b 66% 100%);
  flex-shrink: 0;
}

.topbar-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f4b46a, #e87d5a);
  cursor: pointer;
  display: grid; place-items: center;
  color: white;
  font-weight: 700;
  font-size: 10px;
}

/* ===============================================
   Content — tighter padding
   =============================================== */
.content {
  flex: 1;
  padding: 12px 16px 24px;
  overflow-y: auto;
  background: var(--surface-alt);
  min-height: 0;
}

/* ===============================================
   Primitives
   =============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .1s;
  white-space: nowrap;
  line-height: 1.3;
}
.btn-primary {
  background: var(--brand-500);
  color: white;
}
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink-800);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--ink-100); border-color: var(--ink-300); }
.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }
.btn-sm { padding: 3px 8px; font-size: 11.5px; }
.btn-lg { padding: 8px 14px; font-size: 13px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-700);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all .1s;
  line-height: 1.3;
}
.chip:hover { border-color: var(--ink-300); color: var(--ink-900); }
.chip.active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: white;
}
[data-theme="dark"] .chip.active { background: var(--brand-500); border-color: var(--brand-500); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--r-xs);
  line-height: 1.4;
}
.badge.success { background: #e4f4ec; color: #0a6d53; }
.badge.warning { background: #fbefd8; color: #8f601a; }
.badge.danger  { background: #f8dedf; color: #9a2125; }
.badge.info    { background: #dce6f6; color: #2a5299; }
.badge.neutral { background: var(--ink-100); color: var(--ink-700); }
[data-theme="dark"] .badge.success { background: rgba(15,143,111,.15); color: #5ec4a5; }
[data-theme="dark"] .badge.warning { background: rgba(198,138,46,.15); color: #e0b467; }
[data-theme="dark"] .badge.danger  { background: rgba(200,58,62,.15); color: #e07478; }
[data-theme="dark"] .badge.info    { background: rgba(71,120,194,.15); color: #7ea5db; }
[data-theme="dark"] .badge.neutral { background: var(--ink-200); color: var(--ink-700); }

/* Card: no rounded corners, no shadow - borders only */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.card-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.1px;
  flex: 1;
}
.card-body { padding: 12px; }

/* ===============================================
   Section head — minimal
   =============================================== */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: flex-end; /* MG30.43bv — botones de acción a la derecha */
}
/* MG30.43bv — ocultamos el título/subtítulo del cabezal (ahora va arriba en el topbar) */
.section-head-left { display: none !important; }
.section-title { display: none; }
.section-subtitle { display: none; }
/* Si .section-head solo tenía title+subtitle (no botones), colapsamos */
.section-head:has(> *:only-child) { display: none; margin: 0; }
.section-head:empty { display: none; margin: 0; }
/* Subtítulo dinámico en el topbar (al lado del breadcrumb) */
.topbar-subtitle {
  color: var(--ink-500);
  font-weight: 400;
  font-size: 12.5px;
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
@media (max-width: 768px) {
  .topbar-subtitle { font-size: 11px; max-width: 50vw; }
}

/* ===============================================
   Report nav — minimal row of text tabs
   =============================================== */
.report-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.report-tabs::-webkit-scrollbar { display: none; }
.report-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-500);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all .1s;
  font-family: inherit;
  margin-bottom: -1px;
  flex-shrink: 0;
}
.report-tab:hover { color: var(--ink-900); }
.report-tab.active {
  color: var(--ink-900);
  font-weight: 600;
  border-bottom-color: var(--brand-500);
}
.report-tab-emoji { font-size: 11.5px; opacity: .75; }

.subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.subtab {
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-600);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all .1s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.subtab:hover { border-color: var(--ink-300); color: var(--ink-900); }
.subtab.active {
  background: var(--ink-100);
  color: var(--ink-900);
  border-color: var(--ink-300);
}
[data-theme="dark"] .subtab.active { background: var(--ink-200); }

/* Filter bar — inline, compact */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.date-input {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-800);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: border-color .1s;
}
.date-input:hover { border-color: var(--ink-300); }
.date-sep { color: var(--ink-400); font-weight: 400; font-family: var(--font-sans); font-size: 11px; }

.quick-range {
  display: flex;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  overflow: hidden;
}
.quick-range-btn {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-600);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  transition: all .1s;
}
.quick-range-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.quick-range-btn.active {
  background: var(--ink-900);
  color: white;
}
[data-theme="dark"] .quick-range-btn.active { background: var(--brand-500); }

.vsep { width: 1px; height: 18px; background: var(--border); }

/* ===============================================
   KPI grid — flatter
   =============================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  padding: 10px 14px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-soft);
  min-width: 0;
}
.kpi:last-child { border-right: none; }
@media (max-width: 1100px) {
  .kpi:nth-child(2n) { border-right: none; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
}
/* MG30.43bv — Catálogo sub-nav: arriba en desktop, fijo abajo en mobile (estilo iOS app) */
.cat-subnav {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px;
}
.cat-subnav-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px; background: transparent; border: 0; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-700);
  transition: all .15s; position: relative; min-width: 0;
}
.cat-subnav-btn.active { background: var(--brand-500); color: white; }
.cat-subnav-btn:not(.active):hover { background: var(--brand-50); }
.cat-subnav-icon { font-size: 16px; }
.cat-subnav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-subnav-count { font-size: 11px; opacity: .7; font-weight: 500; }
.cat-subnav-btn.active .cat-subnav-count { opacity: .9; }
.cat-subnav-badge {
  background: var(--danger); color: white; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; min-width: 16px; text-align: center;
}
.cat-subnav-btn.active .cat-subnav-badge { background: white; color: var(--brand-700); }
/* Mobile: la sub-nav del Catálogo se oculta porque el bottom-nav global se vuelve contextual */
@media (max-width: 768px) {
  .cat-subnav { display: none !important; }
}

/* MG30.43bt — KPI clickable (Home) */
.kpi-clickable { cursor: pointer; transition: background .15s; -webkit-tap-highlight-color: rgba(53,207,193,.15); }
.kpi-clickable:hover { background: var(--brand-50); }
.kpi-clickable:active { background: var(--brand-100); }
.kpi-clickable:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 6px;
  min-width: 0;
}
.kpi-top > .kpi-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.kpi-emoji { font-size: 11px; opacity: .75; }
.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.4px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-500);
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-weight: 600;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.kpi-spark {
  position: absolute;
  right: 6px;
  bottom: 4px;
  opacity: .5;
  pointer-events: none;
  max-width: 50%;
  overflow: hidden;
}
.kpi-spark svg { max-width: 100%; height: auto; }

/* ===============================================
   Charts grid
   =============================================== */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 1100px) {
  .grid-2-1, .grid-1-1 { grid-template-columns: 1fr; }
}

.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
  min-width: 0;
}
.chart-card-title-group { flex: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.chart-card-title-group > .chart-card-title { flex-shrink: 0; }
.chart-card-title-group > .chart-card-value { flex-shrink: 0; }
.chart-card-eyebrow { display: none; }
.chart-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-900);
  white-space: nowrap;
}
.chart-card-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart-card-meta {
  font-size: 11px;
  color: var(--ink-500);
  white-space: nowrap;
}
.chart-card-body { padding: 6px 8px 8px; }
.chart-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  padding: 6px 12px 0;
  overflow: hidden;
}
.legend-item { white-space: nowrap; flex-shrink: 0; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-600);
  font-weight: 500;
}
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ===============================================
   Table — tighter
   =============================================== */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table-head-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.table-head-bar .card-title { margin: 0; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.data th, table.data td {
  padding: 6px 10px;
  text-align: left;
  vertical-align: middle;
}
table.data th {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data td {
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-800);
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--ink-100); }
[data-theme="dark"] table.data tbody tr:hover td { background: var(--ink-200); }
table.data td.num, table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.store-cell { display: flex; align-items: center; gap: 8px; }
.store-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 9px;
  color: white;
  flex-shrink: 0;
}

/* Loading */
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  text-align: center;
  margin: 10px 0;
}
.loading-steps {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.loading-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-500);
}
.loading-step.done { color: var(--success); }
.loading-step.active { color: var(--ink-900); font-weight: 600; }
.loading-step-dot {
  width: 14px; height: 14px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9px;
  font-weight: 700;
  background: var(--ink-100);
  color: var(--ink-500);
}
.loading-step.done .loading-step-dot { background: var(--success); color: white; }
.loading-step.active .loading-step-dot {
  background: var(--brand-500);
  color: white;
  box-shadow: 0 0 0 3px var(--brand-100);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--brand-100); }
  50% { box-shadow: 0 0 0 6px rgba(36,150,145,.06); }
}
.progress-bar {
  height: 3px;
  background: var(--ink-100);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
  position: relative;
}
.progress-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--brand-500);
  border-radius: 2px;
  transition: width .3s ease;
}

.skel {
  background: linear-gradient(90deg, var(--ink-100) 0%, var(--ink-50) 50%, var(--ink-100) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 3px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  color: var(--ink-500);
}
.empty-state-glyph { font-size: 28px; margin-bottom: 10px; opacity: .6; }
.empty-state-title { font-size: 14px; font-weight: 700; color: var(--ink-800); margin-bottom: 4px; }
.empty-state-desc { font-size: 11.5px; max-width: 360px; line-height: 1.5; }

.segmented {
  display: inline-flex;
  padding: 1px;
  background: var(--ink-100);
  border-radius: var(--r-xs);
  gap: 1px;
}
.segmented-btn {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-600);
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all .1s;
}
.segmented-btn.active {
  background: var(--surface);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .segmented { background: var(--ink-200); }

.select-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-800);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .1s;
  white-space: nowrap;
}
.select-mini:hover { border-color: var(--ink-300); }

/* density tweak */
[data-density="compact"] .content { padding: 8px 12px 20px; }
[data-density="compact"] .card-body { padding: 8px 10px; }
[data-density="compact"] .kpi { padding: 8px 12px; }
[data-density="compact"] .kpi-value { font-size: 18px; }
[data-density="compact"] table.data th,
[data-density="compact"] table.data td { padding: 4px 8px; }

html.no-emojis .nav-icon,
html.no-emojis .report-tab-emoji,
html.no-emojis .chip-emoji,
html.no-emojis .kpi-emoji { display: none; }

[data-theme="dark"] .search-box { background: var(--ink-200); }
[data-theme="dark"] .topbar-org { background: var(--ink-200); }
[data-theme="dark"] .topbar-btn:hover { background: var(--ink-200); }
[data-theme="dark"] .btn-ghost:hover { background: var(--ink-200); }
[data-theme="dark"] .btn-secondary:hover { background: var(--ink-200); }
[data-theme="dark"] .sidebar-user:hover { background: var(--ink-200); }
[data-theme="dark"] .sidebar-collapse-btn:hover { background: var(--ink-200); }
[data-theme="dark"] .quick-range-btn:hover { background: var(--ink-200); }

/* ============================================
   Tareas — new card design
   ============================================ */

.tareas-page { display: flex; flex-direction: column; }

/* Status pills row */
.t-status-row {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}
.t-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s, color .1s;
}
.t-status-pill:hover { background: var(--ink-100); }
.t-status-pill.active { background: var(--ink-900); color: #fff; }
[data-theme="dark"] .t-status-pill.active { background: var(--brand-500); color: #0a1314; }
.t-status-pill-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--ink-200);
  color: var(--ink-700);
  line-height: 1.4;
}
.t-status-pill.active .t-status-pill-count {
  background: rgba(255,255,255,.18);
  color: #fff;
}
[data-theme="dark"] .t-status-pill.active .t-status-pill-count {
  background: rgba(10,19,20,.25);
  color: #0a1314;
}

/* Tipo category cards — big visual row */
.tipo-cat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 1100px) {
  .tipo-cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .tipo-cat-grid { grid-template-columns: repeat(2, 1fr); }
}
.tipo-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 0;
}
.tipo-cat:hover { border-color: var(--ink-400); }
.tipo-cat.active { border-width: 1.5px; }
.tipo-cat-emoji {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.tipo-cat-body { min-width: 0; flex: 1; }
.tipo-cat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.005em;
}
.tipo-cat-count {
  font-size: 10.5px;
  color: var(--ink-500);
  margin-top: 1px;
  line-height: 1.3;
}
.tipo-cat-urg strong { color: #d64545; font-weight: 700; }

/* Toolbar (search + prio filter) */
.t-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.t-toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; flex-wrap: wrap; }
.t-toolbar-right { flex-shrink: 0; }
.t-count-label {
  font-size: 11px;
  color: var(--ink-500);
  font-family: var(--font-mono);
}
.t-prio-filter { display: flex; align-items: center; gap: 6px; }
.t-prio-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-500);
  margin-right: 2px;
}
.t-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: inherit;
  font-size: 11px;
  color: var(--ink-700);
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s, border-color .1s;
}
.t-chip:hover { border-color: var(--ink-400); background: var(--surface-alt); }
.t-chip.active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
[data-theme="dark"] .t-chip.active { background: var(--ink-50); color: var(--bg); border-color: var(--ink-50); }
.t-chip-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Group headers for grouped card lists */
.tc-list { display: flex; flex-direction: column; gap: 20px; }
.tc-group { display: flex; flex-direction: column; gap: 10px; }
.tc-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.tc-group-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-800);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.tc-group-dot { width: 7px; height: 7px; border-radius: 2px; }
.tc-group-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--ink-100);
  color: var(--ink-700);
}
.tc-group-line {
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
.tc-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 8px;
}

/* Task card */
.tc {
  position: relative;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.tc:hover {
  border-color: var(--ink-400);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.tc-urgent { border-color: rgba(214,69,69,.35); }
.tc-urgent:hover { border-color: #d64545; }

.tc-stripe {
  width: 3px;
  flex-shrink: 0;
  align-self: stretch;
}

.tc-main {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tc-tipo { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tc-tipo-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tc-tipo-emoji { font-size: 12px; line-height: 1; }
.tc-urgent-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: rgba(214,69,69,.1);
  color: #d64545;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tc-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--ink-500);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.tc-time-sep { color: var(--ink-300); }
.tc-time-rel { color: var(--ink-600); }

.tc-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.tc-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background .1s, border-color .1s, color .1s;
  padding: 0;
}
.tc-check:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
}
.tc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
  flex: 1;
  word-break: break-word;
}
.tc-qty {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-600);
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: var(--ink-100);
  border-radius: var(--r-xs);
  flex-shrink: 0;
  margin-top: 2px;
}
.tc-detalle {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-left: 30px;
}

.tc-notas {
  display: flex;
  gap: 7px;
  padding: 7px 10px;
  background: var(--ink-50);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--ink-700);
  line-height: 1.45;
  margin-left: 30px;
}
[data-theme="dark"] .tc-notas { background: var(--ink-200); }
.tc-notas-icon { flex-shrink: 0; font-size: 11px; opacity: .6; }

.tc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
  border-top: 1px solid var(--border-soft);
  margin-top: 2px;
  padding-top: 8px;
}
.tc-foot-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-600);
  min-width: 0;
  flex-wrap: wrap;
}
.tc-foot-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tc-foot-sep { color: var(--ink-300); }
.tc-tienda {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-800);
  white-space: nowrap;
}
.tc-tienda-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tc-by {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-600);
}
.tc-avatar {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink-200);
  color: var(--ink-700);
  font-size: 8.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .02em;
}
.tc-btn-ghost {
  width: 24px; height: 24px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  color: var(--ink-500);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tc-btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }

.t-empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--ink-500);
}
.t-empty-title { font-size: 14px; font-weight: 600; color: var(--ink-800); margin-top: 8px; }
.t-empty-sub { font-size: 12px; margin-top: 3px; }



/* Control de Tiendas */
.control-tipos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.control-tipo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
}
.control-tipo:hover { border-color: var(--ink-400); }
.control-tipo.active { box-shadow: 0 0 0 1px currentColor inset; }
.control-tipo-emoji {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.control-tipo-body { min-width: 0; flex: 1; }
.control-tipo-label { font-size: 12.5px; font-weight: 600; color: var(--ink-900); }
.control-tipo-desc { font-size: 10.5px; color: var(--ink-500); margin-top: 1px; line-height: 1.3; }
.control-tipo-ind {
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
}

.control-split {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .control-split { grid-template-columns: 1fr; }
}

.control-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.control-pane-title { font-size: 12.5px; font-weight: 600; color: var(--ink-900); }
.control-pane-sort { display: flex; gap: 3px; }
.sort-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: 10.5px;
  color: var(--ink-600);
  cursor: pointer;
}
.sort-btn.active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
[data-theme="dark"] .sort-btn.active { background: var(--ink-50); color: var(--bg); border-color: var(--ink-50); }

.control-stores {
  background: transparent;
}
.store-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  max-height: 640px;
  overflow-y: auto;
}

.store-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .1s, box-shadow .1s;
  width: 100%;
}
.store-card:hover { border-color: var(--ink-400); }
.store-card.selected {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px rgba(36,150,145,.15);
}
.store-card-head { display: flex; align-items: center; gap: 10px; }
.store-chip {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.store-card-info { flex: 1; min-width: 0; }
.store-name { font-size: 12px; font-weight: 600; color: var(--ink-900); }
.store-meta { margin-top: 2px; }
.store-estado {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pring { color: var(--ink-700); flex-shrink: 0; }
.store-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-500);
  padding-top: 6px;
  border-top: 1px dashed var(--border-soft);
}
.store-ultima { font-family: var(--font-mono); }
.store-incid { color: #c68a2e; font-weight: 600; }

.control-checklist {
  background: transparent;
}
.control-pane-actions { display: flex; gap: 5px; }

.control-progress-hero {
  padding: 16px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.control-hero-num {
  font-size: 40px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
}
.control-hero-num span {
  font-size: 18px;
  color: var(--ink-500);
  font-weight: 500;
  margin-left: 3px;
}
.control-hero-bar {
  height: 6px;
  background: var(--ink-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.control-hero-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
  border-radius: inherit;
  transition: width .3s;
}
.control-hero-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--ink-500);
}

.checklist-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.checklist-section {
  border-bottom: 1px solid var(--border-soft);
}
.checklist-section:last-child { border-bottom: none; }
.checklist-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-soft);
}
.checklist-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 160px;
}
.checklist-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-700);
}
.checklist-progress-text {
  font-size: 10.5px;
  color: var(--ink-500);
  font-family: var(--font-mono);
}
.checklist-bar {
  flex: 1;
  height: 3px;
  background: var(--ink-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.checklist-bar-fill {
  height: 100%;
  background: var(--brand-500);
  border-radius: inherit;
  transition: width .3s;
}
.checklist-items { display: flex; flex-direction: column; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: var(--ink-50); }
[data-theme="dark"] .check-item:hover { background: var(--ink-200); }
.check-item.done .check-txt {
  color: var(--ink-500);
  text-decoration: line-through;
  text-decoration-color: var(--ink-300);
}
.check-item.warn { background: rgba(198,138,46,.06); }
[data-theme="dark"] .check-item.warn { background: rgba(198,138,46,.1); }

.check-box {
  width: 16px; height: 16px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  margin-top: 1px;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.check-box:hover { border-color: var(--ink-500); }
.check-box.checked {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}
.check-body { flex: 1; min-width: 0; }
.check-txt { font-size: 12.5px; color: var(--ink-900); line-height: 1.35; }
.check-done-by {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-500);
  font-family: var(--font-mono);
}
.check-done-avatar {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-200);
  color: var(--ink-700);
  font-size: 8px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
  font-family: var(--font-body);
}
.check-warn {
  margin-top: 3px;
  font-size: 10.5px;
  color: #c68a2e;
  font-weight: 600;
}
.check-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .1s; }
.check-item:hover .check-actions { opacity: 1; }
.check-mini-btn {
  width: 22px; height: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  color: var(--ink-600);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.check-mini-btn:hover { background: var(--ink-100); color: var(--ink-900); }


.tab-count {
  font-size: 10px;
  font-weight: 700;
  background: var(--ink-200);
  color: var(--ink-700);
  padding: 0 5px;
  border-radius: var(--r-full);
  line-height: 1.5;
  margin-left: 2px;
}
.report-tab.active .tab-count { background: var(--brand-100); color: var(--brand-700); }
[data-theme="dark"] .report-tab.active .tab-count { background: rgba(36,150,145,.25); color: var(--brand-300); }

.search-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  width: 160px;
  color: var(--ink-500);
  flex-shrink: 1;
  min-width: 100px;
}
.search-inline:focus-within { border-color: var(--brand-400); }
.search-inline input {
  border: none; background: transparent; outline: none; flex: 1;
  font-size: 11.5px; font-family: inherit; color: var(--ink-800);
}

/* ===============================================
   BOTTOM NAV — móvil (MG30.43)
   =============================================== */
.bottom-nav {
  display: none;
  position: fixed !important;
  bottom: 0 !important; left: 0 !important; right: 0 !important;
  top: auto !important;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  min-height: calc(64px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 5000;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)) 4px;
  box-shadow: 0 -1px 4px rgba(15,20,27,.04);
  /* MG30.43bt — iOS Safari: forzar containing block via translateZ + isolation */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  isolation: isolate;
  will-change: transform;
}
.bottom-nav-item {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-rows: 24px 14px;
  align-content: center;
  justify-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: var(--r-md);
  position: relative;
  color: var(--ink-500);
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active {
  color: var(--brand-600);
  background: var(--brand-50);
}
.bottom-nav-item:active { transform: scale(0.96); }
.bottom-nav-icon {
  width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  text-align: center;
}
.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: -0.01em;
  display: block;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottom-nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--r-full);
  min-width: 16px;
  height: 14px;
  text-align: center;
  line-height: 1.4;
}

/* Drawer "Más" — móvil */
.bottom-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,20,27,.45);
  z-index: 60;
  animation: fadeIn .15s ease;
}
.bottom-nav-drawer {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 75vh;
  background: var(--surface);
  border-top-left-radius: var(--r-xl);
  border-top-right-radius: var(--r-xl);
  z-index: 70;
  overflow: hidden;
  flex-direction: column;
  animation: slideUp .2s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.bottom-nav-drawer-close {
  background: var(--ink-100);
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-700);
}
.bottom-nav-drawer-body {
  overflow-y: auto;
  padding: 12px 14px 24px;
  flex: 1;
}
.bottom-nav-drawer-group { margin-bottom: 14px; }
.bottom-nav-drawer-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  margin-bottom: 6px;
  padding: 0 8px;
}
.bottom-nav-drawer-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--ink-800);
  text-align: left;
}
.bottom-nav-drawer-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.bottom-nav-drawer-item:active { background: var(--ink-100); }
.bottom-nav-drawer-icon { font-size: 18px; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

/* ===============================================
   RESPONSIVE — móvil (≤768px) — MG30.43
   =============================================== */
@media (max-width: 768px) {
  html, body, #root {
    height: 100%;
    overflow: hidden;
  }
  .sidebar { display: none; }
  .app {
    grid-template-columns: 1fr;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }
  @supports not (height: 100dvh) {
    .app { height: 100vh; min-height: 100vh; }
  }
  .main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  /* MG30.43bt — el padding-bottom va en content-inner para que el área scrolleable
     deje espacio bajo el bottom-nav fixed (antes en .main no funcionaba en iOS) */
  .content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .content-inner { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }

  .topbar { padding: 8px 12px; min-height: 48px; }
  .topbar-breadcrumb { font-size: 12px; }
  .topbar-breadcrumb span:not(.current) { display: none; }
  .topbar-breadcrumb .sep { display: none; }
  .search-box { display: none !important; }
  .topbar-actions kbd { display: none; }
  .topbar-org { display: none; }
  .topbar-actions > div[style*="height: 24px"] { display: none; }
  .topbar-btn.icon { padding: 6px; }

  .content-inner { padding: 12px; }
  .tweaks-panel { width: calc(100% - 24px) !important; max-width: 360px; }

  .bottom-nav { display: flex; }
  .bottom-nav-overlay { display: block; }
  .bottom-nav-drawer { display: flex; }
}

/* ===============================================
   PEDIDOS / GESTION TABLE — MG30.43
   =============================================== */
.table-wrap { overflow-x: auto; }
.ped-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.ped-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  color: var(--ink-600);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.ped-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.ped-row:hover { background: var(--ink-50); }
.ped-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-600);
  white-space: nowrap;
}
.ped-prov { font-weight: 600; color: var(--ink-900); }
.ped-tienda {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.ped-tienda-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ped-fecha {
  color: var(--ink-600);
  white-space: nowrap;
  font-size: 12px;
}
.ped-importe {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ped-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ped-month-card {
  padding: 14px;
}
.ped-month-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ped-month-toolbar label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ped-month-total {
  margin-left: auto;
  color: var(--ink-600);
  font-size: 12px;
}
.ped-month-list {
  display: grid;
  gap: 8px;
}
.ped-month-row {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.ped-month-row:hover { background: var(--ink-50); }
.ped-month-store {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ped-month-count,
.ped-month-meta,
.ped-month-providers {
  color: var(--ink-500);
  font-size: 11px;
}
.ped-month-money {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--brand-700);
  white-space: nowrap;
}
.ped-month-providers {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ped-month-empty {
  color: var(--ink-500);
  padding: 22px;
  text-align: center;
}

.pedidos-actions-row,
.upos-toolbar-controls,
.upos-mobile-actions {
  min-width: 0;
}
.pedidos-actions-row .btn,
.upos-toolbar-controls .btn,
.upos-mobile-actions .btn {
  white-space: nowrap;
}

/* Select dropdown — toolbar */
.t-select {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-800);
  font-family: inherit;
  cursor: pointer;
  max-width: 220px;
}
.t-select:focus { outline: none; border-color: var(--brand-400); }

@media (max-width: 768px) {
  .ped-table { font-size: 11.5px; }
  .ped-table thead th, .ped-table tbody td { padding: 8px 8px; }
  .ped-prov { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-select { max-width: 100%; flex: 1; }
}

/* ===============================================
   RESPONSIVE TABLE — móvil (MG30.43c)
   Stacking: cada <tr> se convierte en card vertical
   =============================================== */
@media (max-width: 768px) {
  /* MG30.43bi FIX: solo .ped-table (que tiene stacking) necesita visible.
     Las tablas .data (Informes) deben mantener overflow-x: auto para scroll horizontal */
  .table-wrap:has(.ped-table) { overflow-x: visible !important; }
  .ped-table { font-size: 12px; }
  .ped-table, .ped-table tbody, .ped-table tr, .ped-table td {
    display: block;
    width: 100%;
  }
  .ped-table thead { display: none; }
  .ped-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    margin: 0 0 8px 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    align-items: center;
  }
  .ped-table tbody td {
    border: 0 !important;
    padding: 0 !important;
    line-height: 1.4;
    white-space: normal;
  }
  /* Primera columna: título de la card (full width) */
  .ped-table tbody tr td:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
    color: var(--ink-900);
    font-size: 13.5px;
    margin-bottom: 2px;
  }
  /* La columna .ped-prov también full width si es la 2ª y muy larga */
  .ped-table .ped-prov {
    grid-column: 1 / -1;
    font-size: 13.5px;
  }
  .ped-table .ped-ref {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--brand-600);
  }
  /* Importe: a la derecha, destacado */
  .ped-table .ped-importe {
    text-align: right !important;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-700);
    grid-column: 2;
    justify-self: end;
  }
  /* Tienda chip */
  .ped-table .ped-tienda {
    grid-column: 1 / -1;
    font-size: 11.5px;
    color: var(--ink-600);
  }
  /* Fecha discreta */
  .ped-table .ped-fecha {
    font-size: 11px;
    color: var(--ink-500);
  }
  /* Badges siempre alineados derecha en su celda */
  .ped-table .ped-badge {
    font-size: 10.5px;
    padding: 2px 7px;
    justify-self: end;
  }
  /* Avatar inline más pequeño */
  .ped-table .tc-avatar {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  /* Tablas hover sin efecto en móvil (touch) */
  .ped-row:hover { background: transparent; }
}

/* ===============================================
   PEDIDOS — lista principal compacta móvil + mes por tienda
   =============================================== */
@media (max-width: 768px) {
  .pedidos-list-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  /* MG20260530 — Mike: lista principal de pedidos en móvil en UNA línea estilo
     hoja Excel -> Proveedor · fecha · tienda · importe. SOLO .pedidos-main-table
     (no afecta a .upos-mobile-table ni a la tabla del selector). El tap abre el
     detalle (ref, estado, UPOS/Odoo, acciones siguen disponibles ahí). */
  .pedidos-main-table tbody tr {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
  }
  /* CLAVE: anular el width:100% que .ped-table td impone. Sin esto, los flex
     items con basis auto toman 100% y la fecha empuja al resto fuera de vista. */
  .pedidos-main-table tbody td { width: auto; min-width: 0; }
  /* Ocultar todo lo que no son las 4 columnas pedidas */
  .pedidos-main-table .ped-ref,
  .pedidos-main-table .ped-fecha-llegada,
  .pedidos-main-table .ped-links-cell,
  .pedidos-main-table .ped-estado-cell,
  .pedidos-main-table .ped-select-cell,
  .pedidos-main-table .ped-actions-cell {
    display: none !important;
  }
  /* 1 · Proveedor — ocupa el hueco, trunca con … */
  .pedidos-main-table .ped-prov {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pedidos-main-table .ped-prov .btn { display: none; }
  /* 2 · Fecha de pedido */
  .pedidos-main-table .ped-fecha-pedido {
    order: 2;
    flex: 0 0 auto;
    font-size: 11px;
    line-height: 1.2;
    color: var(--ink-500);
    white-space: nowrap;
  }
  /* 3 · Tienda — el <td> sin clase que envuelve a .ped-tienda */
  .pedidos-main-table tbody td:has(> .ped-tienda) {
    order: 3;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 36%;
    overflow: hidden;
  }
  .pedidos-main-table .ped-tienda {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.2;
  }
  /* 4 · Importe (€) — a la derecha, destacado */
  .pedidos-main-table .ped-importe {
    order: 4;
    flex: 0 0 auto;
    text-align: right;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--brand-700);
  }

  .pedidos-vista-row {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .pedidos-vista-row .t-status-pill {
    flex: 0 0 auto;
  }
  .ped-month-card {
    padding: 10px;
  }
  .ped-month-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 6px;
  }
  .ped-month-toolbar label {
    flex: 0 0 100%;
  }
  .ped-month-toolbar .t-select {
    flex: 1 1 150px;
  }
  .ped-month-total {
    flex: 1 1 100%;
    margin-left: 0;
    font-size: 12px;
  }
  .ped-month-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
    padding: 8px 10px;
  }
  .ped-month-store {
    grid-column: 1;
    font-size: 13px;
  }
  .ped-month-money {
    grid-column: 2;
    grid-row: 1;
    font-size: 12.5px;
  }
  .ped-month-count,
  .ped-month-meta {
    font-size: 10.5px;
    line-height: 1.15;
  }
  .ped-month-providers {
    font-size: 10.5px;
    line-height: 1.15;
  }
}

/* ===============================================
   PEDIDOS / UPOS SIN RECIBIR — móvil
   Evita que la vista Uber/UPOS ensanche la página.
   =============================================== */
@media (max-width: 768px) {
  .section-head > div.pedidos-actions-row {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    padding: 0 0 4px 0;
    -webkit-overflow-scrolling: touch;
  }
  .section-head > div.pedidos-actions-row .btn,
  .section-head > div.pedidos-actions-row > span {
    flex: 0 0 auto !important;
    width: auto !important;
  }
  .section-head > div.pedidos-actions-row .btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .upos-sin-recibir-card {
    padding: 12px !important;
    overflow: hidden;
  }
  .upos-toolbar {
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .upos-toolbar h3 {
    flex: 0 0 100%;
    min-width: 0;
  }
  .upos-toolbar-controls {
    width: 100%;
    margin-left: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .upos-toolbar-controls > * {
    flex: 0 0 auto;
  }

  .upos-mobile-list.table-wrap {
    overflow-x: visible !important;
  }
  .upos-mobile-table,
  .upos-mobile-table tbody,
  .upos-mobile-table tr,
  .upos-mobile-table td {
    display: block;
    width: 100%;
  }
  .upos-mobile-table thead {
    display: none;
  }
  .upos-mobile-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    max-width: 100%;
    overflow: hidden;
  }
  .upos-mobile-table tbody tr td:first-child,
  .upos-mobile-table .upos-td-main {
    grid-column: 1 / -1;
    min-width: 0;
    margin-bottom: 0;
    font-size: 13px;
    word-break: break-word;
  }
  .upos-mobile-table .upos-td-code,
  .upos-mobile-table .upos-td-provider,
  .upos-mobile-table .upos-td-meta {
    min-width: 0;
    font-size: 11px;
    color: var(--ink-500);
  }
  .upos-mobile-table .upos-td-provider {
    grid-column: 1 / -1;
    max-width: 100% !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    font-size: 12px;
    color: var(--ink-800);
    font-weight: 600;
  }
  .upos-mobile-table .upos-td-amount {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: start;
    white-space: nowrap;
    color: var(--brand-700);
    font-size: 13px;
  }
  .upos-mobile-table .upos-td-status {
    justify-self: start;
  }
  .upos-mobile-table .upos-td-linked {
    justify-self: end;
    max-width: 100%;
  }
  .upos-mobile-table .upos-td-actions {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .upos-mobile-actions {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap !important;
    max-width: 100%;
    padding-top: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .upos-mobile-actions > * {
    flex: 0 0 auto;
    padding: 6px 9px !important;
    font-size: 11px !important;
  }
}

/* ===============================================
   SECTION HEAD — móvil (MG30.43d)
   Header full-width: título y subtítulo en 1 hilera, botones debajo
   =============================================== */
@media (max-width: 768px) {
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }
  .section-head-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
  }
  .section-title {
    font-size: 22px;
    line-height: 1.15;
    width: 100%;
  }
  .section-subtitle {
    font-size: 13px;
    line-height: 1.4;
    width: 100%;
  }
  /* Botones header: ocupan ancho completo, repartidos en fila */
  .section-head > div:last-child:not(.pedidos-actions-row) {
    display: flex;
    width: 100%;
    gap: 6px;
  }
  .section-head > div:last-child:not(.pedidos-actions-row) .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 9px 10px;
    white-space: nowrap;
  }
}

/* ===============================================
   MÓVIL OVERFLOW GUARDS (MG30.43e)
   Evita scroll horizontal por elementos que desbordan
   =============================================== */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  .app { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .main { width: 100%; max-width: 100vw; min-width: 0; overflow-x: hidden; }
  .content { width: 100%; max-width: 100vw; min-width: 0; }
  .content-inner {
    padding: 12px !important;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .card { max-width: 100%; box-sizing: border-box; overflow: hidden; }

  /* SVGs (gráficas, sparklines) que se ajusten */
  svg { max-width: 100% !important; height: auto; }
  .chart-card-body { overflow: hidden; padding: 6px 8px 8px; }

  /* Flex children que en móvil necesitan poder colapsarse */
  .card > div > div[style*="flex: 1"],
  .card > div[style*="display: flex"] > div[style*="flex: 1"] {
    min-width: 0 !important;
    word-break: break-word;
  }

  /* KPI values que puedan ser largos (€68.200, etc.) */
  .kpi-value { word-break: break-word; font-size: 17px; }
  .kpi-label { font-size: 10px; }
  .kpi { padding: 10px 12px; }

  /* Padding lateral de listas inline en dashboard */
  .card > div[style*="padding: 10px 20px"],
  .card > div[style*="padding: 12px 20px"] {
    padding: 10px 14px !important;
  }

  /* Topbar título no debe forzar scroll */
  .topbar-title { min-width: 0; flex: 1; }
  .topbar { max-width: 100vw; overflow: hidden; }
}

/* ===============================================
   DASHBOARD GRID + GRÁFICA + TIENDAS — móvil (MG30.43f)
   =============================================== */
@media (max-width: 768px) {
  /* Forzar grids del dashboard a 1 columna */
  .grid-2-1, .grid-1-1, .grid-2-1 > .card, .grid-1-1 > .card {
    grid-template-columns: 1fr !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Gráfica AreaChart — contenedor responsive */
  .chart-card-body {
    padding: 4px 6px 8px !important;
    overflow-x: hidden;
  }
  .chart-card-body > div { width: 100% !important; max-width: 100% !important; }
  .chart-card-body svg {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    overflow: hidden !important;
  }
  .chart-card-head {
    padding: 12px 14px 6px !important;
    flex-wrap: wrap;
  }

  /* Lista de tiendas en dashboard — cada fila full width, valor alineado derecha */
  .grid-2-1 > .card > div[style*="padding"][style*="0 0 10px"],
  .grid-2-1 > .card > div[style*="padding: 6px 0 10px"] {
    padding: 6px 0 12px !important;
  }
  .grid-2-1 > .card > div > div[style*="display: flex"] {
    padding: 10px 14px !important;
    gap: 10px !important;
    min-width: 0;
  }
  .grid-2-1 > .card > div > div[style*="display: flex"] > div[style*="flex: 1"] {
    min-width: 0 !important;
    overflow: hidden;
  }
  .grid-2-1 > .card > div > div[style*="display: flex"] > div[style*="flex: 1"] > div:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .store-icon {
    flex-shrink: 0;
  }

  /* KPI grid: 2 columnas en móvil (no 4) */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Card header padding compacto */
  .card-header {
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ===============================================
   ANTI-OVERFLOW MUSCLE — móvil (MG30.43g)
   =============================================== */
@media (max-width: 768px) {
  /* Cualquier card que aloje SVG: contener overflow */
  .card { overflow: hidden !important; }
  .chart-card-body { overflow: hidden !important; padding: 6px 8px 8px !important; }
  .chart-card-body > div { width: 100% !important; max-width: 100% !important; overflow: hidden !important; }
  .chart-card-body svg { width: 100% !important; max-width: 100% !important; display: block; }

  /* Lista tiendas dashboard: prevenir overflow del valor monetario */
  .grid-2-1 > .card > div > div[style*="display: flex"][style*="padding"] {
    padding: 8px 12px !important;
    gap: 10px !important;
    overflow: hidden;
    min-width: 0;
  }
  .grid-2-1 > .card > div > div > div[style*="flex: 1"] {
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .grid-2-1 > .card > div > div > div[style*="flex: 1"] > div {
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  /* Valor monetario derecha: tamaño fijo razonable */
  .grid-2-1 > .card > div > div > div[style*="font-family"][style*="mono"] {
    flex-shrink: 0;
    font-size: 12px !important;
  }
  /* store-icon: no shrink */
  .store-icon { flex-shrink: 0 !important; }
}

/* Skeleton animation (MG30.43h) */
@keyframes skeleton {
  0% { opacity: 0.5; }
  50% { opacity: 0.9; }
  100% { opacity: 0.5; }
}

/* ===============================================
   DETAIL DRAWER — modal lateral desktop / bottom sheet móvil (MG30.43i)
   =============================================== */
.detail-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,20,27,.45);
  z-index: 80;
  animation: fadeIn .15s ease;
  touch-action: none;
  overscroll-behavior: contain;
}
.detail-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 90;
  display: flex;
  flex-direction: column;
  animation: slideInRight .2s ease;
  box-shadow: var(--shadow-lg);
}
.detail-drawer.detail-drawer-wide {
  width: 620px;
  max-width: 92vw;
}
.detail-drawer.detail-drawer-xlarge {
  width: 1000px;
  max-width: 96vw;
}
.detail-row-full {
  padding: 6px 18px;
  width: 100%;
  box-sizing: border-box;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.detail-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  gap: 10px;
}
.detail-drawer-close {
  background: var(--ink-100);
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-700);
  flex-shrink: 0;
}
.detail-drawer-close:hover { background: var(--ink-200); }
.detail-drawer-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 18px 24px;
  flex: 1;
}
.detail-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.detail-row:last-child { border-bottom: 0; }
.detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  margin-bottom: 4px;
  font-weight: 600;
}
.detail-value {
  font-size: 13px;
  color: var(--ink-900);
  word-break: break-word;
}

@media (max-width: 768px) {
  .detail-drawer {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: 80vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-left: 0;
    border-top: 1px solid var(--border);
    animation: slideUp .2s ease;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  /* MG30.43bd FIX — drawer-wide tenía especificidad mayor y desbordaba en móvil */
  .detail-drawer.detail-drawer-wide {
    width: 100%;
    max-width: 100vw;
  }
  /* MG20260530 — la .bottom-nav (fixed bottom:0, z-index 5000, 64px) flota POR
     ENCIMA del drawer (z-index 90) y tapaba los botones Cancelar/Guardar al
     fondo del body scrollable. Reservar su altura para poder llegar a ellos. */
  .detail-drawer-body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 16px);
  }
}

/* Filas tabla cliqueables */
.ped-row.clickable { cursor: pointer; }
.ped-row.clickable:hover { background: var(--brand-50); }

/* ===============================================
   SEARCHABLE SELECT — autocomplete (MG30.43j)
   =============================================== */
.searchable-select { position: relative; }
.searchable-select-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink-800);
  width: 100%;
  text-align: left;
  min-height: 32px;
}
.searchable-select-trigger:hover { border-color: var(--brand-400); }
.searchable-select-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
.searchable-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-clear {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink-100);
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  color: var(--ink-700);
  flex-shrink: 0;
}
.searchable-select-clear:hover { background: var(--ink-200); }
.searchable-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.searchable-select-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-500);
}
.searchable-select-search input {
  border: 0;
  background: transparent;
  outline: 0;
  flex: 1;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink-900);
}
.searchable-select-count {
  font-size: 10px;
  background: var(--ink-100);
  color: var(--ink-700);
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-weight: 600;
}
.searchable-select-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px;
}
.searchable-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-800);
}
.searchable-select-option:hover { background: var(--ink-100); }
.searchable-select-option.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.searchable-select-option-label {
  font-size: 12.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-option-sub {
  font-size: 10.5px;
  color: var(--ink-500);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-empty {
  padding: 16px;
  text-align: center;
  color: var(--ink-500);
  font-size: 11.5px;
}

/* ===============================================
   FORM ROW v2 — drawer forms (MG30.43k)
   =============================================== */
.form-row-v2 { margin-bottom: 14px; }
.form-row-v2 label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-row-v2 input[type="text"],
.form-row-v2 input[type="number"],
.form-row-v2 input[type="date"],
.form-row-v2 input[type="email"],
.form-row-v2 select,
.form-row-v2 textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--surface);
  box-sizing: border-box;
}
.form-row-v2 input:focus,
.form-row-v2 select:focus,
.form-row-v2 textarea:focus { outline: none; border-color: var(--brand-400); }
.form-row-v2 textarea { resize: vertical; min-height: 70px; }
.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row-2col > div { margin-bottom: 0; }
.form-row-3col {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}
.form-row-3col > div { margin-bottom: 0; }
@media (max-width: 480px) {
  .form-row-2col { grid-template-columns: 1fr; }
  .form-row-3col { grid-template-columns: 1fr; }
}

/* ===============================================
   COMMENT BOX v2 (MG30.43l)
   =============================================== */
.comment-box-v2 {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.comment-box-list {
  margin-bottom: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.comment-item-v2 {
  background: var(--ink-50);
  border-radius: var(--r-md);
  padding: 8px 10px;
  margin-bottom: 6px;
}
.comment-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.comment-item-user {
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-800);
}
.comment-item-date {
  font-size: 10px;
  color: var(--ink-500);
}
.comment-item-text {
  font-size: 12px;
  color: var(--ink-800);
  line-height: 1.4;
  word-break: break-word;
}
.comment-box-input {
  display: flex;
  gap: 6px;
}
.comment-box-input input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.comment-box-input input:focus { border-color: var(--brand-400); }

/* ===============================================
   STORE-ICON helper (mock-pages depends on it)
   =============================================== */
.store-icon {
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: white;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}

/* ===============================================
   CARRITO + TOAST (MG30.43p)
   =============================================== */
.cart-store-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cart-store-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-700);
  flex-shrink: 0;
}
.toast-v2 {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  max-width: calc(100vw - 24px);
}
.toast-v2.ok { background: var(--success); color: white; }
.toast-v2.warn { background: var(--warning); color: white; }
.toast-v2.err { background: var(--danger); color: white; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 768px) {
  .toast-v2 { top: 64px; font-size: 12px; padding: 8px 14px; }
}

/* ===============================================
   FILA SELECCIONADA EN LISTA COMPRA (MG30.43q)
   =============================================== */
.ped-row.selected {
  background: var(--brand-50) !important;
}
@media (max-width: 768px) {
  .ped-row.selected { border-color: var(--brand-400); }
}

/* MG30.43z — Section subtitle compacto en móvil */
@media (max-width: 768px) {
  .section-subtitle {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .section-title {
    font-size: 20px;
  }
  .section-head {
    margin-bottom: 10px;
  }
}

/* MG30.43aa — Catalog source buttons */
.catalog-source-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-800);
  transition: all .15s;
}
.catalog-source-btn:hover { border-color: var(--brand-400); }
.catalog-source-btn.active {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.catalog-source-btn.disabled {
  opacity: 0.65;
}

/* ===============================================
   MODAL V2 — centrado, compacto (MG30.43af)
   =============================================== */
.modal-v2-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,20,27,.5);
  z-index: 100;
  animation: fadeIn .15s ease;
}
.modal-v2 {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  max-width: 380px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  z-index: 110;
  padding: 26px 22px 20px;
  text-align: center;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -45%) scale(.95); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-v2-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink-100);
  border: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-700);
}
.modal-v2-close:hover { background: var(--ink-200); }
.modal-v2-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 4px auto 14px;
}
.modal-v2-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -1px;
}
.modal-v2-photo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand-400);
}
.modal-v2-photo-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-500);
  color: white;
  border: 3px solid var(--surface);
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.modal-v2-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--ink-900);
  letter-spacing: -.3px;
}
.modal-v2-sub {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-bottom: 14px;
}
.modal-v2-qr-box {
  padding: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: inline-block;
  margin: 4px 0 14px;
}
.modal-v2-qr-box img { display: block; }
.modal-v2-fields {
  text-align: left;
  border-top: 1px solid var(--border-soft);
  padding: 12px 0 6px;
  margin: 8px 0;
}
.modal-v2-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--ink-800);
}
.modal-v2-label { font-size: 16px; flex-shrink: 0; }
.modal-v2-row a { color: var(--brand-700); text-decoration: none; }
.modal-v2-row a:hover { text-decoration: underline; }
.modal-v2-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* MG30.43bs — Calendario fichajes responsive móvil */
.cal-fichajes-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-fichajes-cell {
  background: white;
  border: 2px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px;
  min-height: 80px;
  font-size: 11px;
  cursor: pointer;
}
@media (max-width: 768px) {
  .cal-fichajes-grid { gap: 2px; }
  .cal-fichajes-cell { min-height: 56px; padding: 4px; font-size: 9px; border-width: 1px; border-radius: 5px; }
  .cal-fichajes-cell .cf-day { font-size: 11px !important; }
  .cal-fichajes-cell .cf-horas { font-size: 9px !important; }
  .cal-fichajes-cell .cf-time { display: none; }
}

/* MG30.43bs — Planificador turnos: matriz scrollable horizontal */
.turnos-matrix {
  display: grid;
  gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 11px;
}
.turnos-matrix-cell {
  background: white;
  padding: 6px 4px;
  text-align: center;
  min-height: 40px;
}
.turnos-matrix-cell.head {
  background: var(--ink-50);
  font-weight: 700;
  color: var(--ink-600);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.turnos-matrix-cell.has-people {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700;
}
.turnos-matrix-cell.crowded {
  background: var(--success);
  color: white;
}
.turnos-matrix-cell.empty {
  color: var(--ink-300);
}

/* MG30.43bt — Planificador semanal stack (mobile-first cards por día) */
.turnos-week-stack { display: flex; flex-direction: column; gap: 10px; }
.turnos-day-card {
  background: white; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; transition: background .15s, border .15s;
}
.turnos-day-card.today { border-color: var(--brand-500); background: var(--brand-50); }
.turnos-day-card.weekend { background: var(--ink-50); }
.turnos-day-card.drag-over { background: var(--brand-100); border-color: var(--brand-500); border-style: dashed; }
.turnos-day-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.turnos-franjas { display: flex; flex-direction: column; gap: 6px; }
.turnos-franja-row {
  display: flex; gap: 8px; align-items: stretch;
  border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; min-height: 48px;
}
.turnos-franja-tag {
  color: white; padding: 8px 10px; text-align: left; min-width: 80px;
  display: flex; flex-direction: column; justify-content: center;
}
.turnos-franja-content {
  flex: 1; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: white;
}
.turnos-tile {
  display: inline-flex; flex-direction: column; padding: 6px 10px;
  background: var(--brand-50); border: 1px solid var(--brand-200); border-radius: 6px;
  cursor: grab; font-size: 12px; transition: background .15s; min-width: 0;
}
.turnos-tile:hover { background: var(--brand-100); }
.turnos-tile:active { cursor: grabbing; }
.turnos-tile-name { font-weight: 700; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.turnos-tile-hours { font-size: 10px; color: var(--ink-600); }
.turnos-empty-slot {
  flex: 1; padding: 8px; background: transparent; border: 1px dashed var(--border);
  border-radius: 6px; cursor: pointer; color: var(--ink-500); font-size: 12px;
  transition: background .15s;
}
.turnos-empty-slot:hover { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }
.turnos-add-more {
  padding: 4px 10px; background: white; border: 1px dashed var(--brand-300);
  border-radius: 6px; cursor: pointer; color: var(--brand-700); font-size: 14px; font-weight: 700;
}
.turnos-add-more:hover { background: var(--brand-50); }
@media (max-width: 768px) {
  .turnos-franja-row { flex-direction: column; }
  .turnos-franja-tag { min-width: 0; padding: 4px 8px; flex-direction: row; gap: 8px; }
  .turnos-franja-tag div:first-child { flex-shrink: 0; }
  .turnos-tile-name { max-width: 100px; }
}

/* MG30.43cd — Modo privacidad: oculta importes y ventas con blur.
 * MG30.47 — selectores ampliados: KPIs Home, ped-importe, totales tabla, etc.
 */
body.privacy-on .kpi-value,
body.privacy-on .kpi-sub,
body.privacy-on .kpi-meta,
body.privacy-on .kpi-delta,
body.privacy-on .num,
body.privacy-on td.num,
body.privacy-on th.num,
body.privacy-on .ped-importe,
body.privacy-on .cc-price,
body.privacy-on .num-money,
body.privacy-on .ms-privacy,
body.privacy-on [data-privacy="hide"] {
  filter: blur(7px) !important;
  user-select: none;
  transition: filter .18s ease;
}
body.privacy-on .kpi-value:hover,
body.privacy-on .kpi-sub:hover,
body.privacy-on .kpi-meta:hover,
body.privacy-on .num:hover,
body.privacy-on td.num:hover,
body.privacy-on .ped-importe:hover,
body.privacy-on .ms-privacy:hover,
body.privacy-on [data-privacy="hide"]:hover {
  filter: blur(0) !important;
}
.privacy-toggle.privacy-on {
  background: #fff3e0 !important;
  color: #E65100 !important;
  box-shadow: 0 0 0 2px #FF9800 !important;
}

/* MG20260510 #68 — prevenir auto-zoom iOS Safari en inputs cuando focus.
   iOS hace zoom si font-size < 16px. Aplicado solo a touch devices. */
@media (max-width: 768px) {
  input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
  input[type="url"], input[type="search"], input[type="number"], input[type="date"],
  input[type="month"], input[type="datetime-local"], input[type="time"],
  select, textarea {
    font-size: 16px !important;
  }
}

/* MG20260510 — audit MEDIO #17: mobile breakpoints adicionales */
@media (max-width: 640px) {
  /* Tablas con scroll horizontal en móvil */
  .table-wrap, .ped-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data, .ped-table {
    min-width: 600px;
    font-size: 11px;
  }
  /* DetailDrawer ocupa ancho completo en móvil */
  .detail-drawer {
    max-width: 100% !important;
    width: 100% !important;
  }
  /* KPI grid 2 cols en móvil pequeño (no 4) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* Section head con menos padding */
  .section-head {
    padding: 8px 12px !important;
  }
  .section-title {
    font-size: 18px !important;
  }
  /* Botones más grandes para tap target (44x44 mínimo) */
  .btn-sm {
    min-height: 44px;
    padding: 10px 14px !important;
  }
  /* Filter pills menos padding */
  .t-status-pill {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}

/* Tablets */
@media (max-width: 900px) and (min-width: 641px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .data, .ped-table {
    font-size: 12px;
  }
}


/* MG20260531 — Pedidos móvil: ocultar secciones no esenciales (KPIs, tarjetas oficina, chips tiendas, cabecera+feedback del módulo) */
@media (max-width: 768px) {
  .pedidos-page .kpi-grid,
  .pedidos-page .pmh-card,
  .pedidos-page .pmh-chips,
  .pedidos-page .pmh-mh-bar,
  .pedidos-page .pmh-mh-cambios { display: none !important; }
}

/* MG20260531 — Estado: pills en escritorio, dropdown en móvil */
.ped-estado-select { display: none; }
@media (max-width: 768px) {
  .pedidos-page .ped-estado-pills { display: none; }
  .pedidos-page .ped-estado-select { display: block; width: 100%; margin-bottom: 12px; }
}

/* MG20260531 — Vista Calendario de pedidos (compacta, cabe en móvil) */
.ped-cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.ped-cal-mes { font-weight: 700; font-size: 15px; text-transform: capitalize; min-width: 160px; text-align: center; }
.ped-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ped-cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-500); padding: 4px 0; }
.ped-cal-cell { aspect-ratio: 1 / 1; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 4px 2px; cursor: pointer; min-height: 54px; }
.ped-cal-cell.empty { border: 0; background: transparent; cursor: default; }
.ped-cal-cell.has { border-color: var(--brand-400); background: var(--brand-50, #ecfdf5); }
.ped-cal-cell.sel { outline: 2px solid var(--brand-500); outline-offset: -1px; }
.ped-cal-d { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.ped-cal-n { font-size: 11px; font-weight: 700; color: var(--brand-700); line-height: 1.1; }
.ped-cal-eur { font-size: 9.5px; color: var(--ink-500); margin-top: auto; }
.ped-cal-detalle { margin-top: 14px; }
.ped-cal-detalle-head { font-weight: 700; font-size: 14px; text-transform: capitalize; margin-bottom: 8px; }
.ped-cal-empty { color: var(--ink-500); font-size: 13px; padding: 8px; }
.ped-cal-ped { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 6px; cursor: pointer; }
.ped-cal-ped-prov { font-weight: 700; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ped-cal-ped-tienda { font-size: 11px; color: var(--ink-500); flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34%; }
.ped-cal-ped-eur { font-weight: 700; color: var(--brand-700); flex: 0 0 auto; }
@media (max-width: 768px) {
  .ped-cal-grid { gap: 3px; }
  .ped-cal-cell { min-height: 46px; border-radius: 6px; padding: 3px 1px; }
  .ped-cal-d { font-size: 12px; }
  .ped-cal-eur { font-size: 8px; }
  .ped-cal-mes { font-size: 14px; min-width: 120px; }
}

/* MG20260531 — Barra de filtros del calendario (referencia, tienda, estado) */
.ped-cal-filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.ped-cal-filtros .search-inline { flex: 1 1 160px; }
@media (max-width: 768px) {
  .ped-cal-filtros .search-inline, .ped-cal-filtros .t-select { flex: 1 1 100%; }
}

/* MG20260531 — Calendario: estado recibido por día (verde=todo recibido, naranja=falta) + tick + días tardados */
.ped-cal-cell.has.rec { border-color: #10b981; background: #ecfdf5; }
.ped-cal-cell.has.pend { border-color: #f59e0b; background: #fff7ed; }
.ped-cal-cell.has.rec .ped-cal-n { color: #059669; }
.ped-cal-cell.has.pend .ped-cal-n { color: #c2410c; }
.ped-cal-ped-tick { flex: 0 0 auto; font-weight: 800; color: #cbd5e1; width: 16px; text-align: center; }
.ped-cal-ped-tick.rec { color: #10b981; }
.ped-cal-ped-dias { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--ink-500); background: var(--ink-50, #f1f5f9); border-radius: 6px; padding: 1px 7px; }


/* MG20260531 — Módulo Tickets (tabla de cajas) */
.tickets-page .tk-buscador { padding: 14px; margin-bottom: 14px; }
.tk-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tk-rango { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.tk-rango input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.tk-filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-filtros > input, .tk-filtros > .t-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; flex: 1 1 150px; min-width: 0; }
.tk-filtros > .btn { flex: 0 0 auto; }
.tk-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.tk-quick { max-width: 240px; }
.tickets-table th { white-space: nowrap; }
.tk-paginacion { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 12px; }
@media (max-width: 768px) {
  .tk-filtros > input, .tk-filtros > .t-select, .tk-filtros > .btn { flex: 1 1 100%; }
}

/* MG20260531 — Tickets: tabla estilo hoja Excel (cuadrícula + sticky + zebra) */
.tickets-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.tickets-table th, .tickets-table td { border: 1px solid var(--border); padding: 5px 9px; white-space: nowrap; }
.tickets-table thead th { position: sticky; top: 0; background: var(--ink-100, #eef2f6); font-weight: 700; z-index: 1; }
.tickets-table tbody tr:nth-child(even) { background: var(--ink-50, #f8fafc); }
.tickets-table tbody tr:hover { background: var(--brand-50, #ecfdf5); }
.tickets-page .table-wrap { max-height: 70vh; overflow: auto; }
/* MG20260531 — Mike: en móvil tickets en COLUMNAS (no apiladas). Sin .ped-table ya no stackea;
   aquí solo lo hago compacto y con scroll horizontal (cuadrícula tipo Excel). */
@media (max-width: 768px) {
  .tickets-table { font-size: 10.5px; min-width: max-content; }
  .tickets-table th, .tickets-table td { padding: 4px 6px; }
  .tickets-page .table-wrap { -webkit-overflow-scrolling: touch; }
}


/* MG20260531 — ModuleHeader fuera en móvil (TODOS los módulos): cabecera v/Probando + banner feedback */
@media (max-width: 768px) {
  .pmh-mh-bar, .pmh-mh-cambios { display: none !important; }
}
/* MG20260531 — Calendario de Pagos: comprimir a 7 columnas que quepan en móvil */
@media (max-width: 768px) {
  .pagos-cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 2px !important; }
  .pagos-cal-grid > div { min-width: 0 !important; overflow: hidden !important; font-size: 9px !important; padding: 2px 1px !important; }
}

/* MG20260531 — Tickets: fila pulsable (abre detalle) + modal de detalle del ticket */
.tk-row { cursor: pointer; }
.tk-row:hover td { background: var(--brand-50, #ecfdf5); }
.tk-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 6000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tk-modal { background: var(--surface, #fff); border-radius: 14px; width: 100%; max-width: 720px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 12px 48px rgba(0,0,0,.22); }
.tk-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.tk-modal-meta { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 18px; font-size: 13px; color: var(--ink-700); border-bottom: 1px solid var(--border); background: var(--ink-50, #f8fafc); }
.tk-modal .table-wrap { padding: 0; }
.tk-modal .tickets-table tfoot td { position: sticky; bottom: 0; background: var(--ink-100, #eef2f6); border-top: 2px solid var(--border); }

/* MG20260531 — Pagos móvil: que el calendario y sus cabeceras NO se salgan de la pantalla.
   La fila de cabecera (mes ↔ Ingresos/Pagos/Neto) es un flex sin wrap → ensanchaba la página.
   :has() (iOS 16.4+) localiza el contenedor del calendario por su grid pagos-cal-grid. */
@media (max-width: 768px) {
  div:has(> .pagos-cal-grid) { max-width: 100%; overflow-x: clip; }
  div:has(> .pagos-cal-grid) > div { flex-wrap: wrap !important; }
  div:has(> .pagos-cal-grid) > div > div { flex-wrap: wrap !important; min-width: 0; }
}
