/* Tema: paleta del icono — azul #1976D2, gris claro #E0E0E0, gris medio #BDBDBD, blanco #FFFFFF */
:root {
  --blue: #1976D2;
  --gray-light: #E0E0E0;
  --gray-medium: #BDBDBD;
  --white: #FFFFFF;
  --bg-base: #E0E0E0;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #BDBDBD;
  --text-primary: #212121;
  --text-secondary: #616161;
  --text-muted: #9e9e9e;
  --border: #BDBDBD;
  --border-accent: #1976D2;
  --accent: #1976D2;
  --accent-hover: #1565C0;
  --success: #2e7d32;
  --warning: #f57c00;
  --danger: #c62828;
  /* Sistema visual alineado con Operaciones (hub) */
  --gradient-page-bg: linear-gradient(165deg, #dfe8f2 0%, #e8eaed 42%, #eceff1 100%);
  --gradient-app-bar: linear-gradient(135deg, #1565c0 0%, #1976d2 45%, #1e88e5 100%);
  --gradient-page-hero: linear-gradient(135deg, #1565c0 0%, #1976d2 42%, #42a5f5 100%);
  --radius-shell: 14px;
  --radius-card: 12px;
  --radius-input: 10px;
  --shadow-hero: 0 6px 24px rgba(25, 118, 210, 0.26);
  --shadow-card: 0 2px 12px rgba(25, 118, 210, 0.08);
  --shadow-card-hover: 0 8px 22px rgba(25, 118, 210, 0.14);
  --border-card: 1px solid rgba(25, 118, 210, 0.14);
  --table-row-hover: #f5f9ff;
}

* { 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; }

/* 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 rgba(189, 189, 189, 0.9);
  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-wrap {
  position: relative;
  margin-left: 1rem;
  flex: 1;
  max-width: 320px;
}
.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;
}
.global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--white);
  border: var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 32px rgba(0,0,0,.14);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.5rem;
}
.global-search-results .search-group { margin-bottom: 0.5rem; }
.global-search-results .search-group strong { font-size: 0.75rem; color: var(--text-secondary); display: block; margin-bottom: 0.25rem; }
.global-search-results ul { list-style: none; margin: 0; padding: 0; }
.global-search-results a { display: block; padding: 0.4rem 0.5rem; color: var(--blue); text-decoration: none; font-size: 0.9rem; border-radius: 6px; }
.global-search-results a:hover { background: var(--gray-light); }
.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-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;
  padding: 1.75rem 2rem;
  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.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
  font-size: 0.85rem;
  color: var(--text-primary);
}
th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
tr:hover td {
  background: var(--table-row-hover);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
}
.badge.borrador { background: var(--gray-medium); color: var(--text-primary); }
.badge.enviada { background: #fff3e0; color: var(--warning); border: 1px solid var(--warning); }
.badge.aprobada { background: #e3f2fd; color: var(--blue); border: 1px solid var(--blue); }
.badge.rechazada { background: #ffebee; color: var(--danger); border: 1px solid var(--danger); }
.badge.parcial { background: #f3e5f5; color: #7b1fa2; border: 1px solid #7b1fa2; }
.badge.completa { background: #e8f5e9; color: var(--success); border: 1px solid var(--success); }
.badge.completada { background: #e8f5e9; color: var(--success); border: 1px solid var(--success); }
.badge.pendiente { background: var(--gray-medium); color: var(--text-primary); }
.badge.bajo-minimo { background: var(--gray-light); color: var(--warning); border: 1px solid var(--gray-medium); }
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; }
.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;
}
.modal-content {
  background: var(--white);
  padding: 1rem;
  border-radius: var(--radius-shell);
  width: 100%;
  max-width: 420px;
  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: 280px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
#barcodeScanner video,
#barcodeScanner canvas {
  width: 100% !important;
  height: auto !important;
  min-height: 240px;
  display: block;
  object-fit: cover;
}
#barcodeScanner canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.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 { max-width: 560px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.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; }
.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(--gray-light); color: var(--text-secondary); }

/* Layout compacto para escritorio (Windows, más información en pantalla) */
@media (min-width: 769px) {
  .app-bar {
    height: 52px;
    padding: 0 0.75rem;
  }
  .content {
    padding: 0.75rem 1rem;
  }
  .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 contenido: una fila = una línea en pantalla (ajuste al ancho del computador) */
  .content .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }
  .content table th,
  .content table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
  }
  /* Excepción: tablas OCI, facturas, recepciones y productos muestran texto completo y casillas de selección */
  .content .orders-table,
  .content #facturasTable,
  .content #receivedTable,
  .content #productsTable {
    table-layout: auto;
  }
  .content .orders-table th,
  .content .orders-table td,
  .content #facturasTable th,
  .content #facturasTable td,
  .content #receivedTable th,
  .content #receivedTable td,
  .content #productsTable th,
  .content #productsTable td {
    overflow: visible;
    text-overflow: clip;
    max-width: none;
  }
  /* 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;
  }
  /* Móvil: ocultar buscador global (sigue disponible en escritorio) */
  .global-search-wrap {
    display: none !important;
  }
  .app-bar-title span:not(.material-icons) { display: none; }
  .app-bar-user .user-name { 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;
  }
  .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%;
  }

  /* Cards y modales */
  .card {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
  }
  .card h3 { font-size: 0.85rem; }
  .modal-content { width: 95%; max-width: none; margin: 0.5rem; }
  .modal-content.modal-lg { max-width: none; }
  .modal-header h3 { font-size: 1rem; }
  .modal-footer { flex-wrap: wrap; gap: 0.4rem; }

  /* 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; }

  /* Informe detalle OCI: grid más estrecho en móvil */
  .order-detail-report { font-size: 0.85rem; }
  .order-detail-meta {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
  }
  .order-detail-label { font-size: 0.7rem; }
  .order-detail-value { font-size: 0.8rem; }
  .order-detail-main {
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.4rem 0;
    margin-bottom: 0.5rem;
  }
  .order-detail-row { min-width: 0; }
  .order-detail-items th,
  .order-detail-items td {
    padding: 0.28rem 0.35rem;
    font-size: 0.78rem;
  }
  .order-detail-section-title { font-size: 0.75rem; }
}

/* 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-content { width: 98%; margin: 0.35rem; }
  button, .btn { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
  .order-detail-meta { grid-template-columns: 1fr; gap: 0.35rem; }
  .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 {
  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; }

/* Hub Operaciones (vista compacta) */
.hub-page {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 2rem;
}
.hub-page.home-unified {
  max-width: 1280px;
}
.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;
  }
  /* Móvil: ocultar bloque azul hero (título/subtítulo) bajo la barra superior */
  .hub-page.home-unified .hub-hero {
    display: none;
  }
  .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.55rem 0.35rem;
    font-size: 0.82rem;
    gap: 0.28rem;
    border-radius: 10px;
    min-height: 4.1rem;
    font-weight: 600;
    line-height: 1.2;
  }
  .hub-page.home-unified .hub-tile .material-icons {
    font-size: 30px;
  }
  .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.65rem;
  margin-bottom: 1.25rem;
}
.hub-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.85rem 0.5rem;
  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.78rem;
  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: 26px;
  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-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: #fafafa;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hub-table tbody tr:hover { background: #f5f9ff; }
.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.5rem 0.28rem;
    min-height: 3.95rem;
  }
  .hub-page.home-unified .hub-tile .material-icons {
    font-size: 28px;
  }
  .hub-page.home-unified .hub-list {
    max-height: 132px;
  }
}
