/* ─── Interfaz (PRE, noviembre 2026) ─────────────────────────────────────────
 *
 * Una capa sobre main.css que pone toda la aplicación en un solo sistema. Se
 * carga después de main.css (escritorio) y de los estilos de movil/base.html,
 * así que quitar su <link> devuelve la interfaz anterior sin tocar nada más.
 *
 * Dirección (pasada «unslop», de Damir Sokolovsky, CC BY 4.0):
 *   Producto  · gestiona un taller de persianas, toldos y servicios: del aviso
 *               del cliente a la medición, el presupuesto, el montaje y el
 *               cobro; la oficina en el escritorio, los técnicos en el móvil.
 *   Carácter  · ordenado, directo, de oficio.
 *   Mundo     · el parte de trabajo y el aluminio de las lamas: papel claro,
 *               gris metálico, tinta azul del albarán.
 *   Momentos  · la ruta del día en «Hoy» y lo que queda por cobrar; dentro de
 *               una ficha, la persiana de estado.
 *   Firma     · la persiana de estado (las lamas que se llenan), y nada más.
 *
 * Reglas que sigue esta capa:
 *   - Superficies, bordes y texto salen de una escala de grises fríos. El color
 *     lo llevan el azul de la marca (una vez por pantalla), los estados y los
 *     tipos de trabajo, nunca los fondos.
 *   - Todo en una rejilla de 4 px. Radios: controles 8, tarjetas 12, paneles 14.
 *   - Archivo para todo y Plex Mono para cifras. Pesos 400 y 500 (600 solo en
 *     algún número). Nada en mayúsculas ni con espaciado ancho.
 *   - Movimiento solo de color y fondo, con una curva y dos duraciones.
 * ────────────────────────────────────────────────────────────────────────── */

:root {
  --sidebar-width: 248px;
  --topbar-height: 56px;
  --page-max: 1440px;

  --canvas: #F6F7F8;
  --surface: #FFFFFF;
  --surface-sunken: #F1F3F5;
  --surface-hover: #EEF0F3;
  --border: #E2E5E9;
  --border-strong: #CCD1D7;
  --border-soft: #ECEEF1;
  --text-1: #12171D;
  --text-2: #4A5360;
  --text-3: #687180;

  --accent: #0969C7;
  --accent-hover: #0858A8;
  --accent-soft: #E8F1FB;
  --accent-soft-strong: #CFE2F6;
  --accent-text: #0858A8;
  --accent-contrast: #FFFFFF;

  --success: #12795A;  --success-soft: #E4F3EC;
  --warning: #93590A;  --warning-soft: #F8EEDD;
  --danger:  #B4271C;  --danger-soft:  #FAE7E4;

  --cat-montaje: #12795A;   --cat-montaje-soft: #E4F3EC;
  --cat-arreglo: #93590A;   --cat-arreglo-soft: #F8EEDD;
  --cat-medicion: #0969C7;  --cat-medicion-soft: #E8F1FB;
  --cat-presupuesto: #4A5360; --cat-presupuesto-soft: #EEF0F3;
  --cat-material: #6E5636;  --cat-material-soft: #F1ECE4;

  --lama-hecha: #12795A;
  --lama-actual: #0969C7;
  --lama-vacia: #D9DDE2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(18, 23, 29, .05);
  --shadow-md: 0 8px 24px rgba(18, 23, 29, .07);
  --shadow-pop: 0 12px 32px rgba(18, 23, 29, .12);

  --curva: cubic-bezier(.22, 1, .36, 1);

  /* La barra lateral deja de ser marino: es la superficie más quieta de la
     pantalla, y el contenido lleva el color. */
  --color-sidebar: #F1F3F5;
  --color-sidebar-text: #4A5360;
  --color-sidebar-active: #12171D;
  --rail-linea: #E2E5E9;
  --rail-hover: rgba(18, 23, 29, .05);
  --rail-marca: transparent;

  --bs-primary: #0969C7;
  --bs-primary-rgb: 9, 105, 199;
  --bs-link-color: #0969C7;
  --bs-link-color-rgb: 9, 105, 199;
  --bs-link-hover-color: #0858A8;
  --bs-body-bg: #FFFFFF;
  --bs-body-color: #12171D;
  --bs-emphasis-color: #12171D;
  --bs-secondary-color: #4A5360;
  --bs-tertiary-bg: #F1F3F5;
  --bs-border-color: #E2E5E9;
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 12px;
  --bs-border-radius-xl: 14px;
  --bs-border-radius-pill: 6px;
  --bs-focus-ring-color: rgba(9, 105, 199, .22);
}

