@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;700&display=swap');
@import url('btn-neon-border.css');

:root {
  --bg: #f4f6fa;
  --text: #333;
  --primary: #3a7bd5;
  --primary-dark: #2f69b3;
  --white: #fff;
  --radius: 12px;
  --transition: 0.25s ease;
}

/* RESET */
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Segoe UI',sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }

/* TOP CONTROLS */
.top-controls {
  display:flex;
  justify-content:center;
  gap:1rem;
  padding:1rem 0;
}
.top-controls button {
  width:50px;
  height:50px;
  border:none;
  border-radius:50%;
  background:var(--white);
  cursor:pointer;
  font-size:1.5rem;
  box-shadow:0 5px 15px rgba(0,0,0,0.2);
  transition:transform var(--transition), background var(--transition), color var(--transition);
}
.top-controls button:hover {
  transform:scale(1.1);
  background:var(--primary);
  color:var(--white);
}

/* CONTENEDOR */
.container {
  max-width:1200px;
  margin:0 auto;
  padding:1rem;
}

.app-wide {
  max-width: 98vw !important;
}

.nuevaorden-container {
  max-width: 98vw;
  margin: 0 auto;
  width: 100%;
}

/* ENCABEZADO */
h1 { text-align:center; margin-bottom:2rem; font-size:2rem; }

