/* Tema claro único — alto contraste, legibilidad en pantallas amplias */
:root {
  --blue: #0d47a1;
  --gray-light: #eceff1;
  --gray-medium: #b0bec5;
  --white: #ffffff;
  --bg-base: #cfd8dc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #e3eaf2;
  --text-primary: #0d1b2a;
  --text-secondary: #37474f;
  --text-muted: #546e7a;
  --border: #90a4ae;
  --border-accent: #1565c0;
  --accent: #1565c0;
  --accent-hover: #0d47a1;
  --success: #1b5e20;
  --warning: #e65100;
  --danger: #b71c1c;
  --gradient-page-bg: linear-gradient(165deg, #d5e3f0 0%, #e8eef4 42%, #f0f4f8 100%);
  --gradient-app-bar: linear-gradient(135deg, #0d47a1 0%, #1565c0 45%, #1976d2 100%);
  --gradient-page-hero: linear-gradient(135deg, #0d47a1 0%, #1565c0 42%, #1e88e5 100%);
  --radius-shell: 14px;
  --radius-card: 12px;
  --radius-input: 10px;
  --shadow-hero: 0 6px 24px rgba(13, 71, 161, 0.28);
  --shadow-card: 0 2px 12px rgba(13, 71, 161, 0.1);
  --shadow-card-hover: 0 8px 22px rgba(13, 71, 161, 0.16);
  --border-card: 1px solid rgba(13, 71, 161, 0.18);
  --table-head-bg: #dce6f2;
  --table-head-text: #0d1b2a;
  --table-row-alt: #f5f8fb;
  --table-row-hover: #e3f2fd;
  --table-border: #b0bec5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: var(--gradient-page-bg);
  color: var(--text-primary);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-page-bg);
}
.login-box {
  background: var(--white);
  padding: 2.5rem 2.75rem;
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-card-hover);
  border: var(--border-card);
  width: 100%;
  max-width: 380px;
}
.login-logo-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
}
.login-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.login-box h1 {
  margin: 0 0 1.5rem;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}
.login-box .error { color: var(--danger); font-size: 0.9rem; margin-bottom: 0.75rem; }
.login-box .hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 1rem; }

/* Login: mismo ancho email y contraseña (el sitio limita email/tel a 180px en .form-group) */
.login-box .form-group input[type="email"],
.login-box .form-group input[type="password"] {
  width: 100%;
  max-width: none;
  min-width: 0;
}
.login-box button[type="submit"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-input);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.35);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.login-box button[type="submit"]:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(25, 118, 210, 0.4);
}

/* Formularios */
.form-group { margin-bottom: 0.6rem; }
.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: "Roboto", sans-serif;
  outline: none;
  background: var(--white);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="email"] {
  max-width: 180px;
}
.form-group input.short,
.form-group select.short {
  max-width: 160px;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(25,118,210,.25);
}

/* Botones: relleno sólido con efecto 3D/brillo (borde superior claro, sombra inferior) */
button,
.btn {
  padding: 0.35rem 0.9rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: "Roboto", sans-serif;
  letter-spacing: .02em;
  transition: box-shadow .15s, filter .15s, transform .05s;
}
button.primary,
.btn.primary,
.btn {
  background: linear-gradient(180deg, #42a5f5 0%, #1976d2 50%, #1565c0 100%);
  color: var(--white);
  box-shadow: 0 3px 6px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.25);
}
button.secondary,
.btn-secondary {
  background: linear-gradient(180deg, #e0e0e0 0%, #bdbdbd 50%, #9e9e9e 100%);
  color: var(--text-primary);
  box-shadow: 0 2px 5px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.5);
}
button.danger,
.btn.danger {
  background: linear-gradient(180deg, #ef5350 0%, #c62828 50%, #b71c1c 100%);
  color: var(--white);
  box-shadow: 0 3px 6px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.2);
}
/* Botones verde y amarillo (estilo imagen: relleno sólido 3D) */
.btn.success,
button.success {
  background: linear-gradient(180deg, #66bb6a 0%, #43a047 50%, #388e3c 100%);
  color: #1b5e20;
  box-shadow: 0 3px 6px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn.warning,
button.warning {
  background: linear-gradient(180deg, #fff176 0%, #ffd54f 50%, #ffb300 100%);
  color: #e65100;
  box-shadow: 0 3px 6px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.4);
}
button:hover,
.btn:hover {
  box-shadow: 0 4px 10px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.3);
  transform: translateY(-1px);
}
button.primary:hover, .btn.primary:hover {
  background: linear-gradient(180deg, #5bb5f7 0%, #1e88e5 50%, #1565c0 100%);
  color: var(--white);
}
button.secondary:hover, .btn-secondary:hover {
  background: linear-gradient(180deg, #eeeeee 0%, #e0e0e0 50%, #bdbdbd 100%);
}
button:active,
.btn:active {
  box-shadow: 0 1px 3px rgba(0,0,0,.3) inset;
  transform: translateY(0);
}

/* Layout principal */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gradient-page-bg);
}

/* App bar — mismo lenguaje visual que el hero de Operaciones */
.app-bar {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 1rem;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-top: max(0px, env(safe-area-inset-top, 0px));
  background: var(--gradient-app-bar);
  color: var(--white);
  box-shadow: 0 4px 18px rgba(13, 71, 130, 0.28);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 -0.5rem;
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s;
}
.menu-toggle:hover {
  background: rgba(255,255,255,.2);
}
.menu-toggle .material-icons {
  font-size: 24px;
}
.app-bar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 500;
  margin-left: 0.5rem;
}
.app-logo {
  font-size: 28px !important;
  opacity: .95;
}
.app-bar-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.app-bar-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.app-bar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-bar-user .user-name {
  font-size: 0.9rem;
  color: var(--white);
  opacity: .95;
}
.app-bar-user .badge-role {
  background: rgba(255,255,255,.25);
  color: var(--white);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}
.global-search-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.global-search-mobile-toggle:hover,
.global-search-mobile-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}
.global-search-mobile-toggle .material-icons {
  font-size: 24px;
}
.global-search-mobile-close {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  color: #1565c0;
  cursor: pointer;
  border-radius: 50%;
}
.global-search-mobile-close .material-icons {
  font-size: 1.35rem !important;
}
.global-search-wrap {
  position: relative;
  margin-left: 1rem;
  flex: 1;
  max-width: min(560px, 42vw);
  z-index: 1100;
}
.global-search-input {
  width: 100%;
  padding: 0.45rem 0.65rem 0.45rem 2.1rem;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-input);
  background: rgba(255,255,255,.22);
  color: var(--white);
  font-size: 0.9rem;
  font-family: "Roboto", sans-serif;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.global-search-input::placeholder { color: rgba(255,255,255,.8); }
.global-search-input:focus {
  border-color: var(--white);
  background: rgba(255,255,255,.25);
  outline: none;
}
.global-search-wrap .global-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: rgba(255,255,255,.9);
  pointer-events: none;
}
/* Panel de búsqueda global — estilo Google + barra lateral */
.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: min(100%, 520px);
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(13, 27, 42, 0.18), 0 2px 8px rgba(13, 27, 42, 0.08);
  max-height: min(70vh, 480px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1200;
}
.global-search-results.gs-has-nav {
  min-width: min(100%, 640px);
  max-height: min(80vh, 560px);
}
.gs-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.gs-nav {
  flex: 0 0 auto;
  width: 9.5rem;
  max-width: 38%;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.35rem;
  background: #f5f8fb;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #b0bec5 transparent;
}
.gs-nav-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.4rem 0.45rem;
  cursor: pointer;
  text-align: left;
  color: #37474f;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background 0.12s ease, color 0.12s ease;
}
.gs-nav-item:hover {
  background: #e8f0fe;
  color: #0d47a1;
}
.gs-nav-item.is-active {
  background: #dcecff;
  color: #0d47a1;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #1565c0;
}
.gs-nav-icon {
  font-size: 1rem !important;
  flex-shrink: 0;
  color: #1565c0;
  opacity: 0.9;
}
.gs-nav-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-nav-count {
  flex-shrink: 0;
  min-width: 1.15rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: #e3eaf2;
  color: #455a64;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
}
.gs-nav-item.is-active .gs-nav-count {
  background: #1565c0;
  color: #fff;
}
.gs-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.gs-loading,
.gs-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.gs-empty-icon {
  font-size: 2rem !important;
  color: var(--text-muted);
  display: block;
  margin: 0 auto 0.35rem;
}
.gs-empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}
.gs-loading .spin {
  animation: gs-spin 0.9s linear infinite;
  vertical-align: middle;
  margin-right: 0.35rem;
}
@keyframes gs-spin {
  to { transform: rotate(360deg); }
}
.gs-list {
  overflow-y: visible;
  padding: 0.35rem 0;
  flex: 1 1 auto;
}
.gs-scroll-col {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.gs-elevator-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2rem;
  border: none;
  background: #f0f4f8;
  color: #1565c0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.gs-elevator-btn .material-icons {
  font-size: 1.35rem !important;
}
.gs-elevator-btn:hover:not(:disabled) {
  background: #e3f2fd;
  color: #0d47a1;
}
.gs-elevator-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.gs-elevator-up {
  border-bottom: 1px solid #e8ecf0;
  border-radius: 16px 16px 0 0;
}
.gs-elevator-down {
  border-top: 1px solid #e8ecf0;
}
.gs-list-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.gs-list.gs-list--scroll {
  max-height: calc(4.35rem * 6);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #90a4ae #eef2f6;
}
.gs-list.gs-list--scroll::-webkit-scrollbar {
  width: 10px;
}
.gs-list.gs-list--scroll::-webkit-scrollbar-track {
  background: #eef2f6;
  border-radius: 8px;
}
.gs-list.gs-list--scroll::-webkit-scrollbar-thumb {
  background: #90a4ae;
  border-radius: 8px;
  border: 2px solid #eef2f6;
}
.gs-list.gs-list--scroll::-webkit-scrollbar-thumb:hover {
  background: #607d8b;
}
.global-search-results.gs-has-elevator {
  max-height: min(78vh, 520px);
}
.global-search-results.gs-has-nav.gs-has-elevator {
  max-height: min(82vh, 580px);
}
.gs-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f3f6;
  transition: background 0.12s ease;
}
.gs-item:last-child {
  border-bottom: none;
}
.gs-item:hover,
.gs-item.is-active {
  background: #f1f7ff;
}
.gs-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8f0fe;
  color: #1565c0;
  font-size: 20px !important;
}
.gs-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.gs-item-type {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.gs-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a0dab;
  line-height: 1.25;
  word-break: break-word;
}
.gs-item:hover .gs-item-title,
.gs-item.is-active .gs-item-title {
  text-decoration: underline;
}
.gs-item-sub,
.gs-item-meta {
  font-size: 0.8rem;
  color: #4d5156;
  line-height: 1.3;
  word-break: break-word;
}
.gs-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.gs-item-ext {
  flex-shrink: 0;
  font-size: 1rem !important;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.gs-mark {
  background: #fff3b0;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
  font-weight: 700;
}
.gs-footer {
  flex-shrink: 0;
  padding: 0.45rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid #eef1f4;
  background: #fafbfc;
  border-radius: 0 0 16px 16px;
}
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--white);
  border-radius: 50%;
  transition: background .2s;
}
.btn-icon:hover {
  background: rgba(255,255,255,.2);
}