:root[data-tema="oscuro"] {
  --canvas: #111214;
  --surface: #17181B;
  --surface-sunken: #131416;
  --surface-hover: #1F2125;
  --border: #26282D;
  --border-strong: #34373D;
  --border-soft: #1F2125;
  --text-1: #ECEDEF;
  --text-2: #A5A9B1;
  --text-3: #878C95;

  --accent: #4DA3F7;
  --accent-hover: #6CB4F8;
  --accent-soft: #14263A;
  --accent-soft-strong: #1B3350;
  --accent-text: #7DBCF9;
  --accent-contrast: #08131F;

  --success: #4CC38A;  --success-soft: #13261E;
  --warning: #E1A54B;  --warning-soft: #2A2113;
  --danger:  #EF6F66;  --danger-soft:  #2E1715;

  --cat-montaje: #4CC38A;   --cat-montaje-soft: #13261E;
  --cat-arreglo: #E1A54B;   --cat-arreglo-soft: #2A2113;
  --cat-medicion: #4DA3F7;  --cat-medicion-soft: #14263A;
  --cat-presupuesto: #A5A9B1; --cat-presupuesto-soft: #1F2125;
  --cat-material: #C7A77A;  --cat-material-soft: #262019;

  --lama-hecha: #4CC38A;
  --lama-actual: #4DA3F7;
  --lama-vacia: #2C2F34;

  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .45);

  --color-sidebar: #0E0F11;
  --color-sidebar-text: #A5A9B1;
  --color-sidebar-active: #ECEDEF;
  --rail-linea: #1F2125;
  --rail-hover: rgba(236, 237, 239, .06);

  --bs-primary: #4DA3F7;
  --bs-primary-rgb: 77, 163, 247;
  --bs-link-color: #4DA3F7;
  --bs-link-color-rgb: 77, 163, 247;
  --bs-link-hover-color: #6CB4F8;
  --bs-body-bg: #17181B;
  --bs-body-color: #ECEDEF;
  --bs-emphasis-color: #ECEDEF;
  --bs-secondary-color: #A5A9B1;
  --bs-tertiary-bg: #131416;
  --bs-border-color: #26282D;
}

/* ─── Texto ──────────────────────────────────────────────────────────────── */

body { background: var(--canvas); color: var(--text-1); font-size: 14px; line-height: 1.5; }

/* Nada en mayúsculas con espaciado ancho: eran las etiquetas de sección, las
   cabeceras de tabla y los rótulos de las tarjetas. Los campos de CIF, DNI o
   matrícula sí siguen en mayúsculas: ahí es el dato. */
body *:not(input):not(textarea):not(select):not(.mantener-mayus) {
  text-transform: none !important;
  letter-spacing: normal !important;
}
.text-uppercase { text-transform: none !important; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 500; color: var(--text-1); }
h4, .h4 { font-size: 20px; }
h5, .h5 { font-size: 16px; }
h6, .h6 { font-size: 14px; }
b, strong, .fw-bold, .fw-bolder { font-weight: 500 !important; }
.fw-semibold { font-weight: 500 !important; }
em, i:not(.bi) { font-style: normal; }

.text-muted, .text-secondary { color: var(--text-3) !important; }
.text-body-secondary { color: var(--text-2) !important; }
.small, small { font-size: 12.5px; }

.num, .mono, .stat-value, .importe, td.text-end, th.text-end { font-variant-numeric: tabular-nums; }

/* ─── Marco: barra lateral ───────────────────────────────────────────────── */

.sidebar {
  background: var(--color-sidebar);
  border-right: 1px solid var(--rail-linea);
  padding: 16px 12px 12px;
  gap: 12px;
}
.sidebar-brand { padding: 4px 8px 4px; }
.marca-sidebar { height: 22px; }
.marca-en-claro { display: inline-block; }
.marca-en-oscuro { display: none; }
:root[data-tema="oscuro"] .marca-en-claro { display: none; }
:root[data-tema="oscuro"] .marca-en-oscuro { display: inline-block; }

.empresa-badge,
.empresa-badge.riel-empresa {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--rail-linea);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}
.empresa-badge small { color: var(--text-3) !important; font-size: 12px !important; margin-bottom: 0; }
.empresa-badge.riel-empresa strong { color: var(--text-1); font-size: 13px; font-weight: 500; }
.empresa-badge.riel-empresa .bi { color: var(--text-3); }
.empresa-badge.riel-empresa:not(:disabled):hover { background: var(--surface-hover); }