/* BOTONERA ICONOS */
.botonera {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:1.5rem;
  margin-bottom:2rem;
}
.botonera a {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  background:var(--white);
  color:var(--text);
  border-radius:var(--radius);
  width:180px;
  height:180px;
  box-shadow:0 6px 12px rgba(0,0,0,0.1);
  transition:transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.botonera a svg { width:60px; height:60px; margin-bottom:10px; transition:transform var(--transition); }
.botonera a:hover { background:var(--primary); color:var(--white); transform:translateY(-5px); box-shadow:0 10px 25px rgba(0,0,0,0.2); }
.botonera a:hover svg { transform:scale(1.1); }

/* TABLAS */
.table-responsive { overflow-x:auto; }
table.table {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border-radius:var(--radius);
  box-shadow:0 8px 20px rgba(0,0,0,0.05);
  background:var(--white);
}
table.table th, table.table td {
  padding:0.5rem 0.8rem;
  text-align:left;
  color:var(--text);
}
table.table thead tr { background:#f1f5f9; font-weight:600; }
table.table tbody tr:hover { background:#e9f0ff; cursor:pointer; }

/* DARK MODE */
body.dark-mode {
  --bg:#1e1e2f;
  --text:#f4f4f5;
  --primary:#4a90e2;
  --primary-dark:#357ABD;
  --white:#222;
  background-color:var(--bg);
  color:var(--text);
}
body.dark-mode .top-controls button { background:var(--white); color:var(--primary); }
body.dark-mode .botonera a { background:#2c2c3e; color:var(--text); }
body.dark-mode .botonera a:hover { background:var(--primary); color:var(--white); }

body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  background-color: #2a2a3c !important;
  border-color: #4a4a6a !important;
  color: #f1f1f1 !important;
}

body.dark-mode .form-control::placeholder {
  color: #bbbbe0 !important;
}

/* FIX TABLAS DARK MODE */
body.dark-mode table.table {
  background-color: #1c1c1c;
  color: #f5f5f5;
  border-color: #444;
}
body.dark-mode table.table th {
  background-color: #2a2a2a !important;
  color: #ffffff;
  font-weight: 600;
}
body.dark-mode table.table td {
  background-color: #1c1c1c;
  color: #e0e0e0;
}
body.dark-mode table.table tbody tr:hover { background-color: #333 !important; }
body.dark-mode table.table tbody tr { border-bottom: 1px solid #444; }

/* MODAL NUEVO CLIENTE */
.custom-modal {
  border-radius: 18px;
  border: none;
  background: var(--white);
  box-shadow: 0px 8px 25px rgba(0, 0, 0, 0.2);
}
.custom-modal-header {
  border-bottom: none;
  padding: 1rem 1.5rem;
}
.custom-modal-header h5 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.custom-modal-body {
  padding: 1rem 1.5rem;
}
.cliente-form-compact .mb-3 {
  margin-bottom: 0.65rem !important;
}
.cliente-form-compact .form-label {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}
.cliente-campo-frecuencias {
  margin-bottom: 0.5rem !important;
}
.cliente-campo-frecuencias .form-label {
  font-size: 0.82rem;
  margin-bottom: 0.1rem;
}
.cliente-campo-frecuencias .form-control {
  font-size: 0.88rem;
  padding: 0.3rem 0.55rem;
  min-height: 1.85rem;
}
.ux-col-frecuencias {
  max-width: 7.5rem;
  font-size: 0.82rem;
  line-height: 1.25;
}
.ux-col-cuit {
  max-width: 9rem;
  font-size: 0.88rem;
  white-space: nowrap;
}
.custom-input {
  border-radius: 12px;
  border: 1px solid #d0d0d0;
  background-color: #fafafa;
  transition: all 0.2s ease-in-out;
}
.custom-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 6px rgba(58, 123, 213, 0.3);
  outline: none;
}
.custom-btn {
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 20px;
  border: none;
  transition: background 0.2s ease-in-out, transform 0.1s ease;
}
.custom-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.02);
}

/* CENTRADO LOGIN */
.login-container {
  width:50%;
  max-width:400px;
  padding:2rem;
  flex-direction:column;
  gap:1rem;
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
}
.login-box {
  background:#fff;
  padding:2rem;
  border-radius:16px;
  box-shadow:0 12px 30px rgba(0,0,0,0.15);
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.login-box h2 { text-align:center; font-size:2rem; color:#333; margin-bottom:1rem; }
.login-box label,
.login-box .login-user-label { font-weight:500; color:#333; margin-bottom:0.25rem; display:block; }
.login-user-picker {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:1.25rem;
  margin-bottom:0.25rem;
}
.login-user-circle {
  width:72px;
  height:72px;
  padding:0;
  border:3px solid transparent;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font:inherit;
  font-weight:700;
  font-size:1.15rem;
  letter-spacing:-0.02em;
  color:#fff;
  cursor:pointer;
  position:relative;
  overflow:visible;
  box-shadow:0 4px 14px rgba(0,0,0,0.12);
  transition:border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.login-user-circle:hover:not(.is-selected) { transform:translateY(-2px) scale(1.03); }
.login-user-circle:focus-visible {
  outline:2px solid #3a7bd5;
  outline-offset:3px;
}
.login-user-circle[data-accent="silvana"] {
  background:linear-gradient(145deg, #f48fb1, #c2185b);
}
.login-user-circle[data-accent="jose"] {
  background:linear-gradient(145deg, #64b5f6, #1565c0);
}
.login-user-circle[data-accent="santiago"] {
  background:linear-gradient(145deg, #81c784, #2e7d32);
}
.login-user-circle.is-selected {
  border-color:transparent;
  box-shadow:0 6px 18px rgba(0,0,0,0.18);
  transform:scale(1.08);
}
.login-box button.login-user-circle {
  width:72px;
  height:72px;
  padding:0;
  flex-shrink:0;
  border-radius:18px;
  font-weight:700;
  font-size:1.15rem;
}
.login-box button.login-user-circle:hover {
  transform:translateY(-2px) scale(1.03);
}
.login-box button.login-user-circle.is-selected:hover {
  transform:scale(1.08);
}
.login-user-neon {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  opacity:0;
  overflow:visible;
  transition:opacity 0.15s ease;
  filter:drop-shadow(0 0 1px rgba(0,0,0,0.45))
         drop-shadow(0 0 5px rgba(255,255,255,0.85));
}
.login-user-circle.is-selected .login-user-neon { opacity:1; }
.login-user-neon-path {
  stroke:rgba(255,255,255,0.12);
  stroke-width:1.5;
  vector-effect:non-scaling-stroke;
  stroke-alignment:outer;
}
.login-user-neon-dot {
  fill:#fff;
  opacity:0;
  transition:opacity 0.45s ease;
}
.login-user-circle.is-selected .login-user-neon-dot { opacity:0.1; }
.login-user-neon-dot.is-fading { opacity:0.4 !important; }
.login-user-neon-dot.is-lit { opacity:1 !important; }
.login-user-hint {
  margin:0;
  font-size:0.85rem;
  color:#e74c3c;
  text-align:center;
}
.login-box input {
  width:100%;
  padding:0.9rem 1rem;
  border-radius:12px;
  border:1px solid #ccc;
  font-size:1rem;
  transition:all 0.3s ease;
}
.login-box input:focus {
  border-color:#3a7bd5;
  box-shadow:0 0 8px rgba(58,123,213,0.3);
  outline:none;
}
.login-box button {
  width:100%;
  padding:1rem;
  border:none;
  border-radius:12px;
  background-color:#3a7bd5;
  color:#fff;
  font-weight:bold;
  font-size:1rem;
  cursor:pointer;
  transition:background 0.3s, transform 0.2s;
}
.login-box button:hover { background-color:#2f69b3; transform:scale(1.03); }
.login-box p { text-align:center; font-size:0.9rem; }
.login-box p.error { color:#e74c3c; }

.login-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.95rem;
  color: #333;
  cursor: pointer;
  user-select: none;
}
.login-remember input { width: auto; margin: 0; }
.login-browser-hint {
  font-size: 0.8rem;
  color: #666;
  margin: 0 0 0.75rem;
  text-align: left;
}
body.dark-mode .login-remember,
body.dark-mode .login-browser-hint { color: #ccc; }
body.dark-mode .login-browser-hint { color: #999; }.login-box p.success { color:#27ae60; }

.passkey-login-block { margin-top: 0.25rem; }
.btn-passkey {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #3d7a4d;
  border-radius: 8px;
  background: #2d5a3a;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-passkey:hover { background: #3d7a4d; transform: scale(1.02); }
.btn-passkey:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.login-passkey-hint { font-size: 0.85rem; text-align: center; margin-top: 0.5rem; color: #666; }
body.dark-mode .login-passkey-hint { color: #aaa; }
body.dark-mode .btn-passkey { background: #2d5a3a; border-color: #4a9a5e; }

.login-demo-block { margin-top: 0.25rem; }
.btn-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(15, 122, 111, 0.45);
  border-radius: 8px;
  background: rgba(15, 122, 111, 0.12);
  color: #0f7a6f;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}
.btn-demo:hover {
  background: rgba(15, 122, 111, 0.22);
  transform: scale(1.02);
  color: #0a5c54;
}
.login-demo-hint {
  font-size: 0.82rem;
  text-align: center;
  margin: 0.55rem 0 0;
  color: #666;
  line-height: 1.35;
}
body.dark-mode .btn-demo {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.35);
  color: #5eead4;
}
body.dark-mode .btn-demo:hover {
  background: rgba(45, 212, 191, 0.22);
  color: #99f6e4;
}
body.dark-mode .login-demo-hint { color: #999; }

.login-box .oauth-divider {
  display:flex;
  align-items:center;
  gap:0.75rem;
  margin:1rem 0;
  color:#666;
  font-size:0.9rem;
}
.login-box .oauth-divider::before,
.login-box .oauth-divider::after {
  content:'';
  flex:1;
  height:1px;
  background:#ccc;
}
.login-box .oauth-divider span { white-space:nowrap; }
.login-box .btn-google {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:0.5rem;
  width:100%;
  padding:0.95rem 1rem;
  border-radius:12px;
  text-decoration:none;
  background:#fff;
  color:#444;
  border:1px solid #ccc;
  font-weight:600;
  font-size:0.95rem;
  transition:background 0.2s, box-shadow 0.2s;
}
.login-box .btn-google:hover {
  background:#f8f9fa;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
  color:#222;
}

.login-register-cta {
  margin-top:0.25rem;
  text-align:center;
  font-size:0.9rem;
  color:#555;
  display:flex;
  flex-direction:column;
  gap:0.2rem;
}
.login-register-link {
  font-weight:700;
  color:#3a7bd5;
  text-decoration:none;
}
.login-register-link:hover { text-decoration:underline; }
body.dark-mode .login-register-cta { color:#aaa; }
body.dark-mode .login-register-link { color:#6ea8fe; }

/* RESPONSIVE */
@media(max-width:480px){
  .login-box h2 { font-size:1.6rem; }
  .login-box input, .login-box button:not(.login-user-circle) { padding:0.8rem; font-size:0.95rem; }
  .login-container { width:90%; padding:1.5rem; }
  .login-box button.login-user-circle { width:64px; height:64px; padding:0; font-size:1rem; border-radius:16px; }
  .login-user-circle { width:64px; height:64px; font-size:1rem; border-radius:16px; }
  .login-user-picker { gap:1rem; }
}

/* === MODO OSCURO COMPLETO PARA FORMULARIOS Y MODALES === */
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .custom-modal {
  background-color: #2a2a3c !important;
  color: #f1f1f1 !important;
  border: 1px solid #444;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

body.dark-mode label,
body.dark-mode h2,
body.dark-mode h5,
body.dark-mode .form-label {
  color: #f1f1f1 !important;
}

body.dark-mode .custom-input,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode textarea {
  background-color: #1f1f2e !important;
  color: #f1f1f1 !important;
  border: 1px solid #555 !important;
}

body.dark-mode .custom-input::placeholder {
  color: #aaa;
}

body.dark-mode .form-select option {
  background-color: #1f1f2e;
  color: #f1f1f1;
}

body.dark-mode .custom-input:focus,
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.5);
  background-color: #252538 !important;
}

body.dark-mode .custom-btn {
  background-color: var(--primary-dark);
  color: #fff;
}

body.dark-mode .custom-btn:hover {
  background-color: var(--primary);
}

body.dark-mode .btn-outline-secondary {
  color: #ddd;
  border-color: #666;
}

body.dark-mode .btn-outline-secondary:hover {
  background-color: #444;
  color: #fff;
}

body.dark-mode .modal-header,
body.dark-mode .custom-modal-header {
  border-bottom: 1px solid #444;
}

body.dark-mode .input-group-text {
  background-color: #2f2f45 !important;
  border-color: #555 !important;
  color: #ccc;
}

body.dark-mode .table {
  background-color: #1c1c1c !important;
  color: #f1f1f1 !important;
}

/* === MODO OSCURO: COLORES DE FILAS ALERTA CON TEXTO NEGRO (MEJOR CONTRASTE) === */
body.dark-mode .table-danger {
  --bs-table-bg: #b64b4b;       /* rojo medio, no tan brillante */
  --bs-table-color: #111;       /* texto negro para contraste */
  --bs-table-border-color: #8b3636;
}
body.dark-mode .table-warning {
  --bs-table-bg: #d6b354;       /* amarillo más oscuro */
  --bs-table-color: #111;
  --bs-table-border-color: #9f863d;
}
body.dark-mode .table-success {
  --bs-table-bg: #4a9b5f;       /* verde medio, más legible */
  --bs-table-color: #111;
  --bs-table-border-color: #397e4a;
}

/* Ajuste por si Bootstrap no aplica las variables en celdas */
body.dark-mode tr.table-danger td {
  background-color: #b64b4b !important;
  color: #111 !important;
}
body.dark-mode tr.table-warning td {
  background-color: #d6b354 !important;
  color: #111 !important;
}
body.dark-mode tr.table-success td {
  background-color: #4a9b5f !important;
  color: #111 !important;
}



/* === BUSCADOR CLIENTE EN NUEVA ORDEN === */
.nuevaorden-container .cliente-buscador-orden {
  width: 100%;
}

.nuevaorden-container .cliente-buscador-orden .select2-container {
  width: 100% !important;
}

.nuevaorden-container .cliente-buscador-orden .select2-container .select2-selection--single {
  height: calc(2.5rem + 2px);
  display: flex;
  align-items: center;
}

.nuevaorden-container .cliente-buscador-orden .select2-selection__rendered {
  line-height: 1.4;
  padding-left: 0.75rem;
}

.nuevaorden-container .cliente-buscador-orden .select2-selection__arrow {
  height: 100%;
}

/* === SELECT2 (BUSCADOR DE CLIENTES) === */
body.dark-mode .select2-container .select2-selection--single {
  background-color: #1f1f2e !important;
  border: 1px solid #555 !important;
  color: #f1f1f1 !important;
}

body.dark-mode .select2-selection__rendered {
  color: #f1f1f1 !important;
}

body.dark-mode .select2-selection__placeholder {
  color: #aaa !important;
}

body.dark-mode .select2-selection__arrow b {
  border-color: #f1f1f1 transparent transparent transparent !important;
}

body.dark-mode .select2-dropdown {
  background-color: #2a2a3c !important;
  color: #f1f1f1 !important;
  border: 1px solid #555 !important;
}

body.dark-mode .select2-search__field {
  background-color: #1f1f2e !important;
  color: #f1f1f1 !important;
  border: 1px solid #555 !important;
}

/* Campo de búsqueda del desplegable Select2: lupa visible al abrir */
.select2-container--default .select2-search--dropdown {
  position: relative;
  padding: 0.5rem 0.5rem 0.5rem 2.25rem;
}

.select2-container--default .select2-search--dropdown::before {
  content: "\F52A";
  font-family: "bootstrap-icons";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  color: #64748b;
  pointer-events: none;
  line-height: 1;
}

body.dark-mode .select2-container--default .select2-search--dropdown::before {
  color: #93c5fd;
}

body.dark-mode .select2-results__option {
  background-color: transparent !important;
  color: #f1f1f1 !important;
}

body.dark-mode .select2-results__option--highlighted {
  background-color: var(--primary-dark) !important;
  color: #fff !important;
}

/* === FIX FINAL ALERTA MODO OSCURO (texto negro) === */
body.dark-mode div.alert.alert-danger,
body.dark-mode div.alert.alert-warning,
body.dark-mode div.alert.alert-success {
  background-color: #f8d7da !important; /* rojo claro */
  border-color: #f5c2c7 !important;
  color: #111 !important;
}

body.dark-mode div.alert.alert-warning {
  background-color: #fff3cd !important; /* amarillo claro */
  border-color: #ffecb5 !important;
  color: #111 !important;
}

body.dark-mode div.alert.alert-success {
  background-color: #d1e7dd !important; /* verde claro */
  border-color: #badbcc !important;
  color: #111 !important;
}

/* Asegura que todo texto interno se fuerce a negro */
body.dark-mode .alert * {
  color: #111 !important;
}

/* === Botones de acción modernos === */
.btn-icon {
  border: none;
  background: transparent;
  color: #6c757d;
  font-size: 1.2rem;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  transform: scale(1.15);
  color: var(--primary);
}

.btn-editar:hover {
  color: #0d6efd; /* azul */
}

.btn-eliminar:hover {
  color: #dc3545; /* rojo */
}

body.dark-mode .btn-icon {
  color: #bbb;
}

body.dark-mode .btn-icon:hover {
  color: #4a90e2;
}

body.dark-mode .btn-eliminar:hover {
  color: #ff6b6b;
}

.word-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.word-viewer-overlay.d-none {
  display: none !important;
}

.word-viewer-card {
  width: min(1100px, 100%);
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.dark-mode .word-viewer-card {
  background: #1e1e2f;
  color: #f5f5f5;
}

.word-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #272a3b;
  color: #f5f5f5;
}

.word-viewer-header button {
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
}

.word-viewer-header__title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.word-viewer-header__title-row > strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orden-carousel-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.orden-carousel-btn {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}

.orden-carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.print-preview-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 1.5rem);
  width: min(900px, 100%);
}

.print-preview-hint {
  background: rgba(15, 23, 42, 0.04);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.dark-mode .print-preview-hint {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8 !important;
}

#printPreviewIframe {
  flex: 1;
  width: 100%;
  min-height: 320px;
  height: calc(100vh - 200px);
  border: 0;
  background: #fff;
}

/* === FIX MODO OSCURO LOGIN === */
body.dark-mode .login-container {
  background: transparent !important;
}

body.dark-mode .login-box {
  background: #2a2a3c !important;
  color: #f1f1f1 !important;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7) !important;
}

body.dark-mode .login-box h2,
body.dark-mode .login-box label,
body.dark-mode .login-box .login-user-label,
body.dark-mode .login-box p {
  color: #f1f1f1 !important;
}
body.dark-mode .login-user-circle.is-selected {
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
body.dark-mode .login-user-circle.is-selected .login-user-neon-path {
  stroke: rgba(255, 255, 255, 0.16);
}
body.dark-mode .login-user-hint { color: #ff6b6b !important; }

body.dark-mode .login-box input {
  background-color: #1f1f2e !important;
  border: 1px solid #555 !important;
  color: #f1f1f1 !important;
}

body.dark-mode .login-box input::placeholder {
  color: #aaa !important;
}

body.dark-mode .login-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.5);
  background-color: #252538 !important;
}

body.dark-mode .login-box button {
  background-color: var(--primary-dark) !important;
  color: #fff !important;
  border: none !important;
}

body.dark-mode .login-box button:hover {
  background-color: var(--primary) !important;
  transform: scale(1.03);
}

body.dark-mode .login-box p.error {
  color: #ff6b6b !important;
}

body.dark-mode .login-box p.success {
  color: #4caf50 !important;
}

body.dark-mode .login-box .oauth-divider {
  color: #aaa !important;
}
body.dark-mode .login-box .oauth-divider::before,
body.dark-mode .login-box .oauth-divider::after {
  background: #555 !important;
}
body.dark-mode .login-box .btn-google {
  background: #1f1f2e !important;
  color: #f1f1f1 !important;
  border-color: #555 !important;
}
body.dark-mode .login-box .btn-google:hover {
  background: #252538 !important;
  color: #fff !important;
}

@media (max-width: 768px) {
  .app-wide {
    max-width: 100vw !important;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .table th,
  .table td {
    font-size: 0.82rem;
    padding: 0.4rem 0.45rem;
    white-space: normal;
    word-break: break-word;
  }

  .btn,
  .btn-ux {
    font-size: 0.88rem;
  }

  .input-group .form-control,
  .form-control,
  .form-select {
    min-height: 2.3rem;
    font-size: 0.92rem;
  }

  .nuevaorden-container .card {
    padding: 0.9rem !important;
  }
}

/* Feedback al confirmar un equipo en Nueva OT */
.equipo-atajo-hint kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
  border-radius: 4px;
  border: 1px solid rgba(100, 116, 139, 0.45);
  background: rgba(148, 163, 184, 0.18);
}
body.dark-mode .equipo-atajo-hint kbd {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}
@keyframes equipo-detalle-flash {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
#descripcion.equipo-detalle-flash {
  animation: equipo-detalle-flash 0.9s ease-out;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.45);
}

/* ==========================================================
   MODERN MINIMAL THEME (GLOBAL)
   ========================================================== */
:root {
  --ux-bg: #f6f8fc;
  --ux-bg-soft: #eef2f8;
  --ux-surface: rgba(255, 255, 255, 0.82);
  --ux-surface-solid: #ffffff;
  --ux-border: rgba(15, 23, 42, 0.09);
  --ux-border-strong: rgba(15, 23, 42, 0.16);
  --ux-text: #0f172a;
  --ux-muted: #64748b;
  --ux-accent: #0ea5a4;
  --ux-accent-2: #2563eb;
  --ux-danger: #e11d48;
  --ux-radius: 16px;
  --ux-shadow: 0 10px 35px rgba(15, 23, 42, 0.08);
  --ux-shadow-soft: 0 5px 22px rgba(15, 23, 42, 0.05);
}

body {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--ux-text);
  background:
    radial-gradient(1200px 520px at 5% -20%, rgba(14, 165, 164, 0.10), transparent 70%),
    radial-gradient(900px 380px at 100% 0%, rgba(37, 99, 235, 0.08), transparent 65%),
    var(--ux-bg);
}

h1, h2, h3, h4, h5, h6,
.app-title {
  font-family: 'Manrope', 'DM Sans', sans-serif;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #0b1220;
}

.app-title {
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
}

.app-title-logo {
  margin: 0;
  line-height: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

.app-dashboard-logo {
  display: block;
  width: min(440px, 84vw);
  height: auto;
  max-height: 160px;
  object-fit: contain;
  object-position: center;
  margin-inline: auto;
}

/* Logo Ryder: azul en claro; blanco en oscuro (fondo siempre transparente) */
body.dark-mode .app-dashboard-logo[src*="fondo-dashboard-ryder"] {
  filter: brightness(0) invert(1);
}

body:not(.dark-mode) .app-dashboard-logo[src*="fondo-dashboard-ryder"] {
  filter: none;
}

.card {
  border: 1px solid var(--ux-border) !important;
  border-radius: var(--ux-radius) !important;
  box-shadow: var(--ux-shadow-soft) !important;
  background: var(--ux-surface);
  backdrop-filter: blur(8px);
}

.table-responsive {
  border-radius: var(--ux-radius);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: rgba(15, 23, 42, 0.035);
  margin-bottom: 0;
}

.table thead th {
  border-bottom: 1px solid var(--ux-border-strong);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(244, 247, 252, 0.92));
  color: #0b1220;
  font-family: 'Manrope', 'DM Sans', sans-serif;
  font-weight: 700;
}

.table td {
  border-color: var(--ux-border);
}

.btn {
  border-radius: 12px !important;
  font-weight: 600;
  transition: all 0.2s ease;
}

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

.custom-btn,
.btn-success {
  background: linear-gradient(135deg, var(--ux-accent), var(--ux-accent-2)) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.20);
}

.custom-btn:hover,
.btn-success:hover {
  filter: brightness(1.04);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--ux-border-strong) !important;
}

.btn-outline-danger {
  color: var(--ux-danger) !important;
  border-color: rgba(225, 29, 72, 0.35) !important;
}

.form-control,
.form-select,
.input-group-text,
.custom-input {
  border-radius: 12px !important;
  border: 1px solid var(--ux-border) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: var(--ux-text) !important;
}

.form-control:focus,
.form-select:focus,
.custom-input:focus {
  border-color: rgba(14, 165, 164, 0.55) !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.14) !important;
}

.form-label {
  font-family: 'Manrope', 'DM Sans', sans-serif;
  font-weight: 700;
  color: #0f172a;
}

.badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.botonera a {
  border: 1px solid var(--ux-border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: var(--ux-shadow-soft);
}

.botonera a:hover {
  background: linear-gradient(135deg, var(--ux-accent), var(--ux-accent-2));
}

body.dark-mode {
  --ux-bg: #0b1220;
  --ux-bg-soft: #0f172a;
  --ux-surface: rgba(17, 24, 39, 0.80);
  --ux-surface-solid: #111827;
  --ux-border: rgba(148, 163, 184, 0.16);
  --ux-border-strong: rgba(148, 163, 184, 0.24);
  --ux-text: #e2e8f0;
  --ux-muted: #a8b4c4;
  --bs-secondary-color: #a8b4c4;
  --bs-secondary: #a8b4c4;
  background:
    radial-gradient(1200px 520px at 5% -20%, rgba(14, 165, 164, 0.18), transparent 65%),
    radial-gradient(900px 380px at 100% 0%, rgba(37, 99, 235, 0.16), transparent 55%),
    #0b1220;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode .app-title,
body.dark-mode .form-label {
  color: #f1f5f9 !important;
}

/* Textos secundarios / ayuda legibles en modo oscuro */
body.dark-mode .text-muted,
body.dark-mode .text-body-secondary,
body.dark-mode .form-text,
body.dark-mode p.text-muted,
body.dark-mode span.text-muted,
body.dark-mode .small.text-muted,
body.dark-mode div.text-muted,
body.dark-mode label.text-muted,
body.dark-mode [data-form-undo-status-global],
body.dark-mode .inv-hub-sub,
body.dark-mode .inv-panel-hint,
body.dark-mode .ux-list-sub {
  color: var(--ux-muted) !important;
}

body.dark-mode kbd {
  color: #f1f5f9 !important;
  background-color: #374151 !important;
  border: 1px solid #6b7280;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

body.dark-mode .card {
  background: var(--ux-surface) !important;
  border-color: var(--ux-border) !important;
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.45) !important;
}

body.dark-mode .table thead th {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border-color: var(--ux-border-strong);
}

body.dark-mode .table td {
  border-color: var(--ux-border);
}

body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .input-group-text,
body.dark-mode .custom-input {
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: var(--ux-border) !important;
  color: #f8fafc !important;
}

body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-danger {
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
}

@media (max-width: 992px) {
  .card {
    border-radius: 14px !important;
  }
}

/* ==========================================================
   INNER PAGES UX (ALL PAGES EXCEPT DASHBOARD)
   ========================================================== */
body.inner-app {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}

body.inner-app .app-wide {
  max-width: calc(100vw - 2rem) !important;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Barra superior fija: eventos de la semana + acciones (Inicio, logout, dark, usuario) */
body.inner-app .app-sticky-top {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: var(--ux-bg, #0b1220);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

body.dark-mode.inner-app .app-sticky-top {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

body.inner-app .app-sticky-top .page-toolbar {
  margin-bottom: 0;
}

body.inner-app .app-sticky-top .week-events-bar {
  margin-bottom: 0.5rem;
}

/* Barra superior única: Inicio · logout · sonido · dark · menú usuario */
.app-top-bar,
body.inner-app .page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  width: 100%;
  flex-wrap: nowrap;
}

.app-top-bar-actions,
body.inner-app .toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-app-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.3rem 0.85rem !important;
  flex-shrink: 0;
  white-space: nowrap;
}

.app-top-bar-logout-label {
  display: none;
}

.app-user-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.app-user-menu-toggle .app-user-name,
.app-user-menu-toggle .app-user-chevron {
  display: none;
}

body.inner-app .page-title {
  margin: 0 0 1rem;
  text-align: center;
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 100%;
}

body.inner-app .toolbar-actions form {
  margin: 0;
}

body.inner-app .page-subtoolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: -0.35rem 0 1rem;
}

body.inner-app .surface-card {
  border-radius: 18px !important;
  border: 1px solid var(--ux-border) !important;
  background: var(--ux-surface);
  box-shadow: var(--ux-shadow-soft) !important;
}

body.inner-app .table-shell {
  border: 1px solid var(--ux-border);
  border-radius: 18px;
  background: var(--ux-surface);
  box-shadow: var(--ux-shadow-soft);
  overflow: auto;
}

body.inner-app .surface-card {
  padding: 1.2rem;
}

body.inner-app .table-shell .table {
  margin-bottom: 0;
}

body.inner-app .table-shell .table th,
body.inner-app .table-shell .table td {
  padding-top: 0.78rem;
  padding-bottom: 0.78rem;
  font-size: 0.95rem;
}

body.inner-app .search-wrap .input-group-text {
  border-right: none !important;
}

body.inner-app .search-wrap .form-control {
  border-left: none !important;
}

body.inner-app .btn {
  border-radius: 11px !important;
  font-weight: 700;
}

body.inner-app .btn-outline-secondary,
body.inner-app .btn-outline-primary,
body.inner-app .btn-outline-danger {
  border-width: 1px !important;
}

body.inner-app .btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--ux-border-strong);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  font-size: 1rem;
}

body.inner-app .btn-icon:hover {
  background: #fff;
  color: var(--ux-accent-2);
  transform: translateY(-1px);
}

body.dark-mode.inner-app .btn-icon {
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  border-color: var(--ux-border);
}

body.dark-mode.inner-app .btn-icon:hover {
  color: #8ab4ff;
}

body.dark-mode.inner-app .table-shell {
  background: var(--ux-surface);
  border-color: var(--ux-border);
}

body.dark-mode.inner-app .table-shell .table td {
  color: #e2e8f0;
}

body.dark-mode.inner-app .table-shell .table tbody tr:hover {
  background: rgba(148, 163, 184, 0.09);
}

@media (max-width: 992px) {
  body.inner-app .app-wide {
    max-width: 100vw !important;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  body.inner-app .page-toolbar {
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  body.inner-app .surface-card {
    padding: 1rem;
  }

  body.inner-app .table-shell .table th,
  body.inner-app .table-shell .table td {
    white-space: normal;
  }

  body.inner-app .btn {
    min-height: 40px;
    font-size: 0.9rem;
  }

  body.inner-app .table-shell .table th,
  body.inner-app .table-shell .table td {
    font-size: 0.85rem;
    padding: 0.52rem 0.5rem;
    white-space: nowrap;
  }
}

/* ==========================================================
   LISTADOS / FORMULARIOS — ESTILO APP (Clientes, Inventario, Stock)
   ========================================================== */
body.inner-app .ux-control-deck {
  border-radius: 18px !important;
}

body.inner-app .ux-list-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ux-muted);
  margin-bottom: 0.25rem;
}

body.inner-app .ux-list-heading {
  font-family: 'Manrope', 'DM Sans', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: var(--ux-text);
}

body.inner-app .ux-list-sub {
  max-width: 52rem;
  line-height: 1.45;
}

body.inner-app .ux-data-board-wrap {
  border-radius: 20px !important;
}

body.inner-app .table.ux-data-board {
  border-collapse: separate;
  border-spacing: 0 6px;
  background: transparent !important;
}

body.inner-app .table.ux-data-board thead th {
  border: none;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ux-muted);
  padding-bottom: 0.35rem !important;
  background: transparent !important;
}

body.inner-app .table.ux-data-board tbody tr {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  border-radius: 14px;
}

body.inner-app .table.ux-data-board tbody tr td:not(.ort-select-tip.ort-age-yellow):not(.ort-select-tip.ort-age-orange):not(.ort-select-tip.ort-age-red) {
  border: none;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #0f172a !important;
  vertical-align: middle;
}

body.inner-app .table.ux-data-board tbody tr td.ort-select-tip {
  border: none;
  color: #0f172a !important;
  vertical-align: middle;
}

body.inner-app .table.ux-data-board tbody td:first-child {
  border-radius: 14px 0 0 14px;
}

body.inner-app .table.ux-data-board tbody td:last-child {
  border-radius: 0 14px 14px 0;
}

body.dark-mode.inner-app .table.ux-data-board tbody tr:not(.brand-stock-item) td:not(.ort-select-tip.ort-age-yellow):not(.ort-select-tip.ort-age-orange):not(.ort-select-tip.ort-age-red) {
  background: rgba(30, 41, 59, 0.94) !important;
  color: #f1f5f9 !important;
}

/* Stock equipos: colores por marca (fondo inline desde JS) */
body.dark-mode.inner-app #equiposTable.ux-data-board tbody tr.brand-stock-item td {
  color: #111 !important;
}

body.inner-app .table.ux-data-board.table-striped > tbody > tr > td {
  --bs-table-striped-bg: transparent;
  --bs-table-bg: transparent;
}

body.inner-app .ux-id-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

body.dark-mode.inner-app .ux-id-pill {
  background: rgba(96, 165, 250, 0.15);
  color: #bfdbfe;
}

body.inner-app .ux-cell-strong {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

body.inner-app .ux-cell-muted {
  color: var(--ux-muted);
  font-size: 0.92rem;
}

body.inner-app .ux-cell-clamp {
  max-width: 22rem;
  line-height: 1.35;
  font-size: 0.92rem;
}

body.inner-app .ux-muted-soft {
  opacity: 0.85;
}

body.inner-app .ux-form-rail .card-body {
  padding-top: 1.25rem;
}

body.inner-app .ux-inventario-scroll {
  border-radius: 16px;
}

/* Tarjetas del dashboard (comparten estilo con botonera legacy) */
.botonera .btn-ux,
a.btn-ux {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  color: var(--text);
  border-radius: var(--radius);
  width: 180px;
  height: 180px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.botonera .btn-ux svg,
a.btn-ux svg {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
}

/* Badge de notificación en tarjeta Pendientes (dashboard) */
.btn-ux-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.btn-ux-icon-wrap svg {
  width: 60px;
  height: 60px;
  margin-bottom: 0;
}

.dashboard-pendientes-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

body.dark-mode .dashboard-pendientes-badge {
  background: #f87171;
  color: #0b1220;
}

a.btn-ux:hover .dashboard-pendientes-badge {
  color: #fff;
}

body.dark-mode a.btn-ux:hover .dashboard-pendientes-badge {
  color: #0b1220;
}

/* Badge de notificación en tarjeta Órdenes (dashboard): rojo / naranja / verde */
.dashboard-ordenes-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.dashboard-ordenes-badge--rojo {
  background: #dc3545;
}

.dashboard-ordenes-badge--naranja {
  background: #fd7e14;
}

.dashboard-ordenes-badge--verde {
  background: #20c997;
}

body.dark-mode .dashboard-ordenes-badge--rojo {
  background: #f87171;
  color: #0b1220;
}

body.dark-mode .dashboard-ordenes-badge--naranja {
  background: #fb923c;
  color: #0b1220;
}

body.dark-mode .dashboard-ordenes-badge--verde {
  background: #34d399;
  color: #0b1220;
}

a.btn-ux:hover .dashboard-ordenes-badge--rojo,
a.btn-ux:hover .dashboard-ordenes-badge--naranja {
  color: #fff;
}

body.dark-mode a.btn-ux:hover .dashboard-ordenes-badge--rojo,
body.dark-mode a.btn-ux:hover .dashboard-ordenes-badge--naranja,
body.dark-mode a.btn-ux:hover .dashboard-ordenes-badge--verde {
  color: #0b1220;
}

.botonera .btn-ux span,
a.btn-ux span {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0 0.35rem;
}

body.dark-mode .botonera .btn-ux,
body.dark-mode a.btn-ux {
  background: #2c2c3e;
  color: var(--text);
  border: 1px solid var(--ux-border);
}

.botonera .btn-ux:hover,
a.btn-ux:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-3px);
}

.dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

.dashboard-nav .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.dashboard-nav .btn-ux {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1;
  max-width: none;
  padding: 0.55rem 0.35rem !important;
  border-radius: 14px !important;
}

.dashboard-nav .btn-ux svg {
  width: 50px !important;
  height: 50px !important;
  margin-bottom: 6px !important;
}

.dashboard-nav .btn-ux-icon-wrap {
  margin-bottom: 6px !important;
}

.dashboard-nav .btn-ux-icon-wrap svg {
  width: 50px !important;
  height: 50px !important;
  margin-bottom: 0 !important;
}

.dashboard-nav .btn-ux span {
  font-size: 0.82rem;
}

.dashboard-nav .btn-ux > span:last-of-type {
  line-height: 1.2;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Dashboard: Dark mode · Sonido · menú usuario */
.dashboard-toolbar,
.app-top-bar {
  max-width: 100%;
}

.app-tenant-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}

.app-tenant-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.app-tenant-name {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(40vw, 220px);
}

.dashboard-user-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  position: relative;
}

.dashboard-user-menu {
  flex-shrink: 0;
}

/* —— Panel cuenta / gestión (cuadrado, 2 colores) —— */
.app-user-ring {
  position: relative;
  flex-shrink: 0;
}

.app-user-ring-toggle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(100, 116, 139, 0.4);
  background: rgba(241, 245, 249, 0.92);
  color: #475569;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.app-user-ring-toggle:hover,
.app-user-ring.is-open .app-user-ring-toggle {
  background: #e2e8f0;
  border-color: rgba(71, 85, 105, 0.55);
  color: #1e293b;
  transform: translateY(-1px);
}

.app-user-ring.is-open .app-user-ring-toggle {
  transform: rotate(45deg);
}

.app-user-ring-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: -4px;
  z-index: 1080;
  width: min(460px, calc(100vw - 1.25rem));
  height: auto;
  filter: drop-shadow(0 14px 28px rgba(15, 23, 42, 0.18));
  animation: app-user-ring-in 0.22s ease-out;
}

@keyframes app-user-ring-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.app-user-ring-donut {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid rgba(100, 116, 139, 0.28);
}

.app-user-ring--dual .app-user-ring-donut,
.app-user-ring-donut:not(:has(.app-user-ring-half--gestion)) {
  grid-template-columns: 1fr 1fr;
}

.app-user-ring-half {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0.85rem 0.65rem 0.9rem;
  min-width: 0;
  z-index: 1;
}

/* Panel Cuenta: azul-gris sobrio */
.app-user-ring-half--cuenta {
  background: linear-gradient(165deg, #d8e2ec 0%, #c5d3e0 100%);
  color: #1e3a5f;
}

/* Panel Gestión: piedra/taupe sobrio */
.app-user-ring-half--gestion {
  background: linear-gradient(195deg, #e4dfd6 0%, #d4cdc2 100%);
  color: #3f3a32;
  border-left: 1px solid rgba(100, 116, 139, 0.18);
}

/* Panel Sistema: verde-gris sobrio */
.app-user-ring-half--sistema {
  background: linear-gradient(180deg, #d5ddd8 0%, #c2cdc6 100%);
  color: #24352e;
  border-left: 1px solid rgba(100, 116, 139, 0.18);
}

.app-user-ring-half-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.4rem;
  padding: 0 0.2rem;
}

.app-user-ring-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
  padding: 0.48rem 0.5rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.app-user-ring-link .bi {
  font-size: 1.05rem;
  opacity: 0.9;
  flex-shrink: 0;
  width: 1.15rem;
  text-align: center;
}

.app-user-ring-link:hover,
.app-user-ring-link:focus {
  background: rgba(255, 255, 255, 0.42);
  color: inherit;
  transform: translateY(-1px);
  outline: none;
}

.app-user-ring-logout {
  margin: 0.15rem 0 0;
  padding: 0;
  width: 100%;
}

.app-user-ring-link--logout {
  color: #9f1239;
}

.app-user-ring-link--logout .bi {
  color: #be123c;
  opacity: 1;
}

.app-user-ring-link--logout:hover,
.app-user-ring-link--logout:focus {
  background: rgba(190, 18, 60, 0.12);
  color: #9f1239;
}

.app-user-ring-hole {
  display: none;
}

.app-user-dropdown-header {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.35rem 1.05rem 0.15rem;
}

body.dark-mode .app-user-ring-toggle {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

body.dark-mode .app-user-ring-toggle:hover,
body.dark-mode .app-user-ring.is-open .app-user-ring-toggle {
  background: rgba(51, 65, 85, 0.95);
  color: #f1f5f9;
}

body.dark-mode .app-user-ring-half--cuenta {
  background: linear-gradient(165deg, #2a3f55 0%, #243648 100%);
  color: #d7e6f4;
}

body.dark-mode .app-user-ring-half--gestion {
  background: linear-gradient(195deg, #3a362f 0%, #2f2c27 100%);
  color: #ebe4d8;
  border-left-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .app-user-ring-half--sistema {
  background: linear-gradient(180deg, #2a3531 0%, #232c29 100%);
  color: #d5e0db;
  border-left-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .app-user-ring-link:hover,
body.dark-mode .app-user-ring-link:focus {
  background: rgba(255, 255, 255, 0.12);
}

body.dark-mode .app-user-ring-link--logout {
  color: #fda4af;
}

body.dark-mode .app-user-ring-link--logout .bi {
  color: #fb7185;
}

body.dark-mode .app-user-ring-link--logout:hover,
body.dark-mode .app-user-ring-link--logout:focus {
  background: rgba(251, 113, 133, 0.16);
  color: #fecdd3;
}

body.dark-mode .app-user-dropdown-header {
  color: #94a3b8;
}

.dashboard-user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.dashboard-user-menu-toggle:hover,
.dashboard-user-menu-toggle.show {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

.dashboard-user-menu-toggle .bi-person-circle {
  font-size: 1.15rem;
  color: #94a3b8;
}

.dashboard-user-name {
  text-transform: capitalize;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-user-chevron {
  font-size: 0.72rem;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.dashboard-user-menu-toggle.show .dashboard-user-chevron {
  transform: rotate(180deg);
}

.dashboard-user-dropdown {
  min-width: 13rem;
  padding: 0.55rem 0;
  border-radius: 12px;
  border: 1px solid var(--ux-border-strong, rgba(15, 23, 42, 0.16));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.dashboard-user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  padding: 0.72rem 1.05rem;
  line-height: 1.35;
}

.dashboard-user-dropdown .dropdown-divider {
  margin: 0.45rem 0.75rem;
}

.dashboard-user-dropdown .dropdown-item .bi {
  width: 1.15rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
}

/* Módulos del dashboard (menú iniciales): acento suave */
.dashboard-user-dropdown .menu-item-mod {
  color: #1e4a7a;
}

.dashboard-user-dropdown .menu-item-mod .bi {
  color: #3b6ea5;
}

.dashboard-logout-form {
  margin: 0;
  flex-shrink: 0;
}

.btn-logout-compact {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(220, 53, 69, 0.55);
  background: transparent;
  color: #dc3545;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.btn-logout-compact .bi-box-arrow-right {
  color: #dc3545 !important;
}

.btn-logout-compact:hover {
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.75);
  transform: scale(1.05);
}

.btn-logout-compact:hover .bi-box-arrow-right {
  color: #b02a37 !important;
}

body.dark-mode .dashboard-user-menu-toggle {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

body.dark-mode .dashboard-user-menu-toggle:hover,
body.dark-mode .dashboard-user-menu-toggle.show {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(148, 163, 184, 0.45);
}

body.dark-mode .dashboard-user-menu-toggle .bi-person-circle {
  color: #cbd5e1;
}

body.dark-mode .app-user-initials {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

body.dark-mode .dashboard-user-dropdown {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.55);
}

body.dark-mode .dashboard-user-dropdown .menu-item-mod {
  color: #9ec5e8;
}

body.dark-mode .dashboard-user-dropdown .menu-item-mod .bi {
  color: #7eb3de;
}

body.dark-mode .dashboard-user-dropdown .dropdown-item:hover,
body.dark-mode .dashboard-user-dropdown .dropdown-item:focus {
  background: rgba(148, 163, 184, 0.12);
  color: #f8fafc;
}

body.dark-mode .btn-logout-compact {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.55);
}

body.dark-mode .btn-logout-compact .bi-box-arrow-right {
  color: #f87171 !important;
}

body.dark-mode .btn-logout-compact:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.8);
}

body.dark-mode .btn-logout-compact:hover .bi-box-arrow-right {
  color: #fca5a5 !important;
}

/* ==========================================================
   SMARTPHONE / TABLET — RESPONSIVE GLOBAL
   ========================================================== */

@media (max-width: 768px) {
  body {
    -webkit-text-size-adjust: 100%;
  }

  .app-wide,
  .container-fluid.app-wide {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    margin-top: 0.75rem !important;
  }

  /* —— Dashboard (inicio) —— */
  .app-header {
    margin-bottom: 1rem !important;
  }

  .app-title {
    font-size: 1.35rem !important;
    margin-bottom: 0.65rem !important;
    line-height: 1.2;
    padding: 0 0.25rem;
  }

  .dashboard-toolbar {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    gap: 0.45rem !important;
    padding: 0.25rem 0 0.5rem !important;
    justify-content: center !important;
  }

  .dashboard-toolbar .btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }

  .dashboard-user-menu-toggle {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
  }

  .dashboard-user-name {
    max-width: 6.5rem;
  }

  .btn-logout-compact {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    font-size: 0.88rem;
  }

  .dashboard-nav .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    width: 100%;
    max-width: none;
    margin: 0 auto 0 !important;
    align-items: stretch;
  }

  .dashboard-nav .btn-ux {
    width: 100% !important;
    height: auto !important;
    /* Evita que el contenido (p. ej. «Nueva Orden» en 2 líneas) estire solo una celda */
    min-height: 0 !important;
    min-width: 0;
    aspect-ratio: 1;
    padding: 0.5rem 0.35rem !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
  }

  .dashboard-nav .btn-ux svg {
    width: 30px !important;
    height: 30px !important;
    margin-bottom: 5px !important;
    flex-shrink: 0;
  }

  /* Mismo aire que el SVG suelto: el wrap no suma margen extra al ícono interno */
  .dashboard-nav .btn-ux-icon-wrap {
    margin-bottom: 5px !important;
    flex-shrink: 0;
  }

  .dashboard-nav .btn-ux-icon-wrap svg {
    width: 30px !important;
    height: 30px !important;
    margin-bottom: 0 !important;
  }

  /* Reserva 2 líneas en todas las tarjetas para alinear iconos/textos */
  .dashboard-nav .btn-ux > span:last-of-type {
    font-size: 0.78rem;
    line-height: 1.2;
    min-height: 2.4em;
    max-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 0.2rem;
    overflow: hidden;
  }

  /* —— Páginas internas: una sola hilera compacta —— */
  .app-top-bar,
  body.inner-app .page-toolbar {
    gap: 0.35rem;
    margin-bottom: 0.65rem;
  }

  body.inner-app .page-title {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }

  .btn-app-nav {
    min-width: 40px;
    min-height: 40px;
    padding: 0.35rem 0.55rem !important;
    justify-content: center;
  }

  .app-top-bar-nav-label {
    display: none;
  }

  .app-top-bar-actions,
  body.inner-app .toolbar-actions {
    gap: 0.3rem;
  }

  body.inner-app .toolbar-actions form {
    margin: 0 !important;
  }

  .app-top-bar-actions .btn-icon,
  body.inner-app .toolbar-actions .btn-icon {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
  }

  .btn-logout-compact {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .app-user-menu-toggle,
  .dashboard-user-menu-toggle {
    min-width: 40px;
    min-height: 40px;
    padding: 0.25rem 0.45rem !important;
    align-items: center;
  }

  /* En smart: solo iniciales, alineado con el engranaje */
  .dashboard-user-name,
  .app-user-menu-toggle .app-user-name,
  .dashboard-user-chevron,
  .app-user-menu-toggle .app-user-chevron {
    display: none !important;
  }

  .app-user-initials {
    font-size: 0.78rem;
    line-height: 1;
  }

  .app-user-ring-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .app-user-ring-panel {
    /* En móvil el JS fija el panel al viewport (left/right) para leer las 3 columnas */
    right: 0;
    width: auto;
    max-width: none;
  }

  .app-user-ring-link {
    font-size: 0.72rem;
    padding: 0.38rem 0.28rem;
    gap: 0.28rem;
  }

  .app-user-ring-link .bi {
    font-size: 0.95rem;
    width: 1rem;
  }

  .app-user-ring-half {
    padding: 0.65rem 0.28rem 0.7rem;
  }

  .app-user-ring-half-label {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
  }

  /* Ocultar en smartphone */
  .ux-hide-smartphone {
    display: none !important;
  }

  .ux-ordenes-tabs .nav-link {
    border-radius: 999px;
    font-size: 0.88rem;
    padding: 0.45rem 0.9rem;
  }

  .btn-icon.btn-compartir-wa i {
    color: #25d366;
  }

  /* Tabla escritorio vs tarjetas móvil */
  .ux-desktop-table {
    display: none !important;
  }

  .ux-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
  }

  .ux-mobile-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    padding: 0.85rem 0.9rem;
    border-radius: 16px;
    border: 1px solid var(--ux-border);
    background: rgba(30, 41, 59, 0.92);
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.22);
  }

  body:not(.dark-mode) .ux-mobile-card {
    background: rgba(255, 255, 255, 0.96);
  }

  .ux-mobile-card.ux-mobile-card-danger {
    border-left: 4px solid #e11d48;
  }

  .ux-mobile-card-main {
    flex: 1;
    min-width: 0;
  }

  .ux-mobile-card-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 0.35rem;
    color: var(--ux-text);
    word-break: break-word;
  }

  .ux-mobile-meta {
    margin: 0 0 0.2rem;
    font-size: 0.88rem;
    color: var(--ux-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    word-break: break-word;
  }

  .ux-mobile-meta i {
    flex-shrink: 0;
    opacity: 0.85;
  }

  .ux-mobile-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ux-muted);
    margin-bottom: 0.1rem;
  }

  .ux-mobile-chip {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    margin-top: 0.25rem;
  }

  .ux-mobile-card-fields {
    margin-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .ux-mobile-card-fields .form-select {
    min-height: 40px;
    font-size: 0.88rem;
  }

  /* Órdenes: fichas compactas en smartphone */
  #ordenes-mobile-list.ux-mobile-list {
    gap: 0.35rem;
  }

  #ordenes-mobile-list .ux-mobile-card--orden {
    padding: 0.5rem 0.55rem;
    gap: 0.4rem;
    align-items: flex-start;
    border-radius: 10px;
  }

  #ordenes-mobile-list .ux-orden-mobile-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
  }

  #ordenes-mobile-list .ux-orden-mobile-head {
    flex: 1 1 auto;
    min-width: 0;
  }

  #ordenes-mobile-list .ux-orden-mobile-precio {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  #ordenes-mobile-list .ux-orden-mobile-desc {
    margin: 0.2rem 0 0;
    color: var(--ux-muted);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
  }

  #ordenes-mobile-list .ux-mobile-card--orden .ux-mobile-card-actions {
    display: none;
  }

  #ordenes-mobile-list .ux-mobile-card--orden .ux-mobile-card-select {
    padding-top: 0;
    align-self: center;
  }

  #ordenes-mobile-list .ux-mobile-card--orden .ux-mobile-card-title {
    font-size: 0.84rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #ordenes-mobile-list .ux-orden-mobile-meta {
    margin: 0.12rem 0 0;
    font-size: 0.68rem;
    color: var(--ux-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  #ordenes-mobile-list .ux-orden-mobile-ot {
    font-weight: 700;
  }

  #ordenes-mobile-list .ux-orden-mobile-sep {
    opacity: 0.55;
  }

  #ordenes-mobile-list .ux-orden-mobile-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.25rem 0.35rem;
    margin-top: 0.32rem;
    width: 100%;
  }

  #ordenes-mobile-list .ux-orden-mobile-field--estado {
    min-width: 0;
  }

  #ordenes-mobile-list .ux-orden-mobile-field--ent {
    justify-self: center;
  }

  #ordenes-mobile-list .ux-orden-mobile-field--tec {
    min-width: 0;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .ort-estado-cell {
    gap: 0.25rem;
    min-width: 0;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .ort-lamp {
    width: 8px;
    height: 8px;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .form-select {
    min-height: 30px;
    font-size: 0.72rem;
    padding: 0.1rem 1.35rem 0.1rem 0.3rem;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .ort-entregado-check {
    font-size: 0.68rem;
    gap: 0.2rem;
    white-space: nowrap;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .ort-entregado-label {
    font-size: 0.68rem;
  }

  #ordenes-mobile-list .ux-orden-mobile-field .form-check-input {
    width: 0.95rem;
    height: 0.95rem;
    margin-top: 0;
  }

  #ordenes-mobile-list .ux-mobile-card--orden .ux-kebab-btn {
    min-width: 34px;
    min-height: 34px;
    padding: 0.2rem;
  }

  .ux-kebab {
    flex-shrink: 0;
  }

  .ux-kebab-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    border-radius: 12px !important;
    border: 1px solid var(--ux-border) !important;
    background: rgba(15, 23, 42, 0.35) !important;
    color: var(--ux-text) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .ux-kebab-menu {
    min-width: 11rem;
    border-radius: 12px !important;
    padding: 0.35rem !important;
  }

  .ux-kebab-menu .dropdown-item {
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
  }

  /* Deck de controles (buscar + botón crear) */
  body.inner-app .ux-control-deck,
  body.inner-app .surface-card.p-3.d-flex,
  body.inner-app .d-flex.justify-content-between.align-items-center.mb-4 {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  /* Barras Clientes / Órdenes: recuadro compacto en smartphone */
  body.inner-app .clientes-command-bar.surface-card,
  body.inner-app .ordenes-command-bar.surface-card {
    padding: 0.3rem 0.45rem !important;
    margin-bottom: 0.5rem !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 6px rgba(2, 6, 23, 0.1) !important;
    gap: 0.35rem !important;
    align-items: stretch;
  }

  body.inner-app .clientes-command-bar.ux-control-deck,
  body.inner-app .ordenes-command-bar {
    gap: 0.35rem !important;
  }

  /* Evitar que __left crezca en alto (flex: 1 en padre column = hueco arriba/abajo) */
  body.inner-app .clientes-command-bar__left,
  body.inner-app .ordenes-command-bar__left {
    flex: 0 0 auto !important;
    align-self: stretch;
    width: 100%;
  }

  body.inner-app .search-wrap,
  body.inner-app .input-group.search-wrap {
    max-width: 100% !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
  }

  body.inner-app .clientes-command-bar__left .search-wrap,
  body.inner-app .clientes-command-bar__left .input-group.search-wrap,
  body.inner-app .ordenes-command-bar__left .ordenes-buscador {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  body.inner-app .input-group.search-wrap .input-group-text {
    padding: 0.3rem 0.45rem;
    font-size: 0.85rem;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.inner-app .input-group.search-wrap .input-group-text .bi {
    font-size: 0.9rem;
    line-height: 1;
  }

  body.inner-app .input-group.search-wrap .form-control {
    min-height: 2rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.45rem;
  }

  body.inner-app #buscadorEquipos,
  body.inner-app .custom-input[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.inner-app .clientes-buscador .form-control,
  body.inner-app .ordenes-command-bar__left #buscadorGeneral {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 2rem;
    font-size: 0.82rem;
  }

  body.inner-app .ux-control-deck > .btn,
  body.inner-app .surface-card > .btn.custom-btn {
    width: 100%;
    justify-content: center;
  }

  /* Tablas: scroll horizontal + texto legible */
  body.inner-app .table-shell,
  body.inner-app .table-responsive,
  body.inner-app .ux-data-board-wrap,
  body.inner-app .dual-scroll-shell {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto !important;
  }

  body.inner-app .table-shell .table th,
  body.inner-app .table-shell .table td {
    font-size: 0.8rem;
    padding: 0.45rem 0.4rem;
    white-space: nowrap;
  }

  body.inner-app .table .acciones {
    white-space: nowrap;
  }

  body.inner-app .btn-icon {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }

  /* Modales */
  .modal-dialog {
    margin: 0.5rem auto;
    max-width: calc(100vw - 1rem);
  }

  .modal-body .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Login */
  .login-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 0.85rem;
  }

  .login-box {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.25rem 1rem !important;
  }

  /* Filtros stock equipos */
  body.inner-app .filtros-hub {
    gap: 0.65rem;
  }

  body.inner-app .marca-filtros,
  body.inner-app .chips-row {
    gap: 0.4rem;
  }

  body.inner-app .marca-btn,
  body.inner-app .atajo-btn,
  body.inner-app .stock-btn,
  body.inner-app .banda-btn,
  body.inner-app .clear-filter-btn {
    font-size: 0.74rem;
    padding: 6px 10px;
    min-height: 28px;
    border-radius: 4px;
  }
}

@media (max-width: 400px) {
  .dashboard-nav .dashboard-grid {
    gap: 0.5rem;
  }

  .dashboard-nav .btn-ux > span:last-of-type {
    font-size: 0.72rem;
    min-height: 2.35em;
    max-height: 2.35em;
  }

  .dashboard-toolbar > a.btn {
    flex: 1 1 100%;
    font-size: 0.78rem;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .dashboard-nav .dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-nav .btn-ux {
    aspect-ratio: 1;
    min-height: 0 !important;
  }

  .dashboard-nav .btn-ux > span:last-of-type {
    font-size: 0.7rem;
    min-height: 2.2em;
    max-height: 2.2em;
  }
}

@media (min-width: 769px) {
  .ux-mobile-list {
    display: none !important;
  }
}

/* Órdenes / reparaciones: antigüedad y estado */
.ort-estado-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}
.ort-estado-cell .estado-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 6.5rem;
  width: 100%;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.2rem 1.35rem 0.2rem 0.35rem;
}
.ort-lamp {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15), 0 0 8px currentColor;
}
.ort-lamp--pendiente { background: #dc3545; color: #dc3545; }
.ort-lamp--proceso { background: #ffc107; color: #ffc107; }
.ort-lamp--finalizado { background: #20c997; color: #20c997; }
.ort-lamp--neutral { background: #6c757d; color: #6c757d; }
.ort-entregado-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
}
.ort-entregado-label { white-space: nowrap; }

/* Antigüedad: solo la punta de selección (checkbox), no toda la franja */
.ort-select-tip.ort-age-yellow {
  background-color: rgba(255, 193, 7, 0.55) !important;
}
.ort-select-tip.ort-age-orange {
  background-color: rgba(253, 126, 20, 0.55) !important;
}
.ort-select-tip.ort-age-red {
  background-color: rgba(220, 53, 69, 0.5) !important;
}
body.dark-mode .ort-select-tip.ort-age-yellow {
  background-color: rgba(255, 193, 7, 0.45) !important;
}
body.dark-mode .ort-select-tip.ort-age-orange {
  background-color: rgba(253, 126, 20, 0.45) !important;
}
body.dark-mode .ort-select-tip.ort-age-red {
  background-color: rgba(220, 53, 69, 0.42) !important;
}
body.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-yellow {
  background-color: rgba(255, 193, 7, 0.55) !important;
}
body.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-orange {
  background-color: rgba(253, 126, 20, 0.55) !important;
}
body.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-red {
  background-color: rgba(220, 53, 69, 0.5) !important;
}
body.dark-mode.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-yellow {
  background-color: rgba(255, 193, 7, 0.45) !important;
}
body.dark-mode.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-orange {
  background-color: rgba(253, 126, 20, 0.45) !important;
}
body.dark-mode.inner-app .table.ux-data-board tbody td.ort-select-tip.ort-age-red {
  background-color: rgba(220, 53, 69, 0.42) !important;
}
.ux-mobile-card-select.ort-select-tip {
  border-radius: 10px;
  padding: 0.35rem 0.4rem;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Órdenes: textos del panel y tabla siempre legibles (claro / oscuro) */
body.inner-app .orden-container #panel-activas,
body.inner-app .orden-container #panel-archivo {
  color: var(--ux-text);
}

body.inner-app .orden-container .ux-list-heading {
  color: var(--ux-text) !important;
}

body.inner-app .orden-container .ux-list-kicker {
  color: var(--ux-muted) !important;
}

body.inner-app .orden-container .ux-list-sub,
body.inner-app .orden-container .ort-leyenda-nota,
body.inner-app .orden-container #ordenesSeleccionCount {
  color: var(--ux-muted) !important;
}

body.inner-app .orden-container .table.ux-data-board .ux-cell-strong {
  color: inherit !important;
}

body.inner-app .orden-container .table.ux-data-board .ux-cell-muted {
  color: var(--ux-muted) !important;
}

body.dark-mode.inner-app .orden-container .table.ux-data-board thead th,
body.dark-mode.inner-app .orden-container .table.ux-data-board thead th .btn-link {
  color: #94a3b8 !important;
}

body.dark-mode.inner-app .orden-container .ux-ordenes-tabs .nav-link {
  color: #cbd5e1 !important;
}

body.dark-mode.inner-app .orden-container .ux-ordenes-tabs .nav-link.active {
  color: #fff !important;
}

body.dark-mode.inner-app .orden-container .form-control,
body.dark-mode.inner-app .orden-container .form-select {
  color: #f1f5f9 !important;
}

/* Post-it leyenda (Órdenes en sistema) */
.ort-postit {
  --ort-postit-ink: #3f3a32;
  --ort-postit-muted: #6b6458;
  position: relative;
  width: min(100%, 22rem);
  margin: 0 0 1rem;
  padding: 1rem 1.05rem 1.05rem;
  border-radius: 2px 2px 3px 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 28%),
    #f3ead2;
  color: var(--ort-postit-ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 10px 22px -14px rgba(15, 23, 42, 0.45),
    0 2px 6px rgba(15, 23, 42, 0.08);
  transform: rotate(-0.6deg);
  transform-origin: top center;
}
.ort-postit__pin {
  position: absolute;
  top: -0.35rem;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  margin-left: -0.35rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f8fafc, #94a3b8 55%, #64748b);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}
.ort-postit__title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ort-postit-muted);
}
.ort-postit__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ort-postit__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ort-postit-ink);
}
.ort-postit .ort-lamp {
  width: 9px;
  height: 9px;
  margin-top: 0.28rem;
  flex-shrink: 0;
}
.ort-leyenda-hint {
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 400;
  color: var(--ort-postit-muted);
}