/* Sidebar — fondo blanco, borde azul */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--white);
  box-shadow: 6px 0 28px rgba(13, 71, 130, 0.12);
  border-right: 1px solid rgba(25, 118, 210, 0.12);
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.sidebar.is-open {
  transform: translateX(0);
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.sidebar-header strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
}
.sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s;
}
.sidebar-close:hover {
  background: var(--gray-light);
  color: var(--blue);
}
.sidebar .user-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar .badge {
  background: var(--gray-light);
  color: var(--blue);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover {
  background: var(--gray-light);
  color: var(--blue);
}
.sidebar-nav a .material-icons {
  font-size: 20px;
  color: var(--text-muted);
}
.sidebar-nav a:hover .material-icons {
  color: var(--blue);
}
.sidebar-nav a.nav-active {
  background: var(--gray-light);
  color: var(--blue);
  font-weight: 500;
  border-left: 3px solid var(--blue);
  padding-left: calc(0.9rem - 3px);
}
.sidebar-nav a.nav-active .material-icons {
  color: var(--blue);
}
.sidebar-nav .sidebar-group {
  margin: 0.1rem 0;
  border-radius: 8px;
}
.sidebar-group-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  list-style: none;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
  user-select: none;
  transition: background .15s, color .15s;
}
.sidebar-group-summary::-webkit-details-marker { display: none; }
.sidebar-group-summary::marker { content: ''; }
.sidebar-group-summary .material-icons:first-of-type {
  font-size: 20px;
  color: var(--text-muted);
}
.sidebar-group-chevron {
  margin-left: auto;
  font-size: 20px !important;
  color: var(--text-muted) !important;
  transition: transform .2s;
}
.sidebar-group[open] .sidebar-group-chevron {
  transform: rotate(180deg);
}
.sidebar-group:has(.nav-active) .sidebar-group-summary {
  color: var(--blue);
  font-weight: 500;
}
.sidebar-group:has(.nav-active) .sidebar-group-summary .material-icons:first-of-type {
  color: var(--blue);
}
.sidebar-group-summary:hover {
  background: var(--gray-light);
  color: var(--blue);
}
.sidebar-group-summary:hover .material-icons {
  color: var(--blue);
}
.sidebar-group-links {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.15rem 0 0.4rem 0.35rem;
  margin: 0 0 0.25rem 0.65rem;
  border-left: 2px solid rgba(25, 118, 210, 0.2);
}
.sidebar-group-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-group-links a .material-icons {
  font-size: 18px;
  color: var(--text-muted);
}
.sidebar-group-links a:hover {
  background: var(--gray-light);
  color: var(--blue);
}
.sidebar-group-links a:hover .material-icons { color: var(--blue); }
.sidebar-group-links a.nav-active {
  background: rgba(25, 118, 210, 0.08);
  color: var(--blue);
  font-weight: 500;
  border-left: 3px solid var(--blue);
  margin-left: -2px;
  padding-left: calc(0.55rem - 1px);
}
.sidebar-group-links a.nav-active .material-icons { color: var(--blue); }
.sidebar-logout {
  margin-top: 1rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.content {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: 1.25rem 1.5rem;
  overflow: auto;
  margin-top: 0;
  background: transparent;
}
/* h2 de sección (no sustituye al título de página siguiente) */
.content h2 {
  margin: 0.9rem 0 0.55rem;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text-primary);
}
.content .card h2 {
  margin-top: 0;
}
/* Título principal: hero alineado con Operaciones (incl. módulos calidad con .calidad-page) */
.content > h2:first-of-type,
.content .calidad-page > h2:first-of-type {
  margin: 0 0 1.1rem;
  padding: 1.05rem 1.25rem;
  font-size: 1.48rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
  background: var(--gradient-page-hero);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-hero);
}
.content > h2:first-of-type a,
.content .calidad-page > h2:first-of-type a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.content > h2:first-of-type a:hover,
.content .calidad-page > h2:first-of-type a:hover {
  color: rgba(255,255,255,.92);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
/* Inicio (escritorio): una fila compacta; si no caben, scroll horizontal */
.cards.dashboard-cards.dashboard-cards-narrow {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  grid-template-columns: unset;
}
.dashboard-cards-narrow a.card-link {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
  flex: 1 1 0;
  min-width: 3.9rem;
  height: 2.85rem;
  min-height: 2.85rem;
  max-height: 2.85rem;
  padding: 0.2rem 0.34rem;
  gap: 0.02rem;
  box-sizing: border-box;
}
.dashboard-cards-narrow .card:not(a) {
  padding: 0.35rem 0.45rem;
  min-height: 0;
}
.dashboard-cards-narrow .card h3 {
  font-size: 0.72rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.12;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-cards-narrow .card .big {
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.dashboard-cards-narrow .card-hint {
  font-size: 0.63rem;
  line-height: 1.08;
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card {
  background: var(--white);
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: var(--border-card);
  transition: box-shadow .2s, transform .15s, border-color .15s;
}
.card-narrow {
  max-width: 520px;
  margin: 0 auto 0.75rem;
}
/* Tarjetas semáforo: sin novedad = gris claro; con novedad = amarillo/alerta */
.card.card-semaforo-ok {
  background: linear-gradient(180deg, #f5f5f5 0%, #e0e0e0 45%, #bdbdbd 100%) !important;
  border: none !important;
  box-shadow: 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.6);
  border-radius: 12px;
}
.card.card-semaforo-ok .card-hint,
.card.card-semaforo-ok h3,
.card.card-semaforo-ok .big { color: #616161; }
.card.card-semaforo-ok .card-hint { opacity: .9; }
.card.card-semaforo-alerta {
  background: linear-gradient(180deg, #fff176 0%, #ffd54f 45%, #ffb300 100%) !important;
  border: none !important;
  box-shadow: 0 3px 8px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.45);
  border-radius: 12px;
}
.card.card-semaforo-alerta .card-hint,
.card.card-semaforo-alerta h3,
.card.card-semaforo-alerta .big { color: #e65100; }
.card.card-semaforo-alerta .card-hint { opacity: .95; }
.card.card-semaforo.card-link:hover {
  box-shadow: 0 5px 14px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.35);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(25, 118, 210, 0.22);
}
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}
.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(25,118,210,.2);
}
.card-link .card-hint {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  color: var(--blue);
}
.card-link:hover .card-hint {
  text-decoration: underline;
}
/* Por encima de .card-link .card-hint: panel inicio conserva tipografía del grid */
.dashboard-cards-narrow a.card-link .card-hint {
  font-size: 0.63rem;
  margin-top: 0;
}
.dashboard-cards-narrow a.card-link:hover .card-hint {
  text-decoration: none;
}
.card-semaforo-ok .card-hint,
.card-semaforo-alerta .card-hint { color: var(--text-secondary); }
.valorizacion-bar-wrap {
  margin-bottom: 0.75rem;
}
.valorizacion-bar {
  display: flex;
  height: 24px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-medium);
  margin-bottom: 0.4rem;
}
.valorizacion-bar-segment {
  display: block;
  min-width: 2px;
  transition: width .2s;
}
.valorizacion-bar-segment.valorizacion-pagado { background: var(--blue); }
.valorizacion-bar-segment.valorizacion-credito { background: var(--gray-medium); }
.valorizacion-bar-segment.valorizacion-mora { background: var(--danger); }
.valorizacion-bar-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.valorizacion-leyenda-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.valorizacion-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.valorizacion-dot.valorizacion-pagado { background: var(--blue); }
.valorizacion-dot.valorizacion-credito { background: var(--gray-medium); }
.valorizacion-dot.valorizacion-mora { background: var(--danger); }
.dashboard-links {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.dashboard-links a {
  color: var(--blue);
  text-decoration: none;
}
.dashboard-links a:hover {
  text-decoration: underline;
}
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.card .big {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: var(--border-card);
}
th,
td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.35;
}
th {
  background: var(--table-head-bg);
  font-weight: 700;
  color: var(--table-head-text);
  font-size: 0.8rem;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.01em;
}
.content table tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
}
tr:hover td {
  background: var(--table-row-hover) !important;
}

/* Tablas de trabajo: mejor aprovechamiento horizontal en escritorio */
@media (min-width: 1024px) {
  .content table {
    table-layout: auto;
  }
  .content table th,
  .content table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
  }
  .content table td .btn,
  .content table td .badge {
    white-space: nowrap;
  }
  /* Autoajuste global de columnas (aplicado por JS) */
  .content table.bodega-auto-cols {
    table-layout: auto !important;
  }
  .content table.bodega-auto-cols th,
  .content table.bodega-auto-cols td {
    vertical-align: top;
  }
  .content table.bodega-auto-cols .bodega-col-num {
    width: 1%;
    white-space: nowrap;
  }
  .content table.bodega-auto-cols .bodega-col-wide {
    min-width: 18ch;
    white-space: normal;
  }
  .content table.bodega-auto-cols .bodega-col-mid {
    min-width: 10ch;
  }
  /* Utilidades para tablas con layout dedicado */
  .content table.bodega-auto-skip .col-num {
    text-align: right;
    white-space: nowrap;
  }
  .content table.bodega-auto-skip .col-nowrap {
    white-space: nowrap;
  }
  .content table.bodega-auto-skip .col-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Densidad compacta por defecto en escritorio (incluye laptops medianas) */
@media (min-width: 1024px) {
  .content table th,
  .content table td {
    padding: 0.24rem 0.35rem !important;
    line-height: 1.15;
  }
  .content .btn.btn-sm {
    padding: 0.22rem 0.38rem !important;
  }
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
}
.badge.borrador { background: #eceff1; color: #263238; border: 1px solid #90a4ae; font-weight: 600; }
.badge.enviada { background: #fff3e0; color: #bf360c; border: 1px solid #e65100; font-weight: 600; }
.badge.aprobada { background: #e3f2fd; color: #0d47a1; border: 1px solid #1565c0; font-weight: 600; }
.badge.rechazada { background: #ffebee; color: #b71c1c; border: 1px solid #c62828; font-weight: 600; }
.badge.parcial { background: #f3e5f5; color: #6a1b9a; border: 1px solid #7b1fa2; font-weight: 600; }
.badge.completa { background: #e8f5e9; color: #1b5e20; border: 1px solid #2e7d32; font-weight: 600; }
.badge.completada { background: #e8f5e9; color: #1b5e20; border: 1px solid #2e7d32; font-weight: 600; }
.badge.pendiente { background: #fff8e1; color: #e65100; border: 1px solid #f57c00; font-weight: 600; }
.badge.bajo-minimo { background: #fff3e0; color: #e65100; border: 1px solid #f57c00; font-weight: 600; }
tr.row-bajo-minimo td { background: var(--gray-light) !important; }
.vence-mora { color: var(--danger); font-weight: 700; }
.vence-mora strong { color: var(--danger); font-weight: 700; }
tr.row-bajo-minimo:hover td { background: var(--gray-medium) !important; }
.card.alert-card { border-left: 4px solid var(--warning); }
.card.alert-card a { color: var(--blue); text-decoration: none; }
.card.alert-card a:hover { text-decoration: underline; }
.mb1 { margin-bottom: 1rem; }
/* Producción / Transformación: formulario compacto (¼) + historial */
.produccion-page-layout {
  display: grid;
  grid-template-columns: minmax(240px, 25%) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.produccion-form-panel { margin-bottom: 0 !important; }
.produccion-form-panel h3,
.produccion-list-panel h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.produccion-form .form-group { margin-bottom: 0.45rem; }
.produccion-form .form-group label { font-size: 0.78rem; margin-bottom: 0.15rem; }
.produccion-form .form-group input,
.produccion-form .form-group select { padding: 0.35rem 0.45rem; font-size: 0.85rem; }
.produccion-form-weights { grid-template-columns: 1fr; gap: 0.35rem; }
.produccion-form .btn-block { width: 100%; margin-top: 0.35rem; padding: 0.45rem 0.6rem; font-size: 0.85rem; }
@media (max-width: 900px) {
  .produccion-page-layout { grid-template-columns: 1fr; }
}
/* Espacio de trabajo — orden de producción cocina */
.po-workspace { border: 2px solid var(--blue, #1976d2); }
.po-workspace-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; padding-bottom: 0.65rem; border-bottom: 1px solid #e8eaed; }
.po-workspace-section { margin-bottom: 1.1rem; padding: 0.75rem; background: #f8f9fa; border-radius: 8px; border: 1px solid #e8eaed; }
.po-workspace-section:last-child { margin-bottom: 0; }
.po-workspace-section h4 { margin: 0 0 0.5rem; font-size: 0.92rem; display: flex; align-items: center; gap: 0.35rem; }
.po-workspace-section .section-num { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--blue, #1976d2); color: #fff; font-size: 0.75rem; font-weight: 700; }
.po-workspace-section.po-section-done { opacity: 0.85; background: #f1f8f4; border-color: #c8e6c9; }
.po-workspace-section.po-section-disabled { opacity: 0.55; pointer-events: none; }
.po-workspace-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.po-order-card { border: 1px solid #e0e3e7; border-radius: 8px; padding: 0.55rem 0.75rem; margin-bottom: 0.5rem; }
.po-order-card.po-order-active { border-color: var(--blue, #1976d2); box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.2); }
.po-order-card-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ws-req-row.ws-req-hidden { display: none; }
.po-order-card.po-order-select { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.po-order-card.po-order-select:hover { border-color: #90caf9; }
.po-unified-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 1rem;
}
.po-unified-layout.orders-expanded {
  grid-template-columns: minmax(200px, 26%) 1fr;
}
.po-orders-panel {
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}
.po-orders-panel.is-collapsed {
  align-self: start;
}
.po-orders-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  text-align: left;
  font: inherit;
  color: inherit;
}
.po-orders-toggle:hover { background: #f1f3f4; }
.po-orders-toggle-icon {
  color: #5f6368;
  font-size: 1.35rem !important;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.po-orders-panel.is-collapsed .po-orders-toggle-icon { transform: rotate(-90deg); }
.po-orders-panel:not(.is-collapsed) .po-orders-toggle-icon { transform: rotate(0deg); }
.po-orders-toggle-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.po-orders-toggle-text strong { font-size: 0.92rem; }
.po-orders-summary {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.po-orders-count {
  flex-shrink: 0;
  background: #e8f0fe;
  color: #1976d2;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 10px;
  min-width: 1.25rem;
  text-align: center;
}
.po-orders-count[hidden] { display: none; }
.po-orders-body {
  padding: 0 0.65rem 0.65rem;
  max-height: min(40vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.po-orders-panel.is-collapsed .po-orders-body {
  display: none;
}
.po-order-card-compact {
  padding: 0.4rem 0.55rem !important;
  margin-bottom: 0.35rem !important;
}
.po-order-code { font-size: 0.82rem; }
.po-order-meta {
  font-size: 0.72rem;
  margin: 0.12rem 0 0.25rem;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-order-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  background: #f1f3f4;
  color: #5f6368;
}
.po-order-tag-available { background: #fef7e0; color: #b06000; }
.po-order-tag-mine { background: #e6f4ea; color: #137333; }
.po-workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}
.po-show-orders-inline {
  flex-shrink: 0;
  white-space: nowrap;
}
.po-whole-unit-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #1565c0;
  background: #e3f2fd;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.po-cost-summary ul { margin-bottom: 0; }
.prod-filters-row { display:flex; flex-wrap:wrap; gap:0.5rem 0.75rem; align-items:flex-end; }
.prod-filters-row label { font-size:0.82rem; display:flex; flex-direction:column; gap:0.15rem; }
.prod-kpi-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:0.5rem; margin-bottom:0.75rem; }
.prod-kpi { padding:0.65rem 0.75rem !important; text-align:center; }
.prod-kpi-label { display:block; font-size:0.72rem; color:#5f6368; margin-bottom:0.15rem; }
.prod-kpi strong { font-size:1.15rem; color:#1565c0; }
.prod-charts-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:0.65rem; margin-bottom:0.75rem; }
.prod-chart-box { padding:0.75rem !important; }
.prod-chart-box h3 { margin:0 0 0.5rem; font-size:0.92rem; }
.prod-chart-box canvas { width:100% !important; max-height:300px; }
.prod-ranking-table { font-size:0.85rem; width:100%; }
.prod-ranking-table .col-num { text-align:right; }
.prod-history-item { border:1px solid #e8eaed; border-radius:8px; padding:0.45rem 0.65rem; margin-bottom:0.45rem; }
.prod-history-item summary { cursor:pointer; font-size:0.88rem; }
.prod-history-detail { padding:0.35rem 0 0.15rem; }
.op-tab.active { background:#e8f0fe; color:#1565c0; border-color:#90caf9; font-weight:600; }
.op-orders-table th, .op-orders-table td { padding:0.4rem 0.35rem; vertical-align:middle; }
.po-work-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 360px; color: #5f6368; padding: 1.5rem; }
.po-work-empty-icon { font-size: 2.5rem; color: #90caf9; margin-bottom: 0.5rem; }
.po-workspace-inline { border: none; box-shadow: none; padding: 0; }
.po-workspace-inline .po-workspace-head { border-bottom: 1px solid #e8eaed; padding-bottom: 0.65rem; margin-bottom: 0.85rem; }
.po-section-accept { background: #fff8e1; border-color: #ffe082; }
.po-order-goal { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.65rem 0.75rem; margin-bottom: 0.85rem; background: #e8f0fe; border: 1px solid #90caf9; border-radius: 8px; font-size: 0.88rem; }
.po-order-goal .material-icons { color: #1976d2; font-size: 1.35rem; flex-shrink: 0; }
.po-pending-alert { display: flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0.65rem; margin-bottom: 0.75rem; background: #fef7e0; border: 1px solid #f9ab00; border-radius: 8px; color: #b06000; font-size: 0.85rem; font-weight: 600; }
.po-pending-alert .material-icons { font-size: 1.15rem; color: #f9ab00; }
.po-order-warning-badge { display: inline-flex; color: #f9ab00; vertical-align: middle; }
.po-order-warning-badge .material-icons { font-size: 1.1rem; }
.po-order-warning-card { border-color: #f9ab00; background: #fffdf5; }
.po-order-warning-text { font-size: 0.75rem; margin: 0.25rem 0 0; color: #b06000; font-weight: 600; }
.po-work-panel > #poWorkEmpty[hidden], .po-work-panel > #poWorkspace[hidden] { display: none !important; }
.po-work-panel.has-order #poWorkEmpty { display: none !important; }
.po-work-panel.has-order #poWorkspace { display: block !important; }
.po-order-card .po-open-order { margin-top: 0.4rem; width: 100%; }
/* Tablas del espacio de trabajo — producción cocina */
.po-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.35rem 0 0.5rem;
  max-width: 100%;
}
.po-data-table {
  width: 100%;
  font-size: 0.85rem;
  min-width: 0;
}
.po-data-table th,
.po-data-table td {
  vertical-align: middle;
}
.po-col-product { min-width: 6.5rem; max-width: 10rem; word-break: break-word; }
.po-cell-input {
  width: 100%;
  min-width: 3.25rem;
  max-width: 5rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.82rem;
  box-sizing: border-box;
}
.po-cell-select {
  min-width: 3.5rem;
  max-width: 5.5rem;
  padding: 0.35rem 0.3rem;
  font-size: 0.78rem;
}
.po-col-action { width: 1%; white-space: nowrap; }
.po-inline-unit { font-size: 0.75rem; color: #5f6368; white-space: nowrap; }
.po-prod-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
.po-prod-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  margin: 0;
}
.po-prod-fields .po-field-wide { grid-column: 1 / -1; }
.po-field-input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  box-sizing: border-box;
}
.po-field-unit { font-size: 0.78rem; color: #5f6368; margin-top: 0.15rem; }
@media (max-width: 900px) {
  .po-unified-layout,
  .po-unified-layout.orders-expanded {
    grid-template-columns: 1fr;
  }
  .po-orders-body { max-height: min(50vh, 360px); }
  .po-work-panel { min-height: auto; }
  .po-workspace-head h3 { font-size: 0.95rem !important; }
  #poWorkspaceSubtitle { font-size: 0.78rem !important; line-height: 1.35; word-break: break-word; }
}
@media (max-width: 768px) {
  .prod-charts-grid { grid-template-columns: 1fr; }
  .prod-filters-row label { flex: 1 1 45%; min-width: 8rem; }
  .po-unified-layout .card { padding: 0.65rem 0.7rem; }
  .po-work-empty { min-height: 160px; padding: 1rem; }
  .po-workspace-section { padding: 0.6rem; margin-bottom: 0.75rem; }
  .po-workspace-section h4 { font-size: 0.86rem; flex-wrap: wrap; }
  .po-order-goal { flex-direction: column; font-size: 0.82rem; padding: 0.55rem 0.65rem; }
  .po-order-goal .material-icons { font-size: 1.2rem; }
  .po-data-table { font-size: 0.78rem; }
  .po-data-table th,
  .po-data-table td { padding: 0.35rem 0.3rem !important; }
  .po-cell-input { max-width: none; min-width: 2.75rem; font-size: 16px; /* evita zoom iOS */ }
  .po-cell-select { max-width: none; min-width: 3rem; font-size: 16px; }
  .po-prod-fields { grid-template-columns: 1fr 1fr; }
  .po-prod-fields .po-field-wide { grid-column: 1 / -1; }
  .po-workspace-actions { flex-direction: column; }
  .po-workspace-actions .btn { width: 100%; justify-content: center; }
  .po-order-card .po-open-order { font-size: 0.82rem; padding: 0.45rem 0.5rem; }
  /* Tablas: scroll horizontal suave con ancho mínimo legible */
  .po-data-table--supplies { min-width: 28rem; }
  .po-data-table--close { min-width: 26rem; }
  .po-table-wrap--accept .po-data-table { min-width: 22rem; }
}
@media (max-width: 480px) {
  .po-data-table .po-col-ref { display: none; }
  .po-data-table--supplies { min-width: 18rem; }
  .po-data-table--close { min-width: 20rem; }
  .po-col-product { min-width: 4.5rem; max-width: 7rem; font-size: 0.76rem; }
  .po-col-action .btn { padding: 0.2rem 0.35rem; font-size: 0.7rem; }
  .po-col-return { min-width: 5.5rem; }
  .po-col-return .po-cell-input { display: inline-block; width: 3.5rem; vertical-align: middle; }
  .po-prod-fields { grid-template-columns: 1fr; }
  .po-orders-panel h3 { font-size: 0.92rem !important; }
}
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  align-items: flex-end;
}
.form-grid-2.form-grid-gap { gap: 0.75rem 1.25rem; }
.form-actions {
  grid-column: 1 / -1;
  margin-top: 0.2rem;
}
.form-inline .inline-input {
  display: flex;
  gap: 0.25rem;
}
.form-inline .inline-input input {
  flex: 1;
}
.form-inline .inline-input button {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-content {
  background: var(--white);
  padding: 1rem;
  border-radius: var(--radius-shell);
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  border: var(--border-card);
}
/* Contenedor del escáner: altura fija para que se vea el vídeo de la cámara */
#barcodeScanner {
  min-height: 300px;
  height: 300px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
#barcodeScanner video,
#barcodeScanner canvas {
  width: 100% !important;
  height: 100% !important;
  min-height: 300px !important;
  display: block !important;
  object-fit: cover !important;
  opacity: 1 !important;
  visibility: visible !important;
}
#barcodeScanner canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.barcode-scan-modal .modal-content {
  overflow: visible;
}
.dropdown-list {
  position: absolute;
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  background: var(--white);
  border: var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
  margin-top: 2px;
}
.dropdown-item {
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.dropdown-item:hover {
  background: var(--gray-light);
}
.form-group:has(#newSupplierSearch) { position: relative; }
tr.order-row.clickable { cursor: pointer; }
.orders-table .sortable { cursor: pointer; user-select: none; }
.orders-table .sortable:hover { background: var(--gray-light); }
.orders-table .sort-icon { font-size: 0.75em; color: var(--text-muted); }
.msg {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-input);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.msg.error { background: #ffebee; color: var(--danger); border: 1px solid var(--danger); }
.msg.success { background: #e8f5e9; color: var(--success); border: 1px solid var(--success); }

.modal-content.modal-lg {
  width: 70vw;
  max-width: 70vw;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 0.75rem; }
.modal-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); line-height: 1; padding: 0 0.25rem; }
.modal-close:hover { color: var(--blue); }
.modal-footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.modal-body { padding: 0; }

/* Listas compactas de detalle en modales (OCI, facturas, salidas, etc.) */
.modal-summary,
.order-detail-summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0 0 0.5rem;
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  background: #f8fafb;
  overflow: hidden;
}
.modal-summary-line,
.order-detail-line {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.35rem 0.5rem;
  align-items: start;
  min-width: 0;
  width: 100%;
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid #ebeef1;
  box-sizing: border-box;
}
.modal-summary-line:last-child,
.order-detail-line:last-child {
  border-bottom: none;
}
.modal-summary-label,
.order-detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #5f6368;
  line-height: 1.2;
}
.modal-summary-value,
.order-detail-value {
  font-size: 0.875rem;
  color: #202124;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}
.invoice-detail-grid,
.report-detail-grid,
.sal-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0.5rem;
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  background: #f8fafb;
  overflow: hidden;
}
.invoice-detail-field {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.35rem 0.5rem;
  align-items: start;
  margin: 0;
  line-height: 1.25;
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid #ebeef1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.invoice-detail-field:last-child { border-bottom: none; }
.invoice-detail-label { font-weight: 600; color: #5f6368; font-size: 0.72rem; }
.invoice-detail-value { color: #202124; font-size: 0.8rem; overflow-wrap: break-word; word-break: normal; }
.filter-badge { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
.filter-badge a { color: var(--blue); text-decoration: none; }
.filter-badge a:hover { text-decoration: underline; }
.detail-table { width: 100%; font-size: 0.85rem; margin-top: 0.5rem; }
.detail-table th, .detail-table td { padding: 0.35rem 0.5rem; color: var(--text-primary); }
.detail-table th { background: var(--table-head-bg); color: var(--table-head-text); font-weight: 700; }

/* Layout compacto para escritorio (Windows, más información en pantalla) */
@media (min-width: 769px) {
  .modal-summary,
  .order-detail-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1rem;
    padding: 0.45rem 0;
    border: none;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid #e8eaed;
    overflow: visible;
  }
  .modal-summary-line,
  .order-detail-line {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    padding: 0;
    border-bottom: none;
    align-items: baseline;
  }
  .invoice-detail-grid,
  .report-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1rem;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .invoice-detail-field {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    padding: 0;
    border-bottom: none;
    align-items: baseline;
  }
  .invoice-detail-label { font-size: 0.75rem; }
  .invoice-detail-value,
  .order-detail-value { font-size: 0.875rem; }
  .app-bar {
    height: 52px;
    padding: 0 0.75rem;
  }
  .content {
    padding: 0.75rem 1.15rem;
    max-width: none;
  }
  .content h2 {
    margin: 0.65rem 0 0.45rem;
    font-size: 1.02rem;
  }
  .content > h2:first-of-type,
  .content .calidad-page > h2:first-of-type {
    margin: 0 0 0.65rem;
    padding: 0.75rem 1rem;
    font-size: 1.28rem;
  }
  .flex-between {
    margin-bottom: 0.5rem;
    gap: 0.35rem;
  }
  .cards {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .card {
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
  }
  .card h3 {
    font-size: 0.82rem;
    margin: 0 0 0.3rem;
  }
  .card .big {
    font-size: 1.45rem;
  }
  .card-hint {
    font-size: 0.8rem;
    margin-top: 0.15rem;
  }
  .cards.dashboard-cards.dashboard-cards-narrow {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
  }
  .dashboard-cards-narrow a.card-link {
    flex: 1 1 0;
    min-width: 3.75rem;
    justify-content: space-between;
    height: 2.78rem;
    min-height: 2.78rem;
    max-height: 2.78rem;
    padding: 0.18rem 0.3rem;
    gap: 0.02rem;
  }
  .dashboard-cards-narrow .card h3 {
    font-size: 0.68rem;
    line-height: 1.1;
  }
  .dashboard-cards-narrow .card .big {
    font-size: 0.98rem;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-height: 0;
  }
  .dashboard-cards-narrow .card-hint,
  .dashboard-cards-narrow a.card-link .card-hint {
    font-size: 0.6rem;
    margin-top: 0;
  }
  /* Escritorio: título y pista hasta 2 líneas dentro del botón compacto */
  .dashboard-cards-narrow a.card-link {
    height: auto;
    min-height: 3.2rem;
    max-height: none;
  }
  .dashboard-cards-narrow .card h3 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.12;
    hyphens: auto;
  }
  .dashboard-cards-narrow a.card-link .card-hint,
  .dashboard-cards-narrow .card-hint {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: unset;
    line-height: 1.1;
  }
  table th,
  table td {
    /* Filas lo más compactas posible en escritorio, mismas en todos los módulos */
    padding: 0.18rem 0.38rem;
    font-size: 0.8rem;
  }
  /* Tablas en escritorio: ancho completo, columnas auto y texto visible */
  .content .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
  }
  .content table th,
  .content table td {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
  }
  .content table .col-nowrap,
  .content table .col-num,
  .content table td .btn,
  .content table td .badge,
  .content table .actions,
  .content table td.actions-cell {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }
  /* Movimientos internos (restaurante): hoja electrónica con columnas fijas */
  .content #miListTable.mi-sheet-table {
    table-layout: fixed !important;
    width: 100% !important;
  }
  .content #miListTable.mi-sheet-table th,
  .content #miListTable.mi-sheet-table td {
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
    white-space: normal;
  }
  body.page-mi-staff .content #miListTable.mi-sheet-table th,
  body.page-mi-staff .content #miListTable.mi-sheet-table td {
    overflow: hidden !important;
    text-overflow: ellipsis;
  }
  body.page-mi-staff .content #miListTable.mi-sheet-table .mi-c-act {
    overflow: visible !important;
  }
  .content #miListTable.mi-sheet-table .mi-c-num,
  .content #miListTable.mi-sheet-table .mi-c-type,
  .content #miListTable.mi-sheet-table .mi-c-del,
  .content #miListTable.mi-sheet-table .mi-c-qty,
  .content #miListTable.mi-sheet-table .mi-c-stock,
  .content #miListTable.mi-sheet-table .mi-c-st {
    white-space: nowrap !important;
  }
  .content #miListTable.mi-sheet-table .mi-c-act {
    white-space: nowrap !important;
    max-width: none !important;
  }
  .content #miListTable.mi-sheet-table .mi-c-prod,
  .content #miListTable.mi-sheet-table .mi-c-route {
    white-space: normal !important;
    word-break: break-word;
  }
  /* Columna de casilla: ancho mínimo para que sea visible */
  .content table th:first-child:has(input[type="checkbox"]),
  .content table td:first-child:has(input[type="checkbox"]) {
    min-width: 2rem;
    width: 2rem;
  }
  .content table th:last-child,
  .content table td:last-child {
    max-width: none;
    min-width: 0;
  }
  .content table .actions,
  .content table td.actions-cell,
  .content table td:last-child .btn {
    white-space: nowrap;
  }
  /* Filas de filtros y formularios en una sola línea en escritorio */
  .content .filter-row {
    flex-wrap: nowrap;
  }
  .content .orders-filters .filter-row {
    flex-wrap: nowrap;
  }
  .form-group {
    margin-bottom: 0.35rem;
  }
  .form-group label {
    margin-bottom: 0.15rem;
  }
  .form-group input,
  .form-group select {
    padding: 0.32rem 0.45rem;
    font-size: 0.85rem;
  }
  .mb1 {
    margin-bottom: 0.5rem;
  }
  .sidebar {
    padding: 0.65rem;
  }
  .sidebar .user-info {
    margin: 0 0 0.65rem;
    padding-bottom: 0.65rem;
    font-size: 0.8rem;
  }
  .sidebar-nav a {
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
  }
  .sidebar-nav a .material-icons {
    font-size: 18px;
  }
  button,
  .btn {
    padding: 0.38rem 0.8rem;
    font-size: 0.85rem;
  }
  .btn-sm {
    padding: 0.28rem 0.5rem;
    font-size: 0.8rem;
  }
  .modal-content {
    padding: 0.75rem;
  }
  .modal-header {
    margin-bottom: 0.6rem;
  }
  .modal-header h3 {
    font-size: 1rem;
  }
  .modal-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }
  .modal-close {
    font-size: 1.35rem;
  }
  .valorizacion-bar-wrap {
    margin-bottom: 0.5rem;
  }
  .valorizacion-bar {
    height: 18px;
    margin-bottom: 0.3rem;
  }
  .valorizacion-bar-leyenda {
    font-size: 0.75rem;
    gap: 0.5rem 1rem;
  }
  .valorizacion-dot {
    width: 8px;
    height: 8px;
  }
  .msg {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.6rem;
    font-size: 0.82rem;
  }
  .dropdown-item {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }
  .list-simple li {
    padding: 0.28rem 0;
    font-size: 0.85rem;
  }
  .filter-tab {
    padding: 0.35rem 0.7rem !important;
    font-size: 0.85rem;
  }
  .filter-badge {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
  }
  .dashboard-links {
    margin-top: 0.6rem;
    font-size: 0.85rem;
  }
  .bar-row {
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
  }
  .bar-track {
    height: 16px;
  }
  .detail-table th,
  .detail-table td {
    padding: 0.28rem 0.4rem;
    font-size: 0.8rem;
  }
  .form-grid-2 {
    gap: 0.35rem 0.75rem;
  }
  .form-actions {
    margin-top: 0.15rem;
  }
  .global-search-input {
    padding: 0.32rem 0.5rem 0.32rem 1.75rem;
    font-size: 0.85rem;
  }
  .app-bar-title {
    font-size: 1.1rem;
  }
  .app-bar-user .user-name {
    font-size: 0.85rem;
  }
}

/* ========== Responsive: móviles (todo el sitio) ========== */
@media (max-width: 768px) {
  /* App bar y navegación */
  .app-bar {
    height: auto;
    min-height: 52px;
    padding: 0.45rem 0.65rem;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    padding-top: max(0.45rem, env(safe-area-inset-top, 0px));
    flex-wrap: nowrap;
    gap: 0.35rem 0.5rem;
    align-items: center;
  }
  .menu-toggle {
    order: 0;
    flex-shrink: 0;
  }
  .app-bar-title {
    order: 1;
    margin-left: 0;
    flex-shrink: 0;
  }
  .app-bar-user {
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }
  .global-search-mobile-toggle {
    display: inline-flex;
    order: 1;
    flex-shrink: 0;
  }
  .global-search-wrap {
    display: none !important;
    margin-left: 0;
    max-width: none;
  }
  body.gs-mobile-open .global-search-wrap {
    display: flex !important;
    position: fixed;
    inset: 0;
    z-index: 2500;
    flex-direction: column;
    align-items: stretch;
    padding: max(2.85rem, calc(env(safe-area-inset-top, 0px) + 2.35rem)) max(0.65rem, env(safe-area-inset-right, 0px)) max(0.65rem, env(safe-area-inset-bottom, 0px)) max(0.65rem, env(safe-area-inset-left, 0px));
    background: #f5f8fb;
    gap: 0.5rem;
  }
  body.gs-mobile-open .global-search-mobile-close {
    display: inline-flex;
    position: absolute;
    top: max(0.55rem, env(safe-area-inset-top, 0px));
    left: max(0.55rem, env(safe-area-inset-left, 0px));
    z-index: 2;
  }
  body.gs-mobile-open .global-search-input {
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.75rem 0.55rem 2.75rem;
    color: #1a2332;
    background: #fff;
    border: 1px solid #cfd8dc;
    box-shadow: 0 2px 8px rgba(13, 27, 42, 0.08);
  }
  body.gs-mobile-open .global-search-input::placeholder {
    color: #78909c;
  }
  body.gs-mobile-open .global-search-wrap .global-search-icon {
    left: 2.85rem;
    color: #546e7a;
  }
  body.gs-mobile-open .global-search-results {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(13, 27, 42, 0.1);
  }
  body.gs-mobile-open .global-search-results.gs-has-nav {
    min-width: 0;
    max-height: none;
  }
  body.gs-mobile-open .global-search-results.gs-has-elevator,
  body.gs-mobile-open .global-search-results.gs-has-nav.gs-has-elevator {
    max-height: none;
  }
  body.gs-mobile-open .gs-nav {
    width: 7.5rem;
    max-width: 34%;
  }
  .app-bar-title span:not(.material-icons) { display: none; }
  .app-bar-user .user-name { display: none; }
  .audit-density-toggle-header { display: none; }
  .sidebar { width: 100%; max-width: 300px; }

  /* Contenido: textos y espaciado */
  body { font-size: 15px; }
  .content {
    padding: 0.75rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }
  .content h2 {
    font-size: 1rem;
    margin: 0.75rem 0 0.45rem;
    color: var(--text-primary);
    font-weight: 600;
  }
  /* Móvil: sin barra azul de título — mismo texto, estilo de encabezado plano */
  .content > h2:first-of-type,
  .content .calidad-page > h2:first-of-type {
    margin: 0 0 0.65rem;
    padding: 0.35rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    background: none;
    box-shadow: none;
    border-radius: 0;
  }
  .content > h2:first-of-type a,
  .content .calidad-page > h2:first-of-type a {
    color: var(--blue);
  }
  .content > h2:first-of-type a:hover,
  .content .calidad-page > h2:first-of-type a:hover {
    color: #125ea2;
  }
  .content h3 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
    color: var(--text-primary);
  }
  .content h4 {
    font-size: 0.95rem;
    margin: 0.5rem 0 0.35rem;
    color: var(--text-secondary);
  }
  .muted,
  .filter-badge,
  .card-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  .filter-tabs {
    gap: 0.45rem;
    padding: 0.45rem 0.5rem;
  }
  a.filter-tab,
  .filter-tabs a.filter-tab {
    font-size: 0.92rem;
    padding: 0.45rem 0.75rem;
    font-weight: 500;
  }

  /* Grids: una columna o columnas más estrechas para mejor lectura */
  .cards {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-bottom: 1rem;
  }
  .cards.dashboard-cards.dashboard-cards-narrow {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow-x: visible;
    gap: 0.35rem;
  }
  /* Indicadores compactos: un poco más altos y texto más legible */
  .dashboard-cards-narrow a.card-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    flex: unset;
    width: auto;
    min-width: 0;
    height: 4rem;
    min-height: 4rem;
    max-height: 4rem;
    overflow: hidden;
    padding: 0.28rem 0.4rem;
    gap: 0.08rem;
  }
  .dashboard-cards-narrow .card h3 {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.12;
    margin: 0 0 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dashboard-cards-narrow .card .big {
    flex: none;
    display: block;
    min-height: 0;
    font-size: 1.22rem;
    font-weight: 700;
    line-height: 1.05;
    margin: 0;
  }
  .dashboard-cards-narrow a.card-link .card-hint {
    font-size: 0.76rem;
    line-height: 1.1;
    margin: 0.02rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .form-grid-2,
  .orders-filters {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .perm-grid {
    grid-template-columns: 1fr;
  }
  .restaurantes-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .valorizacion-bar-leyenda {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.75rem;
  }

  /* Tablas */
  table th,
  table td {
    font-size: 0.8rem;
    padding: 0.35rem 0.4rem;
  }
  /* Tablas en movil (global):
     - evita texto montado/entreverado
     - permite lectura completa
     - habilita scroll horizontal cuando haya muchas columnas */
  .content .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content table {
    width: max-content;
    min-width: 100%;
    table-layout: auto !important;
    border-collapse: collapse;
  }
  .content table th,
  .content table td {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    vertical-align: top;
    max-width: none !important;
  }
  .content table .col-truncate,
  .content table .col-nowrap {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .content table .col-num {
    white-space: nowrap !important;
    text-align: right;
  }
  /* Mov. internos restaurante: mantener hoja fija en móvil (no table-layout auto) */
  .content #miListTable.mi-sheet-table {
    width: auto !important;
    min-width: 652px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }
  .content #miListTable.mi-sheet-table th,
  .content #miListTable.mi-sheet-table td {
    line-height: 1.08 !important;
    padding: 0.12rem 0.2rem !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .content #miListTable.mi-sheet-table .mi-c-act,
  .content #miListTable.mi-sheet-table td.mi-c-act {
    overflow: visible !important;
    text-overflow: clip !important;
    max-height: none !important;
    min-width: 6.75rem !important;
  }
  .content #miListTable.mi-sheet-table .mi-c-act .mi-act-compact {
    overflow: visible !important;
    text-overflow: clip !important;
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    min-width: max-content;
  }
  .content #miListTable.mi-sheet-table .mi-act-pdf,
  .content #miListTable.mi-sheet-table .mi-act-pdf .bodega-brand-icon {
    flex-shrink: 0;
  }
  /* Bodeguero / gerencia: tabla mov. internos legible en móvil (no comprimir como restaurante) */
  body.page-mi-staff .content #miListTable.mi-list-table--staff {
    width: max-content !important;
    min-width: 728px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }
  body.page-mi-staff .content #miListTable.mi-list-table--staff th,
  body.page-mi-staff .content #miListTable.mi-list-table--staff td {
    padding: 0.4rem 0.45rem !important;
    line-height: 1.25 !important;
    max-height: none !important;
    height: auto !important;
    font-size: 0.8rem !important;
  }
  body.page-mi-staff .content #miListTable.mi-list-table--staff thead th {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  body.page-mi-staff .content #miListTable.mi-list-table--staff td.mi-c-act {
    overflow: visible !important;
    text-overflow: clip !important;
    min-width: 7rem !important;
  }
  .content table td .btn,
  .content table td .badge,
  .content table .actions,
  .content table td.actions-cell {
    white-space: nowrap !important;
  }
  .detail-table th,
  .detail-table td {
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
  }

  /* Formularios */
  .form-group label { font-size: 0.85rem; color: var(--text-secondary); }
  .form-group input,
  .form-group select {
    font-size: 0.9rem;
    padding: 0.4rem 0.5rem;
  }
  .form-group input[type="number"],
  .form-group input[type="tel"],
  .form-group input[type="email"] {
    max-width: 100%;
  }

  /* Login móvil: mismo estilo claro que escritorio (gris-azul suave + tarjeta blanca) */
  .login-page {
    align-items: center;
    justify-content: center;
    padding: max(1.25rem, env(safe-area-inset-top, 12px)) 1rem max(1.5rem, env(safe-area-inset-bottom, 12px));
    min-height: 100dvh;
    background: var(--gradient-page-bg);
  }
  .login-box {
    background: var(--bg-card);
    border: var(--border-card);
    box-shadow: var(--shadow-card-hover);
    padding: 2rem 1.5rem;
    border-radius: var(--radius-shell);
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
  }
  .login-box h1 {
    color: var(--text-primary);
    text-shadow: none;
    margin-bottom: 1.35rem;
    font-size: 1.25rem;
  }
  .login-box .form-group label {
    color: var(--text-secondary);
    font-weight: 500;
  }
  .login-box .form-group input[type="email"],
  .login-box .form-group input[type="password"] {
    width: 100%;
    max-width: none;
    background: var(--white);
    border: 1px solid rgba(189, 189, 189, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
  }
  .login-box .form-group input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.25);
  }
  .login-logo-wrap {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-card);
  }
  .login-box .error {
    color: var(--danger);
    background: #ffebee;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-input);
    margin-bottom: 0.85rem;
    font-size: 0.88rem;
    border: 1px solid rgba(198, 40, 40, 0.2);
  }
  .login-box .hint {
    color: var(--text-secondary);
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.78rem;
    line-height: 1.45;
  }
  .login-box button[type="submit"] {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.35);
  }

  /* Cards y modales */
  .card {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
  }
  .card h3 { font-size: 0.85rem; }

  /* Modales — móvil vertical compacto (todas las ventanas flotantes) */
  .modal {
    align-items: flex-start;
    justify-content: center;
    padding: max(0.25rem, env(safe-area-inset-top, 0px)) max(0.25rem, env(safe-area-inset-right, 0px)) max(0.25rem, env(safe-area-inset-bottom, 0px)) max(0.25rem, env(safe-area-inset-left, 0px));
  }
  .modal:has(.lightbox-content) {
    align-items: center;
    padding: 0.5rem;
  }
  .modal-content {
    width: 100% !important;
    max-width: calc(100vw - 0.5rem) !important;
    max-height: calc(100dvh - 0.5rem);
    margin: 0;
    padding: 0.4rem 0.45rem;
    overflow: auto;
    border-radius: 10px;
    display: block;
  }
  .modal-content.product-info-modal-content {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
  }
  .modal .product-info-modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal .pinfo-modal-head {
    flex-shrink: 0;
  }
  .modal .pinfo-edit-btn,
  .modal .pinfo-modal-head-actions .btn-act-icon {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 2.75rem !important;
    min-height: 2.75rem !important;
  }
  .modal .pinfo-edit-btn .material-icons {
    font-size: 1.5rem !important;
    color: #fff !important;
  }
  .modal-content.modal-lg,
  .invoice-modal-scroll,
  .order-detail-modal-scroll,
  .sal-detail-modal-content,
  .detalle-content {
    width: 100% !important;
    max-width: calc(100vw - 0.5rem) !important;
    max-height: calc(100dvh - 0.5rem);
    margin: 0;
  }
  .modal-header {
    position: static;
    top: auto;
    z-index: 1;
    margin: 0 0 0.3rem;
    padding: 0 0 0.3rem;
    background: transparent;
    border-bottom: 1px solid var(--border, #e8eaed);
    border-radius: 0;
    gap: 0.35rem;
  }
  .modal-header h3 {
    font-size: 0.92rem;
    line-height: 1.15;
    font-weight: 600;
  }
  .modal-close {
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
  }
  .modal-body {
    padding: 0 !important;
    flex: none;
    max-height: none !important;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  .modal-content > form,
  .modal-content [id$="Body"] {
    padding: 0;
  }
  .modal-footer {
    position: static;
    bottom: auto;
    z-index: 1;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.35rem 0 0;
    padding: 0.35rem 0 0;
    background: transparent;
    border-top: 1px solid var(--border, #e8eaed);
    border-radius: 0;
  }
  .modal-footer .btn,
  .modal-footer button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.38rem 0.55rem;
    font-size: 0.82rem;
    justify-content: center;
  }
  .modal-content p {
    margin: 0.12rem 0;
    line-height: 1.22;
    font-size: 0.78rem;
  }
  .modal-content h4,
  .modal-body h4 {
    margin: 0.3rem 0 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
  }
  .modal-content strong,
  .modal-body strong {
    font-weight: 600;
  }
  .modal-content .form-group {
    margin-bottom: 0.4rem;
  }
  .modal-content .form-group label {
    font-size: 0.72rem;
    margin-bottom: 0.1rem;
  }
  .modal-content .form-group input,
  .modal-content .form-group select,
  .modal-content .form-group textarea {
    padding: 0.32rem 0.4rem;
    font-size: 0.82rem;
  }
  .modal-content .form-grid-2 {
    gap: 0.35rem 0.5rem;
  }
  .modal-content .form-actions {
    margin-top: 0.35rem;
    gap: 0.25rem;
  }
  .modal-content table {
    min-width: 520px;
  }
  .modal-content .detail-table th,
  .modal-content .detail-table td {
    padding: 0.24rem 0.35rem !important;
    font-size: 0.76rem;
  }

  /* Paneles de detalle compactos en modales */
  .modal-summary,
  .order-detail-summary,
  .invoice-detail-grid,
  .report-detail-grid,
  .sal-detail-grid {
    display: block;
    gap: 0;
    padding: 0;
    margin: 0 0 0.35rem;
    border: 1px solid #e3e7eb;
    border-radius: 8px;
    background: #f8fafb;
    overflow: hidden;
  }
  .modal-summary-line,
  .order-detail-line,
  .invoice-detail-field {
    display: grid;
    grid-template-columns: 5.4rem minmax(0, 1fr);
    gap: 0.3rem;
    padding: 0.22rem 0.45rem;
    border-bottom: 1px solid #ebeef1;
    align-items: center;
    margin: 0;
  }
  .modal-summary-line:last-child,
  .order-detail-line:last-child,
  .invoice-detail-field:last-child {
    border-bottom: none;
  }
  .modal-summary-label,
  .order-detail-label,
  .invoice-detail-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #546e7a;
    line-height: 1.15;
  }
  .modal-summary-value,
  .order-detail-value,
  .invoice-detail-value {
    font-size: 0.76rem;
    line-height: 1.2;
    text-align: left;
  }
  .order-detail-value .badge,
  .invoice-detail-value .badge {
    font-size: 0.68rem;
    padding: 0.06rem 0.3rem;
    line-height: 1.15;
  }
  .sal-detail-grid p {
    margin: 0;
    padding: 0.22rem 0.45rem;
    border-bottom: 1px solid #ebeef1;
    font-size: 0.76rem;
    line-height: 1.22;
  }
  .sal-detail-grid p:last-child {
    border-bottom: none;
  }
  .order-detail-section,
  .invoice-detail-section-title,
  .invoice-detail-photo {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
  }
  .order-detail-section-title,
  .invoice-detail-section-title {
    font-size: 0.72rem;
    margin-bottom: 0.15rem;
  }
  .review-alert {
    margin: 0 0 0.35rem;
    padding: 0.35rem 0.45rem;
    gap: 0.35rem;
  }
  .review-alert strong { font-size: 0.8rem; }
  .review-alert span { font-size: 0.74rem; }
  .report-detail-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 0 0 0.25rem;
    margin-bottom: 0.35rem;
    gap: 0.35rem;
  }
  .report-detail-title { font-size: 0.88rem; line-height: 1.2; }
  .report-detail-subtitle { font-size: 0.76rem; margin-top: 0.05rem; word-break: break-word; }
  .report-detail-chip {
    align-self: flex-start;
    white-space: normal;
    max-width: 100%;
    line-height: 1.25;
  }
  /* Modales detalle OCI / lote / recepción — encabezado */
  #orderDetailModal .modal-content.modal-lg,
  #receptionDetailModal .modal-content.modal-lg,
  #lotDetailModal .modal-content.modal-lg,
  #lotDetailModal .lot-detail-modal,
  .bodega-trace-modal .modal-content,
  .facturas-detail-modal {
    width: 100% !important;
    max-width: calc(100vw - 0.5rem) !important;
    box-sizing: border-box;
  }
  .modal-header {
    flex-wrap: nowrap;
    align-items: flex-start;
    min-width: 0;
  }
  .modal-header h3,
  .modal-header .facturas-detail-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
    padding-right: 0.25rem;
  }
  .modal-header .modal-close {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: -0.1rem;
  }
  .det-meta {
    gap: 0.15rem 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
  }
  .det-traza {
    margin-bottom: 0.35rem;
    padding-left: 0.5rem;
  }
  .det-traza-row {
    padding: 0.15rem 0;
    font-size: 0.76rem;
  }
  .det-notes {
    margin-bottom: 0.35rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.76rem;
  }
  .det-grid .dg-head {
    padding: 0.22rem 0.4rem;
    font-size: 0.72rem;
  }
  .det-grid > div:not(.dg-head) {
    padding: 0.2rem 0.4rem;
    font-size: 0.74rem;
  }
  .lightbox-content {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 100%;
  }

  .order-detail-items th,
  .order-detail-items td {
    padding: 0.28rem 0.35rem;
    font-size: 0.78rem;
  }

  /* Botones y mensajes — móvil: texto e iconos más legibles */
  button, .btn { padding: 0.52rem 1rem; font-size: 0.95rem; }
  .btn-sm { padding: 0.42rem 0.7rem; font-size: 0.9rem; }
  .btn .material-icons,
  .btn-sm .material-icons,
  button > .material-icons {
    font-size: 24px;
    vertical-align: middle;
    line-height: 1;
  }
  .msg { font-size: 0.85rem; padding: 0.45rem 0.6rem; }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
  body { font-size: 14px; }
  .content {
    padding: 0.5rem 0.65rem;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }
  .content h2 { font-size: 0.95rem; margin: 0.65rem 0 0.4rem; }
  .content > h2:first-of-type,
  .content .calidad-page > h2:first-of-type {
    font-size: 1.1rem;
    padding: 0.3rem 0;
    margin-bottom: 0.5rem;
    background: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--text-primary);
  }
  .content h3 { font-size: 0.98rem; }
  .cards { gap: 0.5rem; }
  .cards.dashboard-cards.dashboard-cards-narrow {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow-x: visible;
    gap: 0.3rem;
  }
  .dashboard-cards-narrow a.card-link {
    flex: unset;
    width: auto;
    min-width: 0;
    height: 3.4rem;
    min-height: 3.4rem;
    max-height: 3.4rem;
    padding: 0.2rem 0.3rem;
    gap: 0.05rem;
  }
  .dashboard-cards-narrow .card h3 {
    font-size: 0.7rem;
  }
  .dashboard-cards-narrow .card .big {
    font-size: 1.06rem;
  }
  .dashboard-cards-narrow a.card-link .card-hint {
    font-size: 0.63rem;
  }
  table th, table td { font-size: 0.78rem; padding: 0.28rem 0.35rem; }
  .form-group input, .form-group select { font-size: 0.85rem; padding: 0.35rem 0.45rem; }
  .card { padding: 0.5rem 0.6rem; }
  .modal { padding: max(0.2rem, env(safe-area-inset-top, 0px)) max(0.2rem, env(safe-area-inset-right, 0px)) max(0.2rem, env(safe-area-inset-bottom, 0px)) max(0.2rem, env(safe-area-inset-left, 0px)); }
  .modal-content {
    padding: 0.35rem 0.4rem;
    max-width: calc(100vw - 0.4rem) !important;
    max-height: calc(100dvh - 0.4rem);
  }
  .modal-header {
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
  }
  .modal-footer {
    margin-top: 0.3rem;
    padding-top: 0.3rem;
  }
  .modal-summary-line,
  .order-detail-line,
  .invoice-detail-field {
    grid-template-columns: 4.8rem minmax(0, 1fr);
    padding: 0.18rem 0.4rem;
  }
  button, .btn { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
  .order-detail-value.recepcion-ok { color: #1565c0; }
  .order-detail-value.recepcion-parcial { color: #e65100; }
  .restaurantes-grid { gap: 0.5rem; }
  .rest-card { padding: 0.6rem 0.8rem; }
  .rest-card-title { font-size: 0.95rem; }
  .rest-card-meta, .rest-card-stats { font-size: 0.78rem; }
}
.kardex-link,
.kardex-lot-link,
.kardex-ref-link {
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
}
.kardex-lot-link:hover,
.kardex-ref-link:hover { color: var(--accent-hover); }
.kardex-highlight { background: #fff9c4 !important; }
.perm-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.perm-access-summary {
  flex: 1 1 220px;
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.4rem 1.2rem;
  margin-top: 0.25rem;
  flex: 1 1 260px;
}
.checkbox-inline {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox-inline input[type="checkbox"] {
  margin: 0;
}
@media (max-width: 768px) {
  .perm-layout {
    flex-direction: column;
  }
  .perm-grid {
    grid-template-columns: 1fr;
  }
}

/* Restaurantes: tarjetas minimizadas con movimiento */
.restaurantes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.rest-card {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
/* Tarjetas restaurante: mismo tratamiento visual que el hub (van con .card) */
.card.rest-card {
  transition: box-shadow .2s, transform .15s, border-color .15s;
}
.card.rest-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(25, 118, 210, 0.22);
  transform: translateY(-1px);
}
.rest-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.rest-code-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  color: #1565c0;
  letter-spacing: 0.05em;
}
.rest-code {
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 0.25rem;
}
.rest-card-meta {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.3;
}
.rest-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.rest-stat {
  white-space: nowrap;
}
.rest-stat strong {
  color: var(--text-primary);
  margin-right: 0.2rem;
}
.rest-card .btn {
  align-self: flex-start;
  margin-top: 0.25rem;
}

.dashboard-bars { margin-top: 0.5rem; }
.bar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-primary); }
.bar-label { min-width: 100px; }
.bar-track { flex: 1; height: 20px; background: rgba(189, 189, 189, 0.45); border-radius: 10px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(180deg, #42a5f5 0%, #1976d2 55%, #1565c0 100%);
  border-radius: 10px;
  transition: width 0.3s;
}
.bar-value { min-width: 2rem; text-align: right; color: var(--text-secondary); }
.muted { color: var(--text-secondary) !important; }
.list-simple { list-style: none; padding: 0; margin: 0; }
.list-simple a { color: var(--blue); text-decoration: none; }
.list-simple a:hover { text-decoration: underline; }
.list-simple li { color: var(--text-secondary); border-bottom: 1px solid var(--border); padding: 0.4rem 0; }
.content a:not(.btn) { color: var(--blue); text-decoration: none; }
.content a:not(.btn):hover { text-decoration: underline; }
.card-hint a { color: var(--blue); }
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  background: var(--white);
  border-radius: var(--radius-card);
  border: var(--border-card);
  box-shadow: var(--shadow-card);
}
.filter-tabs a { color: var(--text-secondary); }
.filter-tabs a.active { background: var(--blue); color: var(--white); }
.filter-tab { background: var(--gray-medium) !important; color: var(--text-primary) !important; }
.filter-tab:hover { background: var(--gray-light) !important; color: var(--blue) !important; }
.filter-tab.active { background: var(--blue) !important; color: var(--white) !important; }
.btn-sm { font-family: "Roboto", sans-serif; }
.actions .btn { margin: 0 0.15rem; }

/* Botones de acción solo ícono (tooltip = title / aria-label) */
.btn-act-icon,
a.link-act-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.22rem 0.38rem !important;
  line-height: 1;
  vertical-align: middle;
}
.btn-act-icon .material-icons,
.link-act-icon .material-icons {
  font-size: 1.2rem !important;
  margin: 0;
  vertical-align: middle;
}
.bodega-brand-icon {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.btn-act-icon--brand {
  padding: 0.18rem 0.32rem !important;
  min-width: 2.1rem;
}
.content table td .btn-act-icon,
.content table td .link-act-icon,
.content table .actions .btn-act-icon {
  margin: 0 0.12rem;
}
.content table td:last-child .btn-act-icon {
  padding: 0.2rem 0.32rem !important;
}
.content .export-toolbar,
.content .filter-row .btn-act-icon {
  margin: 0 0.1rem;
}
.content .export-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

/* Barras de filtro / selección: botones solo ícono, en línea compacta */
.content .filter-row,
.content .recep-date-filters,
.content .orders-filters,
.content .filter-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.content .filter-row .btn-act-icon,
.content .recep-date-filters .btn-act-icon,
.content .orders-filters .btn-act-icon,
.content .filter-tabs .btn-act-icon,
.content .filter-tabs a.btn-act-icon {
  flex-shrink: 0;
}
.content .filter-row .btn-act-icon.btn.danger,
.content .filter-row .btn-act-icon.btn.danger:hover {
  background: linear-gradient(180deg, #ef5350 0%, #c62828 50%, #b71c1c 100%) !important;
  color: #fff !important;
  border: none !important;
}
/* Casillas de selección en tablas: columna estrecha */
.content table th.col-check,
.content table td.col-check,
.content table th:has(input[type="checkbox"]),
.content table td:has(input[type="checkbox"]) {
  width: 2.25rem;
  min-width: 2.25rem;
  max-width: 2.5rem;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}
.content table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
/* Enlaces de acción en tablas → solo ícono */
a.link-detail.link-act-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
  text-decoration: none !important;
  color: var(--blue);
}
a.link-detail.link-act-icon:hover {
  background: var(--table-row-hover);
}

/* Móvil: íconos de acción (Editar, etc.) siempre visibles en tablas y modales */
@media (max-width: 768px) {
  .content table td:last-child,
  .content table td.actions,
  .content table td.col-f-acc,
  .content table td[class*="col-acc"],
  .content table td[class*="-acc"] {
    overflow: visible !important;
    text-overflow: clip !important;
    min-width: 2.75rem;
    vertical-align: middle !important;
  }
  .content table td .btn-act-icon,
  .content table td .link-act-icon,
  .modal .btn-act-icon,
  .modal .link-act-icon {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 2.35rem;
    min-height: 2.35rem;
    flex-shrink: 0;
    padding: 0.28rem 0.4rem !important;
  }
  .content table td .btn-act-icon .material-icons,
  .content table td .link-act-icon .material-icons,
  .modal .btn-act-icon .material-icons,
  .modal .link-act-icon .material-icons {
    font-size: 1.3rem !important;
  }
}

/* Hub Operaciones (vista compacta) */
.hub-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding-bottom: 2rem;
}
.hub-page.home-unified {
  max-width: none;
  width: 100%;
}
.content .hub-page h2.home-section-title {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.content .hub-page h2.home-section-title .material-icons {
  font-size: 22px;
  color: var(--blue);
}
/* Indicadores a ancho completo; stock y paneles debajo */
.home-unified-stats-full {
  width: 100%;
  min-width: 0;
  margin-bottom: 0.35rem;
}
.home-unified-below {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  min-width: 0;
}
/* Indicadores Inicio unificado — escritorio: forzar fila (supera grid .cards si CSS vino de caché vieja) */
@media (min-width: 769px) {
  .hub-page.home-unified .home-unified-stats-full .cards.dashboard-cards.dashboard-cards-narrow {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    grid-template-columns: unset !important;
    overflow-x: visible;
  }
  .hub-page.home-unified .home-unified-stats-full .dashboard-cards-narrow a.card-link {
    min-width: 0;
    flex: 1 1 0;
  }
}
@media (max-width: 768px) {
  /* Inicio unificado: más contenido visible en móvil */
  .hub-page.home-unified {
    padding-bottom: 0.5rem;
  }
  .hub-page.home-unified .hub-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    margin-top: 0;
  }
  .hub-page.home-unified .hub-tile {
    padding: 0.42rem 0.28rem;
    font-size: 0.82rem;
    gap: 0.22rem;
    border-radius: 10px;
    min-height: 3.45rem;
    font-weight: 600;
    line-height: 1.2;
  }
  .hub-page.home-unified .hub-tile .material-icons {
    font-size: 26px;
  }
  .content .hub-page h2.home-section-title {
    font-size: 1.02rem;
    margin-bottom: 0.35rem;
  }
  .content .hub-page h2.home-section-title .material-icons {
    font-size: 24px;
  }
  .hub-page.home-unified .hub-grid.hub-grid-stock-triple {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
  }
  .hub-page.home-unified .hub-panel {
    padding: 0.42rem 0.48rem;
  }
  .hub-page.home-unified .hub-panel-wide {
    margin-bottom: 0.4rem;
  }
  .hub-page.home-unified .hub-panel-head {
    margin-bottom: 0.3rem;
    padding-bottom: 0.28rem;
    gap: 0.25rem;
  }
  .hub-page.home-unified .hub-panel-head .hub-panel-h {
    font-size: 0.82rem;
  }
  .hub-page.home-unified .hub-panel-link {
    font-size: 0.76rem;
  }
  .hub-page.home-unified .hub-list {
    max-height: 150px;
  }
  .hub-page.home-unified .hub-list li {
    padding: 0.25rem 0;
    font-size: 0.74rem;
  }
  .hub-page.home-unified .hub-meta {
    font-size: 0.68rem;
  }
  .hub-page.home-unified .hub-repo > li {
    padding: 0.32rem 0.4rem;
    font-size: 0.74rem;
  }
  .hub-page.home-unified .hub-hint {
    font-size: 0.65rem;
  }
  .hub-page.home-unified .hub-table th,
  .hub-page.home-unified .hub-table td {
    padding: 0.24rem 0.3rem;
    font-size: 0.7rem;
  }
  /* Indicadores móvil: rejilla 3 cols (gana sobre flex !important de escritorio en este viewport) */
  .hub-page.home-unified .home-unified-stats-full .cards.dashboard-cards.dashboard-cards-narrow {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.28rem;
    overflow-x: visible;
  }
}
.hub-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.35rem;
  background: var(--gradient-page-hero);
  border-radius: var(--radius-shell);
  color: #fff;
  box-shadow: var(--shadow-hero);
}
.hub-hero-text { flex: 1 1 200px; }
.hub-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.hub-sub {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  opacity: 0.92;
  line-height: 1.35;
}
.hub-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.hub-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.52rem 0.42rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.2;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.hub-tile .material-icons {
  font-size: 22px;
  color: var(--blue);
}
.hub-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.15);
  border-color: rgba(25, 118, 210, 0.35);
  color: var(--blue);
}
.hub-tile-warn {
  border-color: rgba(245, 124, 0, 0.45);
  background: linear-gradient(180deg, #fff8e1 0%, #fff 100%);
}
.hub-tile-warn .material-icons { color: var(--warning); }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
/* Inicio unificado: tres columnas iguales (bajo mínimo · caduca 14d · reposición) */
.hub-page.home-unified .hub-grid.hub-grid-stock-triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.85rem;
}
.hub-page.home-unified .hub-grid.hub-grid-stock-triple > .hub-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.hub-page.home-unified .hub-grid.hub-grid-stock-triple .hub-list,
.hub-page.home-unified .hub-grid.hub-grid-stock-triple .hub-repo-scroll {
  flex: 1 1 auto;
  min-height: 0;
}
.hub-repo-scroll {
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.hub-panel-replenish .hub-panel-h .material-icons { color: #1565c0; }
.hub-hint-compact {
  font-size: 0.72rem;
  line-height: 1.2;
  max-width: 7.5rem;
  text-align: right;
}
@media (max-width: 1150px) and (min-width: 769px) {
  .hub-page.home-unified .hub-grid.hub-grid-stock-triple .hub-hint-compact {
    display: none;
  }
}
.hub-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: var(--border-card);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
}
.hub-panel-wide { margin-bottom: 0.85rem; }
.hub-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-light);
}
.hub-panel-head h2,
.hub-panel-head .hub-panel-h {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.hub-panel-head h2 .material-icons,
.hub-panel-head .hub-panel-h .material-icons {
  font-size: 22px;
  color: var(--blue);
}
.hub-panel-alert h2 .material-icons,
.hub-panel-alert .hub-panel-h .material-icons { color: var(--warning); }
.hub-panel-expire h2 .material-icons,
.hub-panel-expire .hub-panel-h .material-icons { color: #e65100; }
.hub-panel-link {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.hub-hint { font-size: 0.8rem; }
.hub-hint-inline { font-size: 0.74rem; margin-right: auto; }
.hub-panel-wide .hub-panel-head:has(.hub-hint-inline) {
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}
.hub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.hub-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--gray-light);
  font-size: 0.88rem;
}
.hub-list li:last-child { border-bottom: none; }
.hub-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.hub-low-main {
  flex: 1 1 140px;
  min-width: 0;
}
.hub-oci-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  color: var(--primary, #1a73e8);
  background: rgba(26, 115, 232, 0.08);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.hub-oci-icon:hover {
  background: rgba(26, 115, 232, 0.16);
  color: #0d47a1;
}
.hub-oci-icon .material-icons {
  font-size: 1.05rem !important;
}
.hub-repo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.hub-repo > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.65rem;
  background: var(--gray-light);
  border-radius: 8px;
  font-size: 0.88rem;
}
.hub-repo-name { flex: 1 1 160px; }
.hub-repo-qty {
  font-weight: 600;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}
.hub-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--gray-light);
}
.hub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.hub-table th,
.hub-table td {
  padding: 0.45rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
}
.hub-table th {
  background: var(--table-head-bg);
  font-weight: 700;
  color: var(--table-head-text);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hub-table tbody tr:nth-child(even) { background: var(--table-row-alt); }
.hub-table tbody tr:hover { background: var(--table-row-hover); }
.hub-mov-clickable { cursor: pointer; }
.hub-table tbody tr.hub-mov-clickable:hover { background: #e8f4fd; }
.hub-table td.hub-mov-dea {
  max-width: 10rem;
  white-space: normal;
  font-size: 0.72rem;
  line-height: 1.2;
  word-wrap: break-word;
}
/* Últimos movimientos (Inicio unificado): filas más bajas */
.hub-page.home-unified #hubMovTable th,
.hub-page.home-unified #hubMovTable td {
  padding: 0.18rem 0.38rem;
  font-size: 0.74rem;
  line-height: 1.12;
  vertical-align: middle;
}
.hub-page.home-unified #hubMovTable th {
  font-size: 0.65rem;
  padding: 0.16rem 0.38rem;
  line-height: 1.1;
}
@media (max-width: 600px) {
  .hub-page:not(.home-unified) .hub-hero { padding: 1rem; }
  .hub-page:not(.home-unified) .hub-title { font-size: 1.25rem; }
  .hub-page:not(.home-unified) .hub-tiles { grid-template-columns: repeat(2, 1fr); }
  .hub-page.home-unified .hub-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }
  .hub-page.home-unified .hub-tile {
    font-size: 0.78rem;
    padding: 0.4rem 0.22rem;
    min-height: 3.35rem;
  }
  .hub-page.home-unified .hub-tile .material-icons {
    font-size: 24px;
  }
  .hub-page.home-unified .hub-list {
    max-height: 132px;
  }
}