.sidebar-nav .nav-section,
.nav-section {
  padding: 20px 10px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  opacity: 1;
}
.sidebar-nav .nav-link {
  height: 34px;
  padding: 0 10px;
  margin-bottom: 2px;
  gap: 10px;
  color: var(--color-sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  transition: background-color .14s var(--curva), color .14s var(--curva);
}
.sidebar-nav .nav-link i { font-size: 16px; width: 18px; opacity: 1; color: var(--text-3); }
.sidebar-nav .nav-link:hover { background: var(--rail-hover); color: var(--text-1); }
.sidebar-nav .nav-link:hover i { color: var(--text-2); }
.sidebar-nav .nav-link.active {
  background: var(--surface);
  color: var(--text-1);
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--rail-linea), var(--shadow-sm);
}
.sidebar-nav .nav-link.active i { color: var(--accent); }
.sidebar-nav .nav-link.active::before { content: none; }
.sidebar-nav .nav-link .cuenta { color: var(--text-3); font-size: 12px; }
.sidebar-nav .nav-link .cuenta.aviso {
  color: var(--warning); background: var(--warning-soft); border-radius: 6px; padding: 0 6px; font-weight: 500;
}
.sidebar-nav .nav-link .badge { border-radius: 6px; font-weight: 500; }

.sidebar-footer { border-top: 1px solid var(--rail-linea); padding: 8px 0 0; }
.riel-pie { padding: 8px; border-radius: var(--radius-sm); color: var(--text-2); }
.riel-pie:hover { background: var(--rail-hover); }
.riel-pie b { color: var(--text-1); font-weight: 500; font-size: 13px; }
.riel-pie small { color: var(--text-3); font-size: 12px; }
.sidebar .avatar { background: var(--surface-hover); color: var(--text-2); }
.avatar { font-weight: 500; font-size: 11px; background: var(--surface-hover); color: var(--text-2); }
.avatar.t { background: var(--surface-hover); color: var(--text-2); }

.sidebar-footer .btn-outline-secondary,
.sidebar-footer .btn-outline-danger {
  --bs-btn-color: var(--text-2);
  --bs-btn-border-color: var(--rail-linea);
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-hover-bg: var(--rail-hover);
  --bs-btn-hover-border-color: var(--border-strong);
}

/* ─── Marco: barra superior ──────────────────────────────────────────────── */

.topbar {
  height: var(--topbar-height);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  gap: 16px;
}
.migas { font-size: 13.5px; }
.migas b { font-weight: 500; }
.buscador {
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border-color: var(--border);
  gap: 8px;
  padding: 0 12px;
}
.buscador input { font-size: 13.5px; padding: 0; }
.buscador:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-fecha { font-size: 12px; color: var(--text-3); }
.icono-btn,
.topbar .btn-outline-secondary,
.topbar .btn-outline-success,
.topbar .btn-outline-danger {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border-color: var(--border); background: var(--surface); color: var(--text-2);
}
.icono-btn:hover { background: var(--surface-hover); color: var(--text-1); }

/* ─── Página ─────────────────────────────────────────────────────────────── */

.page-content { max-width: var(--page-max); padding: 32px 32px 64px; }
.page-content.ancho-completo { padding: 24px 32px 32px; }

/* Las tres cabeceras de pantalla que había (la caja con icono de las pantallas
   antiguas, `.page-header` y la nueva `.cabecera`) se leen igual: título
   grande sin caja ni icono, la entradilla en gris y las acciones a la derecha. */
.op-hero {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 24px;
  overflow: visible;
}
.op-hero h1,
.page-header h1,
.page-header h2,
.titulo {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  font-stretch: 108%;
  color: var(--text-1);
  margin: 0;
}
/* Cualquier otro <h1> de pantalla, al mismo tamaño. */
.page-content h1 { font-size: 28px; font-weight: 500; line-height: 1.15; margin-bottom: 0; }