body.dark-mode .ort-postit {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 30%),
    #e8dfc4;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 14px 28px -16px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 575.98px) {
  .ort-postit {
    width: 100%;
    transform: none;
  }
}

.ort-seleccion-toolbar {
  border-radius: 16px;
}

.ux-mobile-card-select {
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.ux-mobile-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
  align-self: center;
}

.ux-mobile-card-actions .btn-icon {
  min-width: 42px;
  min-height: 42px;
}

.print-preview-actions .btn {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .print-preview-card {
    width: 100%;
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
  }

  .word-viewer-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .word-viewer-card {
    width: 100%;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
  }

  .word-viewer-header {
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .word-viewer-header strong {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .word-viewer-header button {
    min-height: 44px;
    min-width: 5.5rem;
  }

  #pdfViewerIframe {
    height: calc(100vh - 4.5rem - env(safe-area-inset-bottom, 0px)) !important;
  }

  .print-preview-actions {
    width: 100%;
    justify-content: stretch;
  }

  .print-preview-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  #printPreviewIframe.d-none {
    display: none !important;
  }
}

/* Panel colapsable reutilizable (cabecera con flechita). Mismo estilo que equipos.html. */
.ux-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ux-collapse-toggle:hover,
.ux-collapse-toggle:focus-visible {
  background: rgba(148, 163, 184, 0.14);
  outline: none;
}

body.dark-mode .ux-collapse-toggle:hover,
body.dark-mode .ux-collapse-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.ux-collapse-toggle .ux-collapse-chevron {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.ux-collapse-toggle:not(.collapsed) .ux-collapse-chevron {
  transform: rotate(180deg);
}

.ux-collapse-panel .ux-collapse-toggle.collapsed {
  border-radius: 0.375rem;
}

.ux-collapse-panel .ux-collapse-toggle:not(.collapsed) {
  border-radius: 0.375rem 0.375rem 0 0;
}

.ux-collapse-body {
  border-color: rgba(148, 163, 184, 0.25) !important;
}

body.dark-mode .ux-collapse-body {
  border-color: rgba(148, 163, 184, 0.18) !important;
}

/* Facturas: el nombre del archivo es clickeable y abre el PDF (como el botón "Ver"). */
.facturas-page #tablaFacturas td .factura-nombre-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.facturas-page #tablaFacturas td .factura-nombre-link:hover,
.facturas-page #tablaFacturas td .factura-nombre-link:focus-visible {
  text-decoration: underline;
}

/* Facturas: menos scroll horizontal en tablet (tabla con muchas acciones) */
@media (min-width: 769px) and (max-width: 1200px) {
  .facturas-page #tablaFacturas {
    font-size: 0.85rem;
  }

  .facturas-page #tablaFacturas th:first-child,
  .facturas-page #tablaFacturas td:first-child {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .facturas-page #tablaFacturas td.acciones {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .facturas-page #tablaFacturas td.acciones .btn-ver-pdf {
    font-size: 0;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .facturas-page #tablaFacturas td.acciones .btn-ver-pdf .bi {
    font-size: 1rem;
    margin: 0 !important;
  }

  .facturas-page #tablaFacturas td.acciones .btn-outline-secondary {
    padding: 0.25rem 0.4rem;
  }
}