/* Ningún título de pantalla lleva icono: el título ya dice dónde estás. */
.page-content h1 > .bi,
.page-header h2 > .bi:first-child { display: none; }
.page-header { margin-bottom: 24px; gap: 12px 16px; align-items: flex-end; }
.cabecera { margin-bottom: 24px; gap: 12px 24px; }
.antetitulo { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.resumen { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.resumen b { font-weight: 500; }

/* ─── Tarjetas y bloques ─────────────────────────────────────────────────── */

.card, .bloque, .tabla-caja, .acciones-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.border-0 { border: 1px solid var(--border) !important; }
.card.shadow-sm, .card.shadow { box-shadow: var(--shadow-sm) !important; }
.card-header,
.card-header.bg-white,
.card-header.bg-light,
.card-header.bg-transparent {
  background: transparent !important;
  border-bottom: 1px solid var(--border-soft) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: 14px 20px;
  font-weight: 500;
}
.card-header h5, .card-header h6, .card-header .h5, .card-header .h6 {
  font-size: 14px; font-weight: 500; margin: 0;
}
.card-header .badge.bg-light, .card-header .badge.bg-secondary {
  background: none !important; border: 0 !important; color: var(--text-3) !important;
  font-family: var(--font-mono); font-weight: 400; padding: 0 0 0 4px;
}
.card-footer { background: transparent; border-top: 1px solid var(--border-soft); padding: 12px 20px; }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0 !important; }
.card.p-3 { padding: 16px !important; }

/* Los iconos de color delante de cada título no decían nada que no dijera
   el título. */
.card-title-ico { display: none; }

.bloque { border-radius: var(--radius); }
.bloque-cab { padding: 16px 20px 12px; }
.bloque-cab h2 { font-size: 14px; font-weight: 500; }
.bloque-cab .meta { font-size: 12.5px; color: var(--text-3); }
.etiqueta { font-size: 12.5px; font-weight: 400; color: var(--text-3); }

.bg-white { background-color: var(--surface) !important; }
.bg-light { background-color: var(--surface-sunken) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }

/* ─── Cifras ─────────────────────────────────────────────────────────────── */

.stat-grid { gap: 12px; margin-bottom: 24px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.stat-card,
.stat-grid .stat-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label,
.stat-grid .stat-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
  padding-right: 0;
  min-height: 0;
  line-height: 1.35;
}
.stat-card .stat-value,
.stat-grid .stat-value {
  font-size: 24px;
  font-weight: 500;
  margin-top: 8px;
  line-height: 1.1;
}
.stat-card .stat-icon { display: none; }
.stat-nota { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ─── Tablas ─────────────────────────────────────────────────────────────── */

.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--surface-hover); margin-bottom: 0; }
.table th,
.table > thead > tr > th,
.tabla th,
thead.bg-light th,
thead.table-light th {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-3);
  background: transparent !important;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}
thead.bg-light, thead.table-light { background: transparent !important; }
.table td { font-size: 13.5px; padding: 12px 16px; border-bottom-color: var(--border-soft); }
.tabla td { padding: 0 16px; height: 52px; font-size: 13.5px; border-bottom-color: var(--border-soft); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr:hover > *,
.tabla tbody tr.fila-enlace:hover td { background-color: var(--surface-hover); }
.table td a.fw-semibold, .table td a.fw-bold { color: var(--text-1); font-weight: 500 !important; }
.table td a.fw-semibold:hover, .table td a.fw-bold:hover { color: var(--accent); }
.tabla .cod { font-weight: 400; }

/* Los botones de acción de una fila: iconos grises del mismo tamaño. El rojo de
   borrar solo aparece al pasar por encima. Antes había ojo azul, lápiz gris,
   archivo naranja y papelera roja en cada fila. */
.table td .btn-sm.btn-outline-primary,
.table td .btn-sm.btn-outline-secondary,
.table td .btn-sm.btn-outline-success,
.table td .btn-sm.btn-outline-warning,
.table td .btn-sm.btn-outline-info,
.table td .btn-sm.btn-outline-danger,
.table td .btn-sm.btn-light,
.table td .btn-xs {
  --bs-btn-color: var(--text-3);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-color: var(--text-1);
  --bs-btn-active-bg: var(--surface-hover);
  min-width: 32px;
  height: 32px;
}
.table td .btn-xs.btn-outline-danger, .table td .btn-sm.btn-outline-danger { --bs-btn-hover-color: var(--danger); --bs-btn-hover-bg: var(--danger-soft); }

/* Los cuatro huecos fijos de `.acciones-fila`: mismo tratamiento. */
.acciones-fila { gap: 2px; }
.acciones-fila .btn,
.acciones-fila .btn-xs {
  --bs-btn-color: var(--text-3);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--text-1);
  --bs-btn-active-bg: var(--surface-hover);
  --bs-btn-disabled-color: transparent;
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}
.acciones-fila .btn .bi { font-size: 15px; }
.acciones-fila .btn-outline-danger,
.acciones-fila .btn-danger { --bs-btn-hover-color: var(--danger); --bs-btn-hover-bg: var(--danger-soft); }
.acciones-fila .hueco { width: 32px; border: 0; padding: 0; background: none; }