/* ==========================================================
   Facturas — formulario y listado (smartphone)
   ========================================================== */

.facturas-page .facturas-upload-card .card-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.facturas-page .facturas-upload-card .form-label {
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.facturas-page .facturas-upload-card .form-control[type="file"] {
  padding: 0.55rem 0.65rem;
}

@media (max-width: 768px) {
  .facturas-page.container-fluid,
  .facturas-page {
    padding-top: 0.85rem !important;
    padding-bottom: 1rem !important;
  }

  .facturas-page .page-toolbar {
    margin-bottom: 0.85rem !important;
  }

  .facturas-page .surface-card .card-body {
    padding: 1rem !important;
  }

  /* Formulario de subida: una columna, controles táctiles */
  .facturas-page .facturas-upload-card .row.g-2 > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .facturas-page .facturas-upload-card .form-control,
  .facturas-page .facturas-upload-card .form-control[type="file"] {
    min-height: 2.85rem;
    font-size: 1rem;
  }

  .facturas-page .facturas-upload-card #btnSubirFacturas {
    min-height: 48px;
    font-size: 1rem;
    border-radius: 12px !important;
    margin-top: 0.25rem;
  }

  .facturas-page .facturas-upload-card .progress {
    height: 1.35rem !important;
    border-radius: 999px;
    overflow: hidden;
  }

  .facturas-page .facturas-upload-card #facturaSeleccionResumen {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  /* Barra buscar + borrar todo */
  .facturas-page .facturas-list-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }

  .facturas-page .facturas-list-toolbar .search-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  .facturas-page .facturas-list-toolbar #btnBorrarTodasFacturas {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .facturas-page .facturas-paginacion {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .facturas-page .facturas-paginacion .btn-group {
    width: 100%;
    display: flex;
  }

  .facturas-page .facturas-paginacion .btn-group .btn {
    flex: 1 1 50%;
    min-height: 44px;
  }

  .facturas-page .facturas-page-info {
    text-align: center;
  }

  /* Tabla → tarjetas en móvil */
  .facturas-page .table-shell.ux-data-board {
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    padding: 0;
  }

  .facturas-page #tablaFacturas {
    border-collapse: separate;
    border-spacing: 0;
  }

  .facturas-page #tablaFacturas thead {
    display: none;
  }

  .facturas-page #tablaFacturas tbody tr {
    display: block;
    margin-bottom: 0.7rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--ux-border);
    background: var(--ux-surface);
    box-shadow: var(--ux-shadow-soft);
  }

  body.dark-mode .facturas-page #tablaFacturas tbody tr {
    background: var(--ux-surface-solid);
  }

  .facturas-page #tablaFacturas tbody td {
    display: block;
    border: none;
    padding: 0.2rem 0;
    white-space: normal;
    word-break: break-word;
    font-size: 0.88rem;
  }

  .facturas-page #tablaFacturas tbody td:first-child {
    font-weight: 700;
    font-size: 0.95rem;
    padding-bottom: 0.45rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--ux-border);
  }

  .facturas-page #tablaFacturas tbody td:nth-child(2)::before,
  .facturas-page #tablaFacturas tbody td:nth-child(3)::before {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ux-muted);
    margin-bottom: 0.12rem;
  }

  .facturas-page #tablaFacturas tbody td:nth-child(2)::before {
    content: "Tamaño";
  }

  .facturas-page #tablaFacturas tbody td:nth-child(3)::before {
    content: "Modificado";
  }

  .facturas-page #tablaFacturas tbody td.acciones {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--ux-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
  }

  .facturas-page #tablaFacturas tbody td.acciones .btn {
    min-height: 40px;
  }

  .facturas-page #tablaFacturas tbody td.acciones .btn-ver-pdf {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
  }

  .facturas-page #tablaFacturas tbody td.acciones .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .facturas-page #tablaFacturas tbody tr:has(td[colspan]) {
    display: block;
    margin-bottom: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .facturas-page #tablaFacturas tbody tr:has(td[colspan]) td {
    display: block;
    border: none;
    text-align: center;
    padding: 1.25rem 0.5rem;
    font-weight: 400;
    font-size: 0.88rem;
  }

  .facturas-page #tablaFacturas tbody tr:has(td[colspan]) td::before {
    display: none !important;
  }

  .facturas-page #tablaFacturas tbody tr:has(td[colspan]) td:first-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 1.25rem;
  }

  .facturas-page .facturas-sort-th {
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .facturas-page .toolbar-actions form .btn .bi-box-arrow-right + *,
  .facturas-page .toolbar-actions form .btn {
    font-size: 0.78rem;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .facturas-page #tablaFacturas tbody td.acciones .btn-ver-pdf {
    width: 100%;
    flex: 1 1 100%;
  }
}