/* Las cifras y los códigos de una fila, en una sola línea: «2.670,00 €» partido
   en dos se leía como dos números. */
.table td:has(> strong:only-child), .table td:has(> small:only-child),
.table td.num, .table td .num { white-space: nowrap; }
/* Dentro de una tabla, las cifras van en la letra del texto con números de
   ancho fijo: la columna se alinea igual y no mezcla dos letras en una fila. */
.table td.num, .table td .num { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.badge.bg-primary { background: var(--accent-soft) !important; color: var(--accent-text) !important; }

/* Insignias «sólidas» de Bootstrap (`text-bg-*`): el mismo tono suave que el
   resto de estados. */
.text-bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.text-bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.text-bg-danger  { background: var(--danger-soft) !important; color: var(--danger) !important; }
.text-bg-info, .text-bg-primary { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.text-bg-secondary, .text-bg-light { background: var(--surface-sunken) !important; color: var(--text-2) !important; }

/* Códigos y fechas de documento, en una línea. */
.table td:has(> a.fw-bold), .table td.text-nowrap, .table td .text-nowrap { white-space: nowrap; }

/* ─── Botones ────────────────────────────────────────────────────────────── */

.btn {
  --bs-btn-font-weight: 500;
  font-weight: 500;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  min-height: 36px;
  padding: 0 14px;
  gap: 6px;
  transition: background-color .14s var(--curva), border-color .14s var(--curva), color .14s var(--curva), transform .1s var(--curva);
  box-shadow: none;
}
.btn:active { transform: scale(.98); }
.btn-sm { font-size: 13px; min-height: 32px; padding: 0 12px; border-radius: var(--radius-sm); }
.btn-lg { font-size: 15px; min-height: 44px; padding: 0 20px; border-radius: 10px; }
.btn-xs { font-size: 12px; min-height: 26px; padding: 0 8px; border-radius: 6px; }
.btn .bi { font-size: 15px; }
.btn > .bi.me-1, .btn > .bi.me-2 { margin-right: 0 !important; }

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-color: var(--accent-contrast);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-hover-color: var(--accent-contrast);
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
}

/* Botón secundario: superficie con borde fino y tinta normal. Los «outline»
   de colores se juntan aquí: con azul, verde y morado en cada pantalla no se
   sabía cuál era la acción principal. */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-dark,
.btn-light,
.btn-secondary {
  --bs-btn-color: var(--text-1);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-color: var(--text-1);
  --bs-btn-active-bg: var(--surface-hover);
  --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-color: var(--text-3);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--border);
}
.btn-check:checked + .btn-outline-primary,
.btn-check:checked + .btn-outline-secondary,
.btn-outline-primary.active,
.btn-outline-secondary.active {
  --bs-btn-active-bg: var(--text-1);
  --bs-btn-active-color: var(--surface);
  --bs-btn-active-border-color: var(--text-1);
}
.btn-outline-warning {
  --bs-btn-color: var(--warning);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--warning);
  --bs-btn-hover-bg: var(--warning-soft);
  --bs-btn-hover-border-color: var(--border-strong);
}
.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--danger);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  --bs-btn-active-color: var(--danger);
  --bs-btn-active-bg: var(--danger-soft);
}
.btn-success, .btn-info {
  --bs-btn-bg: var(--text-1);
  --bs-btn-border-color: var(--text-1);
  --bs-btn-color: var(--surface);
  --bs-btn-hover-bg: color-mix(in srgb, var(--text-1) 86%, var(--surface));
  --bs-btn-hover-border-color: color-mix(in srgb, var(--text-1) 86%, var(--surface));
  --bs-btn-hover-color: var(--surface);
}
.btn-warning {
  --bs-btn-bg: var(--warning-soft); --bs-btn-border-color: transparent; --bs-btn-color: var(--warning);
  --bs-btn-hover-bg: color-mix(in srgb, var(--warning-soft) 80%, var(--warning));
  --bs-btn-hover-color: var(--warning); --bs-btn-hover-border-color: transparent;
}
.btn-danger {
  --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-color: #fff;
  --bs-btn-hover-bg: color-mix(in srgb, var(--danger) 88%, #000); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: #fff;
}
.btn-link { --bs-btn-color: var(--accent); --bs-btn-hover-color: var(--accent-hover); min-height: 0; padding-left: 0; padding-right: 0; }
.btn-cta-primary { border-radius: var(--radius-sm); font-weight: 500; min-height: 40px; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.btn-group > .btn:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }

/* ─── Formularios ────────────────────────────────────────────────────────── */

.form-control, .form-select {
  min-height: 36px;
  border-radius: var(--radius-sm);
  border-color: var(--border-strong);
  background-color: var(--surface);
  color: var(--text-1);
  font-size: 14px;
  padding: 6px 12px;
  transition: border-color .14s var(--curva), box-shadow .14s var(--curva);
}
.form-control-sm, .form-select-sm { min-height: 32px; font-size: 13px; border-radius: var(--radius-sm); padding: 4px 10px; }
.form-control-lg, .form-select-lg { min-height: 44px; font-size: 15px; border-radius: 10px; }
textarea.form-control { min-height: 0; }
.form-control::placeholder { color: var(--text-3); opacity: 1; }
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-label { font-size: 13px; font-weight: 500; color: var(--text-1); margin-bottom: 6px; }
.form-text { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.input-group-text { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--text-2); font-size: 13.5px; }
.input-group > .form-control, .input-group > .form-select, .input-group > .input-group-text, .input-group > .btn { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--radius-sm) !important; border-bottom-left-radius: var(--radius-sm) !important; }
.input-group > :last-child { border-top-right-radius: var(--radius-sm) !important; border-bottom-right-radius: var(--radius-sm) !important; }