/* Panel Arinc (dashboard de módulos) */
@media (max-width: 768px) {
  body.arinc-dashboard-page .page-toolbar {
    margin-bottom: 1rem !important;
  }

  body.arinc-dashboard-page .dashboard-nav .dashboard-grid {
    grid-template-columns: 1fr;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }

  body.arinc-dashboard-page .dashboard-nav .btn-ux {
    min-height: 120px;
    aspect-ratio: 1.15;
  }
}

@media (max-width: 400px) {
  body.arinc-dashboard-page .dashboard-nav .btn-ux {
    min-height: 108px;
  }
}

.ort-orden-check {
  cursor: pointer;
}

/* --- Accesibilidad: enlace "saltar al contenido" y foco visible --- */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.5rem;
  z-index: 1080;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--primary, #3a7bd5);
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-120%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
  outline: none;
}

.botonera .btn-ux:focus-visible,
a.btn-ux:focus-visible {
  outline: 3px solid var(--primary, #3a7bd5);
  outline-offset: 4px;
}

.top-controls button:focus-visible,
.btn-icon:focus-visible,
.dashboard-user-menu-toggle:focus-visible,
.btn-logout-compact:focus-visible {
  outline: 3px solid var(--primary, #3a7bd5);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .botonera a,
  .botonera .btn-ux,
  a.btn-ux,
  .top-controls button {
    transition: none !important;
  }
}

/* PWA: aviso de instalación en móvil */
body.pwa-banner-visible {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.pwa-install-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1080;
  padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(11, 18, 32, 0.92) 24%);
  pointer-events: none;
}

.pwa-install-banner[hidden] {
  display: none !important;
}

.pwa-install-banner__inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 520px;
  margin: 0 auto;
  padding: 0.75rem 2.25rem 0.75rem 0.85rem;
  border-radius: 14px;
  background: #1a2332;
  border: 1px solid rgba(58, 123, 213, 0.45);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  position: relative;
}

.pwa-install-banner__icon {
  border-radius: 12px;
  flex-shrink: 0;
}

.pwa-install-banner__text {
  flex: 1;
  min-width: 0;
}

.pwa-install-banner__title {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.pwa-install-banner__hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
}

.pwa-install-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pwa-install-banner__btn {
  white-space: nowrap;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pwa-install-banner__btn--primary {
  background: #3a7bd5;
  color: #fff;
}

.pwa-install-banner__btn--ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
}

.pwa-install-banner__close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.pwa-install-banner__close:hover {
  color: #fff;
}

@media (max-width: 400px) {
  .pwa-install-banner__inner {
    flex-wrap: wrap;
  }
  .pwa-install-banner__actions {
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
  }
}