/* ─── Estados, etiquetas, avisos ─────────────────────────────────────────── */

.badge {
  font-weight: 500;
  font-size: 12px;
  border-radius: 6px;
  padding: 3px 8px;
  line-height: 1.35;
}
.badge.rounded-pill { border-radius: 6px !important; }
.badge.bg-light.text-dark, .badge.bg-light, .badge.bg-secondary {
  background: var(--surface-sunken) !important; color: var(--text-2) !important; border-color: var(--border) !important;
}

.alert {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  padding: 12px 16px;
  font-size: 13.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert > .bi:first-child { font-size: 16px; margin-top: 1px; }
.alert-success { border-color: color-mix(in srgb, var(--success) 25%, var(--border)); background: var(--success-soft); }
.alert-success > .bi:first-child { color: var(--success); }
.alert-warning { border-color: color-mix(in srgb, var(--warning) 25%, var(--border)); background: var(--warning-soft); }
.alert-warning > .bi:first-child { color: var(--warning); }
.alert-danger { border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); background: var(--danger-soft); }
.alert-danger > .bi:first-child { color: var(--danger); }
.alert-info, .alert-primary { border-color: color-mix(in srgb, var(--accent) 20%, var(--border)); background: var(--accent-soft); }
.alert-info > .bi:first-child, .alert-primary > .bi:first-child { color: var(--accent); }
.alert .btn-close { margin-left: auto; }
.alert-dismissible { padding-right: 48px; }

/* ─── Menús, modales, pestañas ───────────────────────────────────────────── */

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  background: var(--surface);
  font-size: 13.5px;
}
.dropdown-item { border-radius: 8px; padding: 6px 10px; color: var(--text-1); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-hover); color: var(--text-1); }
.dropdown-item.active, .dropdown-item:active { background: var(--accent-soft); color: var(--accent-text); }
.dropdown-divider { border-color: var(--border-soft); margin: 4px 0; }

.modal-content { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); background: var(--surface); }
.modal-header { border-bottom: 1px solid var(--border-soft); padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 500; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border-soft); padding: 12px 20px; gap: 8px; }
.modal-footer > * { margin: 0; }

.nav-tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--text-2); font-size: 13.5px; font-weight: 400; padding: 8px 4px; margin-right: 16px;
  transition: color .14s var(--curva), border-color .14s var(--curva);
}
.nav-tabs .nav-link:hover { color: var(--text-1); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active { color: var(--text-1); font-weight: 500; background: none; border-bottom-color: var(--text-1); }
.nav-pills .nav-link { border-radius: var(--radius-sm); color: var(--text-2); }
.nav-pills .nav-link.active { background: var(--surface); color: var(--text-1); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm); }

.segmentos { border-radius: var(--radius-sm); }
.segmentos a, .segmentos span { padding: 0 12px; height: 34px; align-items: center; font-size: 13px; }
.segmentos .on, .segmentos .on:hover { font-weight: 500; }
.desplegable { height: 34px; border-radius: var(--radius-sm); padding: 0 12px; font-size: 13px; }
.desplegable b { font-weight: 500; }

.list-group-item { border-color: var(--border-soft); padding: 12px 16px; }
.list-group { border-radius: var(--radius); }

.pagination { --bs-pagination-border-radius: 8px; --bs-pagination-color: var(--text-2); --bs-pagination-active-bg: var(--text-1); --bs-pagination-active-border-color: var(--text-1); }

.progress { border-radius: 4px; background: var(--surface-sunken); height: 6px; }
.progress-bar { background-color: var(--accent); }

/* ─── Hoy: los momentos de la pantalla ───────────────────────────────────── */

/* La ruta del día: tarjetas de parada con el radio de los controles. La
   siguiente parada lleva el azul; las demás, borde fino. */
.parada { border-radius: var(--radius-sm); padding: 8px 12px; }
.parada .hora { font-weight: 500; }
.parada .quien { font-weight: 500; font-size: 13px; }
.parada .que { font-size: 12px; }
.parada.ahora { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.carril { padding: 12px 20px; }

.fila-decision { padding: 12px 20px; }
.fila-decision .asunto b { font-weight: 500; }

/* Lo que queda por cobrar es la cifra que más importa del día. */
.cifra { padding: 4px 20px 20px; }
.cifra .grande { font-size: 32px; line-height: 1.05; }
.antiguedad { height: 8px; gap: 2px; border-radius: 4px; overflow: hidden; }
.antiguedad i { border-radius: 0; }
.medidor i { height: 8px; border-radius: 2px; }

/* «Dónde está el trabajo»: barras en gris, y el azul solo en la etapa con más
   trabajo parado, que es donde hay que mirar. */
.pg-lama { background: var(--surface-sunken); border-radius: 3px; overflow: hidden; }
.pg-lama i { background: var(--border-strong) !important; border-radius: 3px; }
.pg-fila { font-size: 13px; }
.pg-fila.mas-cargada { color: var(--text-1); }
.pg-fila.mas-cargada .pg-lama i { background: var(--accent) !important; }

/* ─── Servicios y catálogo ───────────────────────────────────────────────── */

/* El módulo tenía su propio acento turquesa. Pasa al de toda la aplicación:
   el azul para lo que se elige y gris para lo demás. */
.sc { --sc-acento: var(--accent); --sc-acento-bg: var(--accent-soft); }
.sc-icono { background: var(--surface-sunken); color: var(--text-2); border-radius: var(--radius-sm); }
.sc-estado { background: var(--surface-sunken); color: var(--text-2); font-weight: 500; border-radius: 6px; }
.sc-color span { background: var(--accent); }

/* ─── Panel lateral: vista previa de un trabajo ──────────────────────────── */

.panel-lateral {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  z-index: 1030;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  animation: pl-entra .26s var(--curva);
}
@keyframes pl-entra { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.pl-barra { display: flex; align-items: center; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.pl-hueco { flex: 1; }
.pl-cuerpo { overflow-y: auto; flex: 1; padding: 20px 24px 32px; transition: opacity .14s var(--curva); }
.pl-cuerpo.cargando { opacity: .45; }
/* Con el panel abierto la tabla no queda debajo: se encoge. */
@media (min-width: 1200px) {
  body.con-panel .main-content { margin-right: 440px; min-width: 0; }
  body.con-panel .page-content { max-width: none; min-width: 0; }
  body.con-panel .topbar { margin-right: -440px; }
}
tr.fila-enlace.vista > td { background: var(--accent-soft) !important; }
tr.fila-enlace.vista > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.vz-cod { font-size: 12.5px; color: var(--text-3); }
.vz-titulo { font-size: 22px; font-weight: 500; margin: 4px 0 8px; line-height: 1.2; }
.vz-estado { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.vz-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.vz-acciones form { display: contents; }
.vz-total { font-size: 28px; font-weight: 500; margin-top: 16px; font-variant-numeric: tabular-nums; }
.vz-fila .estado small { color: var(--text-2); }
.vz-datos { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px 16px; margin: 0 0 24px; font-size: 13.5px; }
.vz-datos dt { font-weight: 400; color: var(--text-3); }
.vz-datos dd { margin: 0; color: var(--text-1); overflow-wrap: anywhere; }
.vz-nota { background: var(--warning-soft); color: var(--text-1); border-radius: 8px; padding: 8px 10px; }
.vz-bloque { border-top: 1px solid var(--border-soft); padding-top: 16px; margin-top: 16px; }
.vz-bloque h3 { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 8px; }
.vz-fila { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.vz-fila small { color: var(--text-3); font-size: 12.5px; }
.vz-hist .num { color: var(--text-3); font-size: 12.5px; }

/* ─── Buscador rápido de la barra de arriba ──────────────────────────────── */

.buscador { position: relative; }
.buscador-tecla {
  font-family: var(--font-ui); font-size: 11px; color: var(--text-3);
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; white-space: nowrap;
}
.buscador:focus-within .buscador-tecla { display: none; }
.buscador-resultados {
  position: absolute; top: calc(100% + 6px); left: 0; width: min(520px, 70vw);
  max-height: 70vh; overflow-y: auto; z-index: 1050;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px;
}
.br-grupo { font-size: 12px; color: var(--text-3); padding: 8px 10px 4px; }
.br-fila { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text-1); text-decoration: none; }
.br-fila b { display: block; font-weight: 500; font-size: 13.5px; }
.br-fila small { display: block; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-fila:hover, .br-fila.elegido { background: var(--surface-hover); color: var(--text-1); }
.br-fila.elegido { box-shadow: inset 2px 0 0 var(--accent); }
.br-vacio { padding: 12px 10px; color: var(--text-3); font-size: 13px; }
.br-todo { display: block; padding: 10px; margin-top: 4px; border-top: 1px solid var(--border-soft); font-size: 13px; color: var(--accent); text-decoration: none; }

/* ─── Selección de varios trabajos ───────────────────────────────────────── */

th.sel, td.sel { width: 40px; padding-right: 0 !important; }
tr.marcada > td { background: var(--accent-soft) !important; }
.barra-seleccion {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1040;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); font-size: 13.5px; white-space: nowrap;
}
.barra-seleccion[hidden] { display: none; }
.barra-seleccion .form-select { width: auto; min-width: 200px; }
.vz-estado-form { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; margin: 0 0 16px; font-size: 13.5px; }
.vz-estado-form label { color: var(--text-3); }

/* ─── Asistente de ayuda ─────────────────────────────────────────────────── */

/* El botón flotante pasa de un círculo azul con sombra (lo que más llamaba la
   atención de cada pantalla) a un botón tranquilo del mismo sistema. */
.ayuda-boton {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  font-size: 18px;
  transition: background-color .14s var(--curva), color .14s var(--curva);
}
.ayuda-boton:hover { background: var(--surface-hover); color: var(--text-1); transform: none; }
.ayuda-panel { border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); bottom: 56px; }

/* ─── Movimiento ─────────────────────────────────────────────────────────── */

.card, .stat-card, .bloque, .list-group-item-action, a.card { transition: background-color .14s var(--curva), border-color .14s var(--curva); }
.card:hover, .stat-card:hover, a.card:hover { transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--accent-soft-strong); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─── Pantallas pequeñas ─────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
  .page-content { padding: 24px 16px 48px; }
  .topbar { padding: 0 16px; }
  .op-hero h1, .page-header h1, .titulo { font-size: 24px; }
}

/* Interfaz basada en «unslop» de Damir Sokolovsky (@heydamir), CC BY 4.0. */

/* ─── Agenda semanal: arrastrar una cita a otro día o técnico ───────────── */
.cita-b[draggable="true"] { cursor: grab; }
.cita-b.arrastrando { opacity: .45; }
.cita-b.moviendo { opacity: .7; pointer-events: none; }
.celda.destino { background: var(--accent-soft, #E8F1FB); outline: 2px dashed var(--accent, #0969C7); outline-offset: -3px; }

/* ─── Atajos de teclado (tecla ?) ───────────────────────────────────────── */
.atajos-dialogo { border: 1px solid var(--border, #E2E5E9); border-radius: 12px; padding: 20px 24px; min-width: 340px; color: inherit; background: var(--surface, #fff); box-shadow: 0 12px 40px rgba(18, 23, 29, .18); }
.atajos-dialogo::backdrop { background: rgba(18, 23, 29, .35); }
.atajos-dialogo h2 { font-size: 17px; font-weight: 500; margin: 0 0 12px; }
.atajos-dialogo table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.atajos-dialogo td { padding: 6px 0; font-size: 14px; border-top: 1px solid var(--border, #E2E5E9); }
.atajos-dialogo td:first-child { padding-right: 24px; white-space: nowrap; color: var(--text-2, #4A5360); }
.atajos-dialogo kbd { font: 12px var(--font-mono, ui-monospace, monospace); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border, #CCD1D7); background: var(--surface-sunken, #F1F3F5); color: inherit; }
.atajos-dialogo form { text-align: right; margin: 0; }
