/* NMW — sistema de diseño adoptado desde design/ (Claude Design, 04-jul-2026).
   Fuente de verdad visual: design/design-system.html. Paleta "acero" (default);
   otras paletas + custom: F5, reasignando estas mismas variables por tenant. */
:root, [data-theme="light"] {
  /* Identidad LS ONE: Poppins en títulos y etiquetas, Inter en texto e interfaz; la mono solo para códigos y cifras. */
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-brand: 'Poppins', 'Inter', system-ui, sans-serif;
  --color-bg: #F4F6F8; --color-surface: #FFFFFF; --color-surface-2: #EDF1F5;
  --color-text: #101B27; --color-text-2: #5B6B7C; --color-text-3: #8895A3;
  --color-border: #E3E8EE; --color-border-strong: #D7DEE6;
  --color-primary: #1F6FE5; --color-primary-hover: #1758BA; --color-primary-soft: #E8F0FD; --color-on-primary: #FFFFFF;
  --color-danger: #BC3A2B; --color-danger-hover: #9E2C1F; --color-danger-soft: #FBE9E7; --color-on-danger: #FFFFFF;
  --color-warn: #B45E06; --color-warn-soft: #FCF0DC;
  --color-success: #1E7A46; --color-success-soft: #E2F3E9;
  --color-brand-panel: #0E2A54; --color-on-brand-panel: #F2F6FA; --color-on-brand-panel-2: rgba(242, 246, 250, .66);
  /* Color fuerte de la marca del taller: botón principal y menú lateral. No cambia con el tema
     oscuro, para que el taller se reconozca igual en ambos. Cada paleta los reasigna. */
  --color-btn-from: #1F6FE5; --color-btn-to: #1758BA; --color-btn-text: #FFFFFF;
  --color-sidebar: #0E2A54; --color-sidebar-accent: #5B9BF0;
  --color-status-ingresada: #64748B; --color-status-ingresada-soft: #EDF1F5;
  --color-status-diagnostico: #6D4FA3; --color-status-diagnostico-soft: #F0EBF8;
  --color-status-repuestos: #B45E06; --color-status-repuestos-soft: #FCF0DC;
  --color-status-reparacion: #1A5EA8; --color-status-reparacion-soft: #E3EDF7;
  --color-status-calidad: #0E7490; --color-status-calidad-soft: #E0F2F7;
  --color-status-despacho: #1E7A46; --color-status-despacho-soft: #E2F3E9;
  --color-status-entregada: #5A6472; --color-status-entregada-soft: #ECEEF1;
  --color-focus: rgba(31, 111, 229, .25);
  --color-scrim: rgba(23, 32, 43, .55);
  --shadow-1: 0 1px 2px rgba(15, 23, 32, .06), 0 1px 3px rgba(15, 23, 32, .08);
  --shadow-2: 0 12px 32px rgba(15, 23, 32, .18);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 40px; --space-8: 56px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-full: 999px;
}
[data-theme="dark"] {
  --color-bg: #10151B; --color-surface: #171E26; --color-surface-2: #202935;
  --color-text: #E8ECF1; --color-text-2: #A6B0BC; --color-text-3: #74808D;
  --color-border: #2B3541; --color-border-strong: #3D4956;
  --color-primary: #5B9BF0; --color-primary-hover: #7DB1F4; --color-primary-soft: #16294A; --color-on-primary: #0A1A33;
  --color-danger: #E06A5C; --color-danger-hover: #E8887C; --color-danger-soft: #3A211E; --color-on-danger: #1F0E0B;
  --color-warn: #D98E2B; --color-warn-soft: #372A18;
  --color-success: #4CB47A; --color-success-soft: #1B3227;
  --color-brand-panel: #0A1A33; --color-on-brand-panel: #E8ECF1; --color-on-brand-panel-2: rgba(232, 236, 241, .6);
  --color-status-ingresada: #93A3B5; --color-status-ingresada-soft: #242E3A;
  --color-status-diagnostico: #A88FD8; --color-status-diagnostico-soft: #2A2440;
  --color-status-repuestos: #D98E2B; --color-status-repuestos-soft: #372A18;
  --color-status-reparacion: #5C9FE0; --color-status-reparacion-soft: #1C2E42;
  --color-status-calidad: #4FB3CC; --color-status-calidad-soft: #173038;
  --color-status-despacho: #4CB47A; --color-status-despacho-soft: #1B3227;
  --color-status-entregada: #8A96A3; --color-status-entregada-soft: #232B34;
  --color-focus: rgba(91, 155, 240, .35);
  --color-scrim: rgba(4, 8, 12, .65);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .25), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #10151B; --color-surface: #171E26; --color-surface-2: #202935;
    --color-text: #E8ECF1; --color-text-2: #A6B0BC; --color-text-3: #74808D;
    --color-border: #2B3541; --color-border-strong: #3D4956;
    --color-primary: #5B9BF0; --color-primary-hover: #7DB1F4; --color-primary-soft: #16294A; --color-on-primary: #0A1A33;
    --color-danger: #E06A5C; --color-danger-hover: #E8887C; --color-danger-soft: #3A211E; --color-on-danger: #1F0E0B;
    --color-warn: #D98E2B; --color-warn-soft: #372A18;
    --color-success: #4CB47A; --color-success-soft: #1B3227;
    --color-brand-panel: #0A1A33; --color-on-brand-panel: #E8ECF1; --color-on-brand-panel-2: rgba(232, 236, 241, .6);
    --color-focus: rgba(91, 155, 240, .35);
    --color-scrim: rgba(4, 8, 12, .65);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .25), 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, .5);
  }
  :root:not([data-theme])[data-palette="grafito"] {
    --color-primary: #94A3B3; --color-primary-hover: #B0BDCA; --color-primary-soft: #242E3A; --color-on-primary: #10151B;
    --color-brand-panel: #0C1116; --color-focus: rgba(148, 163, 179, .35);
  }
  :root:not([data-theme])[data-palette="arena"] {
    --color-primary: #D9A85C; --color-primary-hover: #E3BC7E; --color-primary-soft: #382C1B; --color-on-primary: #1F1508;
    --color-brand-panel: #171006; --color-focus: rgba(217, 168, 92, .35);
  }
}

/* ---------- Paletas por tenant (F5) — reasignan solo las variables de acento ---------- */
[data-palette="grafito"] {
  --color-primary: #37424E; --color-primary-hover: #232B34; --color-primary-soft: #E4E8EC; --color-on-primary: #FFFFFF;
  --color-brand-panel: #1B232C; --color-focus: rgba(55, 66, 78, .30);
  --color-btn-from: #37424E; --color-btn-to: #232B34; --color-sidebar: #1B232C; --color-sidebar-accent: #94A3B3;
}
[data-palette="grafito"][data-theme="dark"] {
  --color-primary: #94A3B3; --color-primary-hover: #B0BDCA; --color-primary-soft: #242E3A; --color-on-primary: #10151B;
  --color-brand-panel: #0C1116; --color-focus: rgba(148, 163, 179, .35);
}
[data-palette="arena"] {
  --color-primary: #A16A2E; --color-primary-hover: #7F5323; --color-primary-soft: #F5EBDD; --color-on-primary: #FFFFFF;
  --color-brand-panel: #3E2F1B; --color-focus: rgba(161, 106, 46, .30);
  --color-btn-from: #A16A2E; --color-btn-to: #7F5323; --color-sidebar: #3E2F1B; --color-sidebar-accent: #D9A85C;
}
[data-palette="arena"][data-theme="dark"] {
  --color-primary: #D9A85C; --color-primary-hover: #E3BC7E; --color-primary-soft: #382C1B; --color-on-primary: #1F1508;
  --color-brand-panel: #171006; --color-focus: rgba(217, 168, 92, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em; }
.card-title, .inicio-card-title, .stat-value, .sidebar-tenant { font-family: var(--font-display); }
button, input, select { font-family: inherit; }

/* ---------- Botón de tema (claro/oscuro) ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-full); color: var(--color-text-2);
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.theme-toggle:hover { background: var(--color-surface-2); color: var(--color-text); }
.theme-toggle svg { width: 14px; height: 14px; }

/* ---------- Login (split screen) ---------- */
.login-view { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-brand {
  position: relative; background: var(--color-brand-panel); color: var(--color-on-brand-panel);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--space-7) var(--space-8); overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0, rgba(255, 255, 255, .035) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0, rgba(255, 255, 255, .035) 1px, transparent 1px, transparent 48px);
}
.login-brand-top, .login-brand-mid, .login-brand-foot { position: relative; }
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.login-brand-name { font-weight: 700; font-size: 16px; line-height: 1.15; }
.login-brand-sub { font-size: 12px; color: var(--color-on-brand-panel-2); }
.login-brand-mid { max-width: 460px; }
.login-brand-mid h1 { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.12; margin-bottom: var(--space-4); }
.login-brand-mid > p { margin: 0 0 var(--space-6); font-size: 15.5px; line-height: 1.6; color: var(--color-on-brand-panel-2); }
.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.login-features li { display: flex; align-items: center; gap: 14px; font-size: 14.5px; }
.login-features .feat-icon {
  flex: none; width: 36px; height: 36px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: center;
}
.login-features svg { width: 17px; height: 17px; }
.login-brand-foot { font-size: 12.5px; color: var(--color-on-brand-panel-2); }
.login-brand-foot strong { color: var(--color-on-brand-panel); }

.login-panel { display: flex; flex-direction: column; padding: var(--space-5); }
.login-panel-top { display: flex; justify-content: flex-end; }
.login-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--space-5); }
.login-title { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.login-sub { margin: var(--space-1) 0 0; color: var(--color-text-2); font-size: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--color-text); }
.login-form input {
  font-size: 16px; font-weight: 400; padding: 12px 14px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.login-form input:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.error-msg { color: var(--color-danger); font-size: 13px; margin: 0; }

@media (max-width: 860px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* ---------- Botones ---------- */
.btn-primary {
  min-height: 44px; padding: 0 18px; border: none; border-radius: var(--radius-md);
  background: var(--color-primary); color: var(--color-on-primary);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary {
  min-height: 44px; padding: 0 18px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-secondary:hover { background: var(--color-surface-2); }
.btn-danger {
  min-height: 44px; padding: 0 18px; border: none; border-radius: var(--radius-md);
  background: var(--color-danger); color: var(--color-on-danger);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: var(--color-danger-hover); }
.btn-block { width: 100%; }

/* ---------- Shell (sidebar) ---------- */
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
  width: 232px; flex: none; background: var(--color-surface); border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; padding: var(--space-5) var(--space-4);
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-2); margin-bottom: var(--space-6); }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-md); flex: none;
  background: var(--color-primary); color: var(--color-on-primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.sidebar-tenant { font-weight: 600; font-size: 14px; line-height: 1.15; }
.sidebar-sub { font-size: 11px; color: var(--color-text-3); }

.app-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  min-height: 40px; display: flex; align-items: center; gap: 12px;
  padding: 0 12px; border-radius: var(--radius-md);
  color: var(--color-text-2); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; background: transparent; text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-soft); color: var(--color-primary); }
a.nav-item, a.nav-item:hover { text-decoration: none; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.sidebar-footer .theme-toggle { justify-content: center; border-radius: var(--radius-md); }
.user-block { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--color-border); }
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full); flex: none;
  background: var(--color-surface-2); color: var(--color-text-2);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--color-text-3); text-transform: capitalize; }
.icon-btn {
  width: 32px; height: 32px; flex: none; border-radius: var(--radius-md); border: none;
  background: transparent; color: var(--color-text-3);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { color: var(--color-danger); }
.icon-btn svg { width: 16px; height: 16px; }

.app-main { flex: 1; min-width: 0; padding: var(--space-6); overflow-y: auto; }
.view-title { font-size: 22px; font-weight: 600; letter-spacing: -.005em; margin-bottom: var(--space-5); }
.empty-state { color: var(--color-text-3); font-size: 14px; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center;
    padding: var(--space-3) var(--space-3); gap: var(--space-3); min-width: 0;
  }
  .sidebar-brand { flex: none; margin-bottom: 0; padding: 0; }
  .sidebar-brand > div { display: none; }
  .app-nav { flex: 1; flex-direction: row; overflow-x: auto; min-width: 0; }
  .nav-item { white-space: nowrap; width: auto; }
  .nav-item span { display: none; }
  .sidebar-footer { flex: none; margin-top: 0; flex-direction: row; }
  .sidebar-footer .theme-toggle span { display: none; }
  .user-block { border-top: none; padding: 0; gap: 6px; }
  .user-info { display: none; }
  .app-main { padding: var(--space-4); }
}

/* ---------- Campo de formulario suelto (fuera de modal) ---------- */
.form-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--color-text); max-width: 280px; margin-bottom: var(--space-4); }
.form-field .control { font-weight: 400; }
.control {
  font-size: 14.5px; padding: 10px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text); width: 100%;
}
.control:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }

/* ---------- Tabla y formularios (Usuarios) ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: var(--space-5); flex-wrap: wrap; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.data-table { width: 100%; min-width: 560px; border-collapse: collapse; background: var(--color-surface); font-size: 13.5px; }
.data-table th, .data-table td { text-align: left; padding: 13px 20px; border-bottom: 1px solid var(--color-border); }
.data-table th {
  background: var(--color-surface-2); color: var(--color-text-2); font-weight: 700;
  text-transform: uppercase; font-size: 11.5px; letter-spacing: .07em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-surface-2); }
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--color-text); }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.badge.active { background: var(--color-success-soft); color: var(--color-success); }
.badge.inactive { background: var(--color-danger-soft); color: var(--color-danger); }
.badge.quote-badge-sin_cotizacion { background: var(--color-surface-2); color: var(--color-text-2); }
.badge.quote-badge-enviada { background: var(--color-primary-soft); color: var(--color-primary); }
.badge.quote-badge-aprobada { background: var(--color-success-soft); color: var(--color-success); }
.badge.quote-badge-rechazada { background: var(--color-danger-soft); color: var(--color-danger); }
.row-actions { display: flex; gap: 8px; }
.row-actions button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.toolbar .control { max-width: 280px; }
.toolbar-right { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-link { background: none; border: none; padding: 0; font: inherit; color: var(--color-primary); cursor: pointer; text-align: left; }
.row-link:hover { text-decoration: underline; }

/* ---------- Estado vacío con ícono (listas y detalle) ---------- */
.empty-block {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6); display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: var(--space-2);
}
.empty-block-icon {
  width: 56px; height: 56px; border-radius: var(--radius-full); background: var(--color-surface-2);
  color: var(--color-text-3); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-2);
}
.empty-block-title { font-size: 16px; font-weight: 700; }
.empty-block-text { margin: 0; font-size: 13.5px; color: var(--color-text-2); max-width: 320px; line-height: 1.5; }

/* ---------- Detalle (Cliente / Máquina) ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 0;
  color: var(--color-text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; margin-bottom: var(--space-4);
}
.back-link:hover { color: var(--color-text); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4) var(--space-6); margin-bottom: var(--space-6); }
.detail-grid dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-3); margin-bottom: 4px; }
.detail-grid dd { margin: 0; font-size: 14.5px; color: var(--color-text); }
.subsection-title { font-size: 16px; font-weight: 700; margin: var(--space-6) 0 var(--space-3); }
.mono { font-family: var(--font-mono); }

/* ---------- Config (etiquetas + plantilla de checklist) ---------- */
.config-labels, .config-groups { display: flex; flex-direction: column; gap: var(--space-3); max-width: 480px; }
.config-label-row, .config-item-row { display: flex; gap: 8px; align-items: center; }
.config-label-row .control, .config-item-row .control { flex: 1; }
.config-group-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: 8px; background: var(--color-surface-2); }
.config-group-head { display: flex; gap: 8px; align-items: center; }
.config-group-head .control { flex: 1; font-weight: 700; }

/* ---------- Config (F5: apariencia, logo, estados de OT) ---------- */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); max-width: 620px; }
.palette-option {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); cursor: pointer; font-size: 13px; font-weight: 600;
}
.palette-option:hover { border-color: var(--color-border-strong); }
.palette-option.active { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary); }
.palette-swatch { width: 20px; height: 20px; border-radius: var(--radius-full); flex: none; border: 1px solid rgba(0,0,0,.08); }
.palette-custom-fields { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-4); max-width: 620px; }
.palette-custom-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--color-text-2); }
.palette-custom-fields input[type="color"] { width: 56px; height: 36px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); cursor: pointer; }

.logo-box { display: flex; align-items: center; gap: var(--space-4); }
.logo-preview {
  width: 72px; height: 72px; border-radius: var(--radius-md); border: 1px solid var(--color-border);
  background: var(--color-surface-2); display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.status-list { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.status-row .control { flex: 1; }
.status-color-input { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); cursor: pointer; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--color-scrim);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
.modal-card {
  width: 100%; max-width: 420px; background: var(--color-surface); border-radius: var(--radius-lg);
  border: 1px solid var(--color-border); box-shadow: var(--shadow-2); padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-4);
  /* Nunca más alta que la pantalla: un formulario largo se desplaza dentro de la ventana en vez
     de cortarse arriba y abajo sin forma de llegar a los botones. */
  max-height: calc(100dvh - 40px); overflow-y: auto;
}
.modal-card h3 { font-size: 17px; font-weight: 700; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--color-text); }
.modal-card input, .modal-card select {
  font-size: 16px; font-weight: 400; padding: 10px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.modal-card input:focus-visible, .modal-card select:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: var(--space-1); }

/* ---------- Kanban y OTs ---------- */
.view-toggle { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); overflow: hidden; }
.view-toggle button {
  min-height: 36px; padding: 0 14px; border: none; background: var(--color-surface); color: var(--color-text-2);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--color-border-strong); }
.view-toggle button.active { background: var(--color-primary-soft); color: var(--color-primary); }

/* Gestión HH — selector de rango (presets + rango personalizado) */
.hh-range-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.hh-presets { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; overflow: visible; }
.hh-presets button { border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.hh-range-custom { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hh-range-custom label { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--color-text-2); }
.hh-range-custom input { max-width: 150px; }

.kanban-legend { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-2) 0; font-size: 12px; color: var(--color-text-2); flex-wrap: wrap; }
.kanban-legend-label { font-weight: 700; text-transform: uppercase; letter-spacing: .07em; font-size: 11px; color: var(--color-text-3); }
.kanban-legend span.dot-item { display: inline-flex; align-items: center; gap: 7px; }

.kanban-board { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-3); align-items: flex-start; }
.kanban-col {
  width: 264px; flex: none; display: flex; flex-direction: column;
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  max-height: 74vh;
}
.kanban-col.col-drop-hover { border-color: var(--color-primary); }
.kanban-col-head { flex: none; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.kanban-col-name { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kanban-col-count {
  margin-left: auto; min-width: 24px; text-align: center; padding: 1px 7px; border-radius: var(--radius-full);
  background: var(--color-surface); border: 1px solid var(--color-border); font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 600; color: var(--color-text-2);
}
.kanban-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kanban-empty-col { padding: var(--space-5) var(--space-3); text-align: center; font-size: 12.5px; color: var(--color-text-3); }

.wo-card {
  display: block; width: 100%; text-align: left; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow-1);
}
.wo-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-2); }
.wo-card[draggable="true"] { cursor: grab; }
.wo-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wo-card-num { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--color-text-2); }
.wo-card-machine { font-size: 14px; font-weight: 700; line-height: 1.25; }
.wo-card-client { font-size: 12.5px; color: var(--color-text-2); margin: 2px 0 10px; }
.wo-card-bottom { display: flex; justify-content: space-between; align-items: center; }
.wo-card-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--color-text-3); }
.wo-card-ini {
  width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--color-surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; color: var(--color-text-2);
}
.wo-lock-icon { width: 14px; height: 14px; color: var(--color-text-3); flex: none; }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: var(--radius-full); flex: none; }
.sem-dot { display: inline-block; width: 9px; height: 9px; border-radius: var(--radius-full); flex: none; }
.sem-ok { background: var(--color-success); }
.sem-warn { background: var(--color-warn); }
.sem-late { background: var(--color-danger); }
.sem-none { background: var(--color-text-3); }
.sem-text-late { color: var(--color-danger); font-weight: 700; }

.urgency-chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 10.5px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.urgency-baja, .urgency-normal { background: var(--color-surface-2); color: var(--color-text-2); }
.urgency-alta { background: var(--color-warn-soft); color: var(--color-warn); }
.urgency-critica { background: var(--color-danger-soft); color: var(--color-danger); }

.wo-banner {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-danger-soft);
  color: var(--color-danger); font-size: 13.5px; font-weight: 700; margin-bottom: var(--space-4);
}
.wo-banner.wo-banner-locked { background: var(--color-primary-soft); color: var(--color-primary); }
.wo-header { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.wo-header-num { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }
.wo-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.wo-totals { display: flex; gap: var(--space-6); align-items: baseline; background: var(--color-surface-2); border-radius: var(--radius-md); padding: var(--space-4); margin-top: var(--space-4); }
.wo-totals-item { font-size: 13.5px; color: var(--color-text-2); }
.wo-totals-item strong { font-family: var(--font-mono); color: var(--color-text); font-weight: 700; }
.wo-totals-total { margin-left: auto; font-size: 15px; font-weight: 700; }

/* ---------- Subsecciones del detalle de OT (F3.1) ---------- */
.subsection-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: var(--space-7); margin-bottom: var(--space-3); flex-wrap: wrap; border-top: 1px solid var(--color-border); padding-top: var(--space-5); }
.subsection-bar:first-of-type { border-top: none; padding-top: 0; }
.collapse-toggle {
  display: inline-flex; align-items: center; gap: 8px; background: none; border: none; padding: 0;
  cursor: pointer; font-size: 16px; font-weight: 700; color: var(--color-text);
}
.collapse-toggle svg { width: 14px; height: 14px; color: var(--color-text-3); transition: transform .15s ease; flex: none; }
.collapse-toggle.open svg { transform: rotate(90deg); }
.collapse-summary { font-size: 13px; font-weight: 400; color: var(--color-text-3); }

/* Índice de Configuración */
.cfg-indice { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.cfg-indice-item {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text); font: inherit;
}
.cfg-indice-item:hover { border-color: var(--color-primary); }
.cfg-indice-item.activo { border-color: var(--color-primary); background: var(--color-primary-soft); }
.cfg-indice-item b { font-size: 14px; }
.cfg-indice-item span { font-size: 12.5px; color: var(--color-text-3); line-height: 1.4; }

/* ---------- Modal ancho (Bitácora) ---------- */
.modal-card.modal-wide { max-width: 560px; max-height: 80vh; overflow: hidden; }
.modal-wide-body { flex: 1; min-height: 0; overflow-y: auto; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-when { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-3); }
.timeline-who { font-weight: 600; }
.timeline-text { font-size: 14px; color: var(--color-text); margin-top: 2px; }
.timeline-note { font-size: 13px; color: var(--color-text-2); font-style: italic; margin-top: 4px; }
.wo-totals-total strong { font-family: var(--font-mono); font-size: 18px; }

/* ── F4: Documental ────────────────────────────────────────────── */

/* Attachment grid */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.attach-item { position: relative; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; cursor: pointer; background: var(--color-surface-2); }
.attach-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.attach-item-file { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; text-align: center; }
.attach-item-file span { font-size: 10.5px; color: var(--color-text-3); word-break: break-all; line-height: 1.2; }
.attach-kind-chip { position: absolute; top: 4px; left: 4px; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--color-primary-soft); color: var(--color-primary); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.attach-delete { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: var(--radius-full); background: var(--color-danger); color: var(--color-on-danger); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
/* Roles y permisos: la matriz módulo × nivel. En móvil cada fila se apila para que los tres
   niveles queden tocables sin zoom. */
.modal-wide { max-width: 720px; width: min(720px, calc(100vw - 32px)); }
.perm-grid { display: flex; flex-direction: column; gap: var(--space-4); max-height: 55vh; overflow-y: auto; margin: var(--space-3) 0; }
.perm-group { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); }
.perm-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-3); margin-bottom: var(--space-3); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.perm-row:last-child { border-bottom: none; }
.perm-row-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-row-label > span:first-child { font-size: 13.5px; font-weight: 600; }
.perm-hint { font-size: 11.5px; color: var(--color-text-3); line-height: 1.35; }
.perm-levels { display: flex; gap: 4px; flex: none; }
.perm-lvl { padding: 5px 10px; border-radius: var(--radius-full); border: 1px solid var(--color-border-strong); background: none; color: var(--color-text-3); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.perm-lvl.on { background: var(--color-primary-soft); color: var(--color-primary); border-color: var(--color-primary); }
/* `.modal-card label` fuerza columna para los campos del formulario; estas dos filas son
   etiqueta-a-la-izquierda / control-a-la-derecha, así que hay que ganarle en especificidad. */
.modal-card label.perm-flag,
.modal-card label.check-row { flex-direction: row; align-items: center; cursor: pointer; }
.modal-card label.perm-flag { justify-content: space-between; gap: var(--space-3); font-weight: 400; }
.modal-card label.perm-flag .perm-row-label > span:first-child { font-weight: 600; }
.perm-flag input { flex: none; width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; }

@media (max-width: 560px) {
  .perm-row { flex-direction: column; align-items: stretch; }
  .perm-levels { justify-content: stretch; }
  .perm-lvl { flex: 1; text-align: center; }
}

/* Resumen ejecutivo de la OT: reusa stat-grid/stat-card, solo ajusta escala y agrega pie. */
.summary-card { margin-top: var(--space-4); }
.summary-stats { margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.summary-stats .stat-value { font-size: 26px; }
.summary-foot { margin-top: 4px; font-size: 11.5px; color: var(--color-text-3); line-height: 1.35; }
.summary-dash { color: var(--color-text-3); font-weight: 400; }
.summary-progress { margin-top: var(--space-4); }
.check-progress-fill.summary-bar-warn { background: var(--color-warn); }
.check-progress-fill.summary-bar-danger { background: var(--color-danger); }
.summary-alerts { margin-top: var(--space-3); display: flex; flex-direction: column; gap: 6px; }

/* Enlaces externos de la OT: lista simple, no grilla — el nombre manda y el servicio es la pista. */
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.link-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); padding: 10px 12px; }
.link-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.link-item-main:hover .link-item-name { text-decoration: underline; }
.link-item-name { font-size: 13.5px; font-weight: 600; color: var(--color-text-1); overflow-wrap: anywhere; }
.link-item-meta { font-size: 11.5px; color: var(--color-text-3); font-family: var(--font-mono); overflow-wrap: anywhere; }

.attach-upload-btn { aspect-ratio: 1; border: 2px dashed var(--color-border-strong); border-radius: var(--radius-md); background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--color-primary); font-size: 12px; font-weight: 600; }
.attach-upload-btn:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }

/* Checklist view (mobile-first, replaces main) */
.check-view { max-width: 560px; margin: 0 auto; padding: var(--space-4); padding-bottom: 112px; display: flex; flex-direction: column; gap: var(--space-4); }
.check-header { position: sticky; top: 0; z-index: 10; background: var(--color-bg); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.check-header-top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.check-header-info { flex: 1; min-width: 0; }
.check-header-title { font-size: 15.5px; font-weight: 700; color: var(--color-text); }
.check-header-sub { font-size: 12.5px; color: var(--color-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-progress-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--color-text-3); margin-bottom: 4px; }
.check-progress-bar { height: 6px; background: var(--color-surface-2); border-radius: var(--radius-full); overflow: hidden; }
.check-progress-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); transition: width .25s ease; }

/* Checklist section card */
.check-section { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.check-section-title { font-size: 12px; font-weight: 700; color: var(--color-text-3); text-transform: uppercase; letter-spacing: .07em; }
.check-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Checklist groups and items */
.check-group { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.check-group-head { padding: 14px 16px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.check-group-title { font-size: 12px; font-weight: 700; color: var(--color-text-3); text-transform: uppercase; letter-spacing: .07em; }
.check-group-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--color-text-3); }
.check-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--color-border); min-height: 56px; }
.check-item:last-child { border-bottom: none; }
.check-item-label { flex: 1; font-size: 14.5px; font-weight: 600; color: var(--color-text); line-height: 1.3; }
.check-item-obs { font-size: 12.5px; color: var(--color-warn); margin-top: 2px; }

/* Segmented control (Sí/No/N-A) */
.seg-control { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); overflow: hidden; flex: none; }
.seg-btn { padding: 6px 12px; font-size: 12px; font-weight: 700; border: none; background: var(--color-surface); color: var(--color-text-3); cursor: pointer; border-right: 1px solid var(--color-border-strong); transition: background .12s, color .12s; }
.seg-btn:last-child { border-right: none; }
.seg-btn.active-si { background: var(--color-success-soft); color: var(--color-success); }
.seg-btn.active-no { background: var(--color-danger-soft); color: var(--color-danger); }
.seg-btn.active-na { background: var(--color-surface-2); color: var(--color-text-2); }

/* Fuel picker */
.fuel-picker { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); overflow: hidden; }
.fuel-btn { padding: 8px 12px; font-size: 12px; font-weight: 600; border: none; background: var(--color-surface); color: var(--color-text-3); cursor: pointer; border-right: 1px solid var(--color-border-strong); transition: background .12s, color .12s; }
.fuel-btn:last-child { border-right: none; }
.fuel-btn.active { background: var(--color-primary-soft); color: var(--color-primary); }

/* Photo slots */
.photo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot { position: relative; aspect-ratio: 1; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; cursor: pointer; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.photo-slot-label { font-size: 10.5px; color: var(--color-text-3); font-weight: 600; z-index: 1; }
.photo-slot-add { border: 2px dashed var(--color-border-strong); background: none; color: var(--color-primary); }
.photo-slot-add:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.photo-slot-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--color-danger); color: var(--color-on-danger); border: none; cursor: pointer; font-size: 12px; z-index: 2; display: flex; align-items: center; justify-content: center; }

/* Signature pad */
.sign-pad { border: 2px dashed var(--color-border-strong); border-radius: var(--radius-md); position: relative; cursor: crosshair; touch-action: none; height: 140px; }
.sign-pad canvas { display: block; width: 100%; height: 100%; border-radius: var(--radius-md); }
.sign-pad-placeholder { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--color-text-3); font-size: 13px; pointer-events: none; }
.sign-pad.has-signature .sign-pad-placeholder { display: none; }
.sign-pad.has-signature { border-style: solid; border-color: var(--color-success); }
.sign-actions { display: flex; justify-content: flex-end; margin-top: var(--space-2); }

/* Status banners for checklist */
.check-status-banner { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.check-status-banner.borrador { background: var(--color-warn-soft); color: var(--color-warn); }
.check-status-banner.pendiente { background: var(--color-primary-soft); color: var(--color-primary); }
.check-status-banner.aprobado { background: var(--color-success-soft); color: var(--color-success); }

/* Fixed bottom bar for checklist */
.check-bottom { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px 20px; background: linear-gradient(transparent, var(--color-bg) 30%); z-index: 10; display: flex; gap: 10px; justify-content: center; }
.check-bottom .btn-primary,
.check-bottom .btn-secondary { flex: 1; max-width: 280px; min-height: 56px; font-size: 16px; font-weight: 700; }
.check-bottom .btn-primary:disabled { background: var(--color-surface-2); color: var(--color-text-3); cursor: not-allowed; }

/* Dispatch read-only card */
.dispatch-read { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.dispatch-number { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--color-primary); }

/* Observation input (appears under No items) */
.obs-input { width: 100%; padding: 6px 10px; font-size: 12.5px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-top: 4px; background: var(--color-warn-soft); color: var(--color-warn); }
.obs-input::placeholder { color: var(--color-warn); opacity: .6; }

/* ---------- Impresión (F5) — OT, guía de recepción, guía de despacho, cotización ---------- */
#printRoot { display: none; }
@media print {
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
}
#printRoot {
  --print-accent: var(--color-primary);
  max-width: 780px; margin: 0 auto; padding: 32px; font-family: var(--font-ui); color: #111; background: #fff;
}
.print-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--print-accent); padding-bottom: 16px; margin-bottom: 20px; }
.print-header-brand { display: flex; align-items: center; gap: 12px; }
.print-logo { max-width: 64px; max-height: 64px; object-fit: contain; }
.print-brand-name, .print-tenant-name { font-size: 16px; font-weight: 700; }
.print-brand-mark { width: 44px; height: 44px; flex: none; }
.print-brand-mark svg { width: 100%; height: 100%; display: block; }
.print-brand-plataforma { font-family: var(--font-brand); font-weight: 600; letter-spacing: -.005em; font-size: 15px; }
.print-emit-date { font-size: 11.5px; color: #555; }
.print-header-doc { text-align: right; }
.print-doc-version { font-size: 12px; font-weight: 700; letter-spacing: .06em; margin-bottom: 12px; }
.print-doc-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--print-accent); }
.print-doc-number { font-size: 18px; font-weight: 700; }
.print-banner { padding: 8px 12px; border: 1px solid #111; font-size: 12.5px; font-weight: 700; margin-bottom: 16px; }
.print-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 8px; page-break-after: avoid; }
.print-fields { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 4px; page-break-inside: avoid; }
.print-fields th { text-align: left; font-weight: 700; color: #444; padding: 4px 8px 4px 0; white-space: nowrap; }
.print-fields td { padding: 4px 16px 4px 0; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12.5px; page-break-inside: avoid; }
.print-table th, .print-table td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
.print-table th { background: #f2f2f2; font-weight: 700; }
.print-empty { font-size: 12.5px; color: #666; font-style: italic; }
.print-doc-list { font-size: 12.5px; padding-left: 18px; margin: 0; }
.print-signature-img { max-width: 220px; max-height: 100px; display: block; border: 1px solid #ccc; }
.print-received-by { font-size: 12.5px; margin-top: 24px; }
.print-signatures { display: flex; gap: 40px; margin-top: 48px; page-break-inside: avoid; }
.print-sign-box { flex: 1; border-top: 1px solid #111; padding-top: 6px; font-size: 12px; text-align: center; color: #444; }

/* ---------- Dashboard (F5) ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); }
.card-title { font-size: 15px; font-weight: 600; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); gap: 12px; }
.card-title-row .card-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); }
.stat-card-danger { border-color: var(--color-danger); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--color-text-3); text-transform: uppercase; letter-spacing: .07em; }
.stat-card-danger .stat-label { color: var(--color-danger); }
.stat-value { font-size: 34px; font-weight: 500; letter-spacing: -.01em; margin-top: 4px; }
.stat-card-danger .stat-value { color: var(--color-danger); }
.stat-sub { font-size: 12.5px; color: var(--color-text-3); margin-top: 2px; }
.stat-trend-up { color: var(--color-success); font-weight: 600; }
.stat-trend-down { color: var(--color-danger); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row-label { width: 150px; flex: none; font-size: 13px; color: var(--color-text-2); }
.bar-row-track { flex: 1; height: 10px; background: var(--color-surface-2); border-radius: var(--radius-full); overflow: hidden; }
.bar-row-fill { height: 100%; border-radius: var(--radius-full); }
.bar-row-count { width: 28px; text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 600; flex: none; }

.dash-list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border); cursor: pointer; }
.dash-list-row:last-child { border-bottom: none; }
.dash-list-row:hover { color: var(--color-primary); }
.dash-list-date { font-size: 12px; color: var(--color-text-3); }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: var(--color-surface-2); }

/* ---------- Reportes (F7) ---------- */
.stat-card-warn { border-color: var(--color-warn); }
.stat-card-warn .stat-label { color: var(--color-warn); }
.txt-success { color: var(--color-success); font-weight: 600; }
.txt-danger { color: var(--color-danger); font-weight: 600; }

.report-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.chip-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip-filter {
  padding: 7px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-full);
  background: var(--color-surface); color: var(--color-text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip-filter:hover { background: var(--color-surface-2); }
.chip-filter.active { background: var(--color-primary-soft); color: var(--color-primary); border-color: var(--color-primary); }
.report-dates { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.report-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--color-text-3); }
.report-dates .control { max-width: 170px; font-weight: 400; }

.report-card { margin-top: var(--space-4); }
.report-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--color-text-3); font-weight: 400; }
.cell-muted { color: var(--color-text-3); font-family: var(--font-sans); font-size: 12.5px; }

/* ---------- Historial de versiones de cotización (v1.1-D) ---------- */
.quote-history { margin-top: var(--space-4); border-top: 1px solid var(--color-border); padding-top: var(--space-3); }
.quote-history summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-text-2); }
.quote-rev-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.quote-rev-actions { display: flex; gap: 8px; flex: none; }
.report-bar-extra { flex: none; width: 56px; text-align: right; font-size: 12px; color: var(--color-text-3); }

.month-chart { display: flex; align-items: stretch; gap: var(--space-2); height: 180px; }
.month-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.month-bars { flex: 1; display: flex; flex-direction: column; }
.month-pos { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.month-neg { flex: 1; display: flex; align-items: flex-start; justify-content: center; }
.month-bar { width: 62%; max-width: 40px; min-height: 2px; border-radius: 3px 3px 0 0; }
.month-bar.neg { border-radius: 0 0 3px 3px; }
.month-label { text-align: center; font-size: 11px; color: var(--color-text-3); margin-top: 6px; white-space: nowrap; }

/* ---------- Tarifa HH (F7.1) ---------- */
.link-btn {
  background: none; border: none; padding: 0; color: var(--color-primary); font-size: 13px;
  font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Contexto de taller para superadmin (v1.1-A6) ---------- */
.tenant-context-bar {
  background: var(--color-primary-soft); border-radius: var(--radius-md); padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4); font-size: 13px; color: var(--color-text-2);
}
.tenant-context-bar b { color: var(--color-text); }
.tenant-context-bar .link-btn { margin-left: 4px; }

/* ---------- Ícono de ayuda [?] (v1.1-C1) ---------- */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center; background: none; border: none;
  padding: 0; margin-left: 4px; color: var(--color-text-3); cursor: pointer; vertical-align: middle;
}
.help-icon:hover { color: var(--color-primary); }
.help-icon:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-full); }

.cost-item-row { display: grid; grid-template-columns: 1fr 140px auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.cost-total-row { margin-top: var(--space-4); font-size: 14px; color: var(--color-text-2); }
.cost-total-row strong { color: var(--color-text); font-family: var(--font-mono); }

.slider-row { display: grid; grid-template-columns: 130px 1fr 52px; gap: 12px; align-items: center; margin-bottom: var(--space-3); }
.slider-row label { font-size: 13px; color: var(--color-text-2); }
.slider-row input[type="range"] {
  width: 100%; accent-color: var(--color-primary); height: 4px; cursor: pointer;
}
.slider-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; }

.rate-banner {
  padding: 12px 16px; border-radius: var(--radius-md); font-size: 13.5px; line-height: 1.5; font-weight: 600;
}
.rate-banner-hint { background: var(--color-surface-2); color: var(--color-text-2); font-weight: 400; }
.rate-banner-success { background: var(--color-success-soft); color: var(--color-success); }
.rate-banner-warn { background: var(--color-warn-soft); color: var(--color-warn); }
.rate-banner-danger { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------- Control de HH (F7.2) ---------- */
.txt-warn { color: var(--color-warn); font-weight: 600; }
.hh-tech-nocontract .bar-row-label { color: var(--color-text-3); }

/* OTs en curso: barra de consumo de HH dentro de la tabla */
.hh-progress { display: flex; align-items: center; gap: 8px; }
.hh-progress-track { width: 72px; height: 8px; background: var(--color-surface-2); border-radius: var(--radius-full); overflow: hidden; flex: none; }
.hh-progress-fill { height: 100%; border-radius: var(--radius-full); }
.hh-fuga-alert { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-warn-soft); color: var(--color-warn); font-size: 13px; font-weight: 600; }

/* Diagnóstico automático del período */
.diag-card { margin-bottom: var(--space-4); border-left: 4px solid var(--color-border); }
.diag-card.diag-success { border-left-color: var(--color-success); }
.diag-card.diag-warn { border-left-color: var(--color-warn); }
.diag-card.diag-danger { border-left-color: var(--color-danger); }
.diag-frase { margin: var(--space-2) 0 0; font-size: 14.5px; line-height: 1.55; color: var(--color-text); }
.diag-alertas { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.diag-alertas li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--color-text-2); }
.diag-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: none; margin-top: 5px; }
.diag-alert-warn .diag-dot { background: var(--color-warn); }
.diag-alert-danger .diag-dot { background: var(--color-danger); }
.diag-disclaimer { margin: var(--space-3) 0 0; font-size: 11.5px; color: var(--color-text-3); font-style: italic; }

.hh-trend-legend { display: flex; align-items: center; gap: var(--space-2); font-size: 12.5px; color: var(--color-text-2); margin-bottom: var(--space-4); }
.hh-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.hh-dot-util { background: var(--color-primary); }
.hh-dot-prof { background: var(--color-success); }
.hh-trend-legend .hh-dot { margin-left: var(--space-3); }
.hh-trend-legend .hh-dot:first-child { margin-left: 0; }

.hh-trend-chart { display: flex; align-items: stretch; gap: var(--space-2); height: 180px; }
.hh-trend-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hh-trend-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.hh-trend-bar { width: 40%; max-width: 22px; min-height: 2px; border-radius: 3px 3px 0 0; }

/* ---------- Talleres / administración (F6) ---------- */
.tall-storage { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.tall-storage > span { font-size: 12px; color: var(--color-text-2); }
.tall-storage-track { height: 6px; background: var(--color-surface-2); border-radius: var(--radius-full); overflow: hidden; }
.tall-storage-fill { height: 100%; border-radius: var(--radius-full); }
.tall-audit-date { font-size: 12.5px; color: var(--color-text-2); white-space: nowrap; }

.killswitch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.killswitch-row:last-of-type { border-bottom: none; }
.killswitch-label { font-size: 14px; font-weight: 600; }
.killswitch-hint { font-size: 12.5px; color: var(--color-text-3); margin-top: 2px; }
.toggle-btn { flex: none; padding: 7px 16px; border-radius: var(--radius-full); border: 1px solid var(--color-border-strong); font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle-btn.on { background: var(--color-success-soft); color: var(--color-success); border-color: var(--color-success); }
.toggle-btn.off { background: var(--color-danger-soft); color: var(--color-danger); border-color: var(--color-danger); }


/* ═══════════ Tema "Acero Pulido" (jul-2026) — capa sobre el sistema base ═══════════ */
@keyframes lsEntra { from { opacity: 0; transform: translateX(6%); } to { opacity: 1; transform: none; } }
@keyframes lsBarrido { 0% { transform: translateX(-120%) skewX(-14deg); } 100% { transform: translateX(420%) skewX(-14deg); } }
@keyframes nmwUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nmwBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes nmwPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(188, 58, 43, .45); } 60% { box-shadow: 0 0 0 8px rgba(188, 58, 43, 0); } }
@media (prefers-reduced-motion: reduce) {
  .login-brand::after { animation: none !important; }
  .login-sheen { display: none; }
  .stat-card, .bar-row-fill { animation: none !important; }
}

/* Marca */
.brand-mark svg, .brand-mark img { width: 100%; height: 100%; display: block; }
.sidebar-tenant.is-brand, .login-brand-name {
  font-family: var(--font-brand); letter-spacing: -.005em; font-weight: 600;
}

/* Login — panel de marca */
.login-brand { background: linear-gradient(160deg, #0B2147 0%, #0E2A54 55%, #10305F 100%); }
.login-brand::before {
  background-image:
    repeating-linear-gradient(0deg, rgba(91, 155, 240, .045) 0, rgba(91, 155, 240, .045) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(90deg, rgba(91, 155, 240, .045) 0, rgba(91, 155, 240, .045) 1px, transparent 1px, transparent 48px);
}
.login-brand::after {
  /* El corte diagonal del logo LS, fijo en el borde derecho. */
  content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 34%;
  background: linear-gradient(180deg, rgba(31, 111, 229, .30), rgba(31, 111, 229, .12));
  clip-path: polygon(46% 0, 100% 0, 100% 100%, 0 100%);
  animation: lsEntra .9s ease-out both;
}
/* Barrido de luz en los tonos del azul LS (celeste y un brillo casi blanco). */
.login-sheen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-sheen::before {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: 0; width: 30%;
  background: linear-gradient(105deg, transparent, rgba(91, 155, 240, .08) 45%, rgba(220, 234, 255, .11) 50%, rgba(91, 155, 240, .08) 55%, transparent);
  animation: lsBarrido 11s ease-in-out infinite;
}
.login-brand-sub { font-family: var(--font-display); font-weight: 500; font-size: 10px; letter-spacing: .35em; text-transform: uppercase; color: #8DB6F2; }
.login-kicker { font-family: var(--font-display); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #8DB6F2; margin-bottom: 20px; }
.login-brand-mid { max-width: 560px; }
.login-brand-mid h1 { font-size: 48px; line-height: 1.1; font-weight: 300; letter-spacing: -.015em; margin-bottom: 20px; }
.login-brand-mid h1 strong { font-weight: 600; }
.login-brand-mid > p { font-size: 16px; max-width: 480px; color: rgba(234, 242, 250, .6); }
.login-features { gap: 0; counter-reset: feat; }
.login-features li {
  align-items: baseline; gap: 20px; padding: 15px 0; font-size: 15px;
  color: rgba(234, 242, 250, .88); border-top: 1px solid rgba(141, 182, 242, .18);
}
.login-features li:last-child { border-bottom: 1px solid rgba(141, 182, 242, .18); }
.login-features li::before {
  counter-increment: feat; content: "0" counter(feat);
  font-family: var(--font-mono); font-size: 12px; color: #8DB6F2; flex: none;
}
.login-features .feat-icon { display: none; }
.login-brand-foot { font-family: var(--font-display); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(234, 242, 250, .5); }

/* Login — formulario en tarjeta */
.login-form .btn-primary { border-radius: 4px; font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.login-form {
  max-width: 440px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 16px; padding: 44px 44px 36px; box-shadow: 0 28px 70px rgba(13, 35, 58, .1);
}
[data-theme="dark"] .login-form { box-shadow: 0 28px 70px rgba(0, 0, 0, .5); }
.login-title { font-size: 30px; letter-spacing: -.02em; }
.login-form label { font-family: var(--font-display); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--color-text-2); gap: 7px; }
.login-form input {
  font-family: var(--font-ui); text-transform: none; letter-spacing: normal;
  border-radius: 9px; padding: 13px 15px; background: var(--color-bg);
}
.login-form input:focus-visible { background: var(--color-surface); }
.login-secure {
  text-align: center; font-family: var(--font-display); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--color-text-3); border-top: 1px solid var(--color-border); padding-top: 18px;
}

/* Botón primario con gradiente */
.btn-primary {
  background: linear-gradient(180deg, var(--color-btn-from), var(--color-btn-to)); color: var(--color-btn-text); font-weight: 600; border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 14px rgba(14, 42, 84, .16);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--color-btn-from), var(--color-btn-to)); filter: brightness(1.1); }

/* Sidebar oscuro fijo (ambos temas) */
.app-sidebar { background: var(--color-sidebar); border-right-color: rgba(160, 200, 240, .14); }
.sidebar-tenant { color: #EAF2FA; }
.sidebar-sub { font-family: var(--font-display); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(234, 242, 250, .5); }
.app-sidebar .nav-item { color: rgba(226, 238, 250, .62); }
.app-sidebar .nav-item:hover { background: rgba(141, 182, 242, .08); color: #DFEDFA; }
.app-sidebar .nav-item.active { background: rgba(141, 182, 242, .14); color: #DFEDFA; box-shadow: inset 3px 0 0 var(--color-sidebar-accent); }
.sidebar-footer .theme-toggle { background: transparent; border-color: rgba(160, 200, 240, .2); color: rgba(226, 238, 250, .62); }
.sidebar-footer .theme-toggle:hover { background: rgba(141, 182, 242, .08); color: #DFEDFA; }
.user-block { border-top-color: rgba(160, 200, 240, .14); }
.user-avatar { background: rgba(141, 182, 242, .18); color: #BFD7EC; }
.user-name { color: #EAF2FA; }
.user-role { color: rgba(234, 242, 250, .5); }
.user-block .icon-btn { color: rgba(234, 242, 250, .5); }
.user-block .icon-btn:hover { color: #E58A7C; }

/* Dashboard */
.stat-card { border-radius: 14px; padding: 20px 24px; box-shadow: var(--shadow-1); animation: nmwUp .5s ease both; }
.stat-grid .stat-card:nth-child(2) { animation-delay: .07s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: .14s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: .21s; }
.stat-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; font-weight: 500; }
.stat-value { font-size: 38px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card-danger { border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-surface)); }
.stat-card-danger .stat-label::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 999px;
  background: var(--color-danger); margin-right: 8px; animation: nmwPulse 2.4s ease-out infinite;
}
.stat-card-warn { border-color: color-mix(in srgb, var(--color-warn) 35%, var(--color-surface)); }
.card { border-radius: 14px; box-shadow: var(--shadow-1); }
.bar-row-track { height: 8px; }
.bar-row-fill { transform-origin: left; animation: nmwBar 1s cubic-bezier(.2, .7, .2, 1) both; }
.bar-row:nth-child(1) .bar-row-fill { animation-delay: .2s; }
.bar-row:nth-child(2) .bar-row-fill { animation-delay: .3s; }
.bar-row:nth-child(3) .bar-row-fill { animation-delay: .4s; }
.bar-row:nth-child(4) .bar-row-fill { animation-delay: .5s; }
.bar-row:nth-child(5) .bar-row-fill { animation-delay: .6s; }
.bar-row:nth-child(6) .bar-row-fill { animation-delay: .7s; }
.bar-row:nth-child(7) .bar-row-fill { animation-delay: .8s; }
.bar-row:nth-child(8) .bar-row-fill { animation-delay: .9s; }

/* Tablas */
.data-table th {
  background: var(--color-surface); font-family: var(--font-mono); font-weight: 500;
  font-size: 10.5px; letter-spacing: .14em; color: var(--color-text-3);
}

/* ── Asesor del taller (interpretación IA de los KPIs) ─────────────────────── */
.asesor-card { margin-bottom: var(--space-5); }
.asesor-intro { margin: 0 0 var(--space-4); font-size: 13.5px; color: var(--color-text-2); line-height: 1.6; }
.asesor-banner {
  display: inline-block; padding: 6px 14px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 700; margin-bottom: var(--space-3);
}
.asesor-neutro { background: var(--color-surface-2); color: var(--color-text-2); }
.asesor-ok { background: var(--color-success-soft); color: var(--color-success); }
.asesor-warn { background: var(--color-warn-soft); color: var(--color-warn); }
.asesor-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.asesor-resumen { margin: 0 0 var(--space-3); font-size: 15px; line-height: 1.6; max-width: 68ch; }
.asesor-comparacion { margin: 0 0 var(--space-4); font-size: 13.5px; color: var(--color-text-2); line-height: 1.6; max-width: 68ch; }
.asesor-seccion {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-text-3); margin: var(--space-5) 0 var(--space-3);
}
.asesor-hallazgos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.asesor-hallazgo { display: flex; gap: var(--space-3); align-items: flex-start; }
.asesor-hallazgo strong { font-size: 14px; }
.asesor-hallazgo p { margin: 4px 0 0; font-size: 13.5px; color: var(--color-text-2); line-height: 1.55; max-width: 64ch; }
.asesor-sev {
  flex-shrink: 0; min-width: 52px; text-align: center; padding: 3px 8px;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 700;
}
.asesor-sev-alta { background: var(--color-danger-soft); color: var(--color-danger); }
.asesor-sev-media { background: var(--color-warn-soft); color: var(--color-warn); }
.asesor-sev-baja { background: var(--color-surface-2); color: var(--color-text-2); }
.asesor-acciones { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--space-3); }
.asesor-acciones li { font-size: 14px; }
.asesor-acciones p { margin: 4px 0 0; font-size: 13.5px; color: var(--color-text-2); line-height: 1.55; max-width: 64ch; }
.asesor-disclaimer {
  margin: var(--space-5) 0 var(--space-3); font-size: 12px; color: var(--color-text-3);
  line-height: 1.5; border-top: 1px solid var(--color-border); padding-top: var(--space-3);
}

/* ═══════════ Pulido para demo comercial (sep-2026) ═══════════ */

/* Menú lateral agrupado */
.nav-group-label {
  font-family: var(--font-display); font-size: 9.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(234, 242, 250, .38); padding: 0 12px; margin: var(--space-4) 0 var(--space-1);
}
.nav-sep { height: 1px; margin: var(--space-3) var(--space-2); background: rgba(234, 242, 250, .14); }
.nav-group-label:first-child { margin-top: 0; }
.app-nav { overflow-y: auto; min-height: 0; }
.app-sidebar .nav-item { min-height: 36px; }

/* Cabecera de página: título a la izquierda, acciones a la derecha */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: var(--space-3); color: var(--color-text-3); }
.crumb { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--color-text-2); cursor: pointer; }
.crumb:hover { color: var(--color-primary); }
.crumb-current { color: var(--color-text-3); font-size: 12.5px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head-main { min-width: 0; }
.page-head .wo-header { margin-bottom: 4px; }
.page-head .wo-header-num { font-size: 24px; letter-spacing: -.01em; }
.page-sub { margin: 0; font-size: 14px; color: var(--color-text-2); }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--color-text-3); }
.control-sm { font-size: 13.5px; padding: 0 10px; min-height: 36px; width: auto; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-icon {
  width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--color-text-3); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover:not(:disabled) { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text); }
.btn-icon:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-focus); }
.btn-icon:disabled { opacity: .3; cursor: default; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon[data-quita]:hover:not(:disabled), .btn-icon[data-quita-cg]:hover, .btn-icon[data-quita-cond]:hover,
.btn-icon[data-quita-ex]:hover, .btn-icon[data-quita-archivo]:hover, .btn-icon[data-quita-res]:hover, .btn-icon[data-qcp-quita]:hover {
  color: var(--color-danger); background: var(--color-danger-soft); border-color: transparent;
}
.sem-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-2); }

/* Menú desplegable de acciones */
.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-2); padding: 4px; display: flex; flex-direction: column;
}
.menu-item {
  text-align: left; background: none; border: none; border-radius: 6px; padding: 9px 12px;
  font-size: 13.5px; font-weight: 600; color: var(--color-text); cursor: pointer;
}
.menu-item:hover { background: var(--color-surface-2); }
.menu-item-danger { color: var(--color-danger); }
.menu-item-danger:hover { background: var(--color-danger-soft); }

/* Ficha y pestañas del detalle de OT */
.info-card { padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5); }
.info-card .detail-grid { margin-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-4) var(--space-5); }
.detail-wide { grid-column: 1 / -1; }
.dd-muted { color: var(--color-text-3); font-size: 12.5px; }
.title-muted { color: var(--color-text-3); font-size: .7em; font-weight: 500; margin-left: 6px; }
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-5);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--color-text-2); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-text); border-bottom-color: var(--color-primary); }
.tab-count { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--color-text-3); margin-left: 4px; }
.tab-panel { display: flex; flex-direction: column; gap: var(--space-5); }
.tab-panel .summary-card, .tab-panel .card { margin-top: 0; }
.panel-section-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); min-height: 36px; }
.panel-section-title { font-size: 15px; font-weight: 700; }
.tab-panel .wo-totals { margin-top: 0; }
.tab-panel .btn-block { width: auto; min-height: 40px; font-size: 14px; }

/* Carga: bloque con brillo en vez de "Cargando…" suelto. Aparece con retraso para no parpadear
   cuando la respuesta llega rápido. */
@keyframes nmwShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes nmwAppear { from { opacity: 0; } to { opacity: 1; } }
.empty-state.loading {
  color: transparent; user-select: none; height: 64px; max-width: 100%; margin: 0; border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-surface) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: nmwAppear .2s .15s both, nmwShimmer 1.3s linear infinite;
}

/* Barras de desplazamiento acordes al tema (la del kanban salía blanca en modo oscuro) */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Tablas: identificadores, montos y estados en una línea */
.data-table td.mono, .data-table .mono, .data-table .badge, .data-table td:has(> .badge) { white-space: nowrap; }
.data-table td { vertical-align: middle; }
.data-table th { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.row-actions { flex-wrap: nowrap; }

/* Cifras de las tarjetas: se achican con el ancho de la tarjeta en vez de desbordarse */
.stat-card { container-type: inline-size; min-width: 0; }
.stat-value { font-size: clamp(22px, 14cqi, 38px); white-space: nowrap; }
.summary-stats .stat-value { font-size: clamp(20px, 13cqi, 28px); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Barra de filtros compacta (OTs, Cotizaciones, Clientes, Máquinas) */
.filter-bar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-4); }
.filter-bar .control { width: auto; min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.filter-bar .control[type="text"] { flex: 1 1 200px; max-width: 340px; }
.filter-bar select.control { flex: 0 1 auto; max-width: 190px; }
.filter-bar .chip-row { margin-right: var(--space-2); }

/* Acciones de la cotización en una sola fila */
.quote-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }

/* Acción destructiva dentro de un formulario: texto rojo, a la izquierda, lejos de Guardar */
.btn-danger-text {
  margin-right: auto; background: none; border: none; padding: 0 4px; min-height: 44px;
  font-size: 13.5px; font-weight: 600; color: var(--color-danger); cursor: pointer;
}
.btn-danger-text:hover { text-decoration: underline; }
.btn-danger-text.is-activar { color: var(--color-success); }
.btn-danger-text:has(+ .btn-danger-text) { margin-right: 0; }

/* Módulos contratados en la ficha del taller (superadmin) */
.product-list { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--color-border); padding-top: var(--space-3); }
.product-list-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-3); }
.modal-card label.product-row { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; line-height: 1.4; }
.product-row input { margin-top: 2px; }
.product-group-title { font-size: 12px; font-weight: 700; color: var(--color-text-2); margin-top: 4px; }

/* Encabezados ordenables: la flecha marca qué columna manda */
.th-ordenable { cursor: pointer; user-select: none; }
.th-ordenable:hover { color: var(--color-text); }
.th-ordenable[aria-sort]::after { margin-left: 6px; font-size: 9px; color: var(--color-primary); }
.th-ordenable[aria-sort="ascending"]::after { content: '▲'; }
.th-ordenable[aria-sort="descending"]::after { content: '▼'; }

/* Estados de cotización como chip */
.badge.quote-badge-borrador { background: var(--color-surface-2); color: var(--color-text-2); }

/* Teléfono: barra superior con botón de menú y cajón lateral */
.mobile-bar, .nav-scrim { display: none; }
@media (max-width: 720px) {
  .mobile-bar {
    display: flex; align-items: center; gap: var(--space-3); position: sticky; top: 0; z-index: 30;
    height: 56px; padding: 0 var(--space-3); background: var(--color-sidebar); color: #EAF2FA;
    border-bottom: 1px solid rgba(160, 200, 240, .14);
  }
  .mobile-menu-btn { width: 40px; height: 40px; border: none; border-radius: var(--radius-md); background: transparent; color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .mobile-menu-btn svg { width: 22px; height: 22px; }
  .mobile-bar-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 272px; height: 100vh; height: 100dvh;
    flex-direction: column; align-items: stretch; padding: var(--space-5) var(--space-4);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-2);
  }
  body.nav-open .app-sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: var(--color-scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-brand { margin-bottom: var(--space-5); padding: 0 var(--space-2); }
  .sidebar-brand > div { display: block; }
  .app-nav { flex-direction: column; overflow-x: visible; overflow-y: auto; flex: 1; }
  .nav-item { width: 100%; }
  .nav-item span { display: inline; }
  .sidebar-footer { margin-top: var(--space-4); flex-direction: column; }
  .sidebar-footer .theme-toggle span { display: inline; }
  .user-block { border-top: 1px solid rgba(160, 200, 240, .14); padding: 10px 4px; }
  .user-info { display: block; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .stat-card { padding: 14px 16px; }
  .page-head { flex-direction: column; }
  .info-card .detail-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); }
  .page-actions { width: 100%; }
  .filter-bar .control[type="text"] { max-width: none; }
  /* Safari en iPhone hace zoom a toda la página al enfocar un campo de menos de 16 px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { font-size: 16px !important; }
  .filter-bar select.control { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .nav-scrim { transition: none; }
  .empty-state.loading { animation: none; }
}

/* Teléfono: cada fila de una tabla se lee como tarjeta (rótulo + valor), sin desplazar de lado.
   El rótulo sale de data-label, que pone el motor de tablas ordenables en cada celda. */
@media (max-width: 640px) {
  .table-scroll:has(> .data-table[data-cableada]) { border: none; overflow: visible; }
  .data-table[data-cableada] { min-width: 0; background: none; }
  .data-table[data-cableada] thead { display: none; }
  .data-table[data-cableada], .data-table[data-cableada] tbody { display: block; }
  .data-table[data-cableada] tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 10px; padding: 14px 16px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  }
  .data-table[data-cableada] tr:hover td { background: none; }
  .data-table[data-cableada] td { display: block; padding: 0; border: none; min-width: 0; overflow-wrap: anywhere; }
  .data-table[data-cableada] td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-family: var(--font-display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-3);
  }
  /* La primera columna es el título de la tarjeta; las celdas sin rótulo (acciones) ocupan el ancho */
  .data-table[data-cableada] td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 700; }
  .data-table[data-cableada] td:first-child::before { display: none; }
  .data-table[data-cableada] td:not([data-label]) { grid-column: 1 / -1; }
  .data-table[data-cableada] td:not([data-label]):empty { display: none; }
  .data-table[data-cableada] .row-actions button { flex: 1; min-height: 40px; }
}

/* ═══════════ Inicio de la plataforma y módulo activo en el menú ═══════════ */


.inicio-saludo { display: flex; flex-direction: column; gap: 4px; font-weight: 300; }
.inicio-saludo strong { font-weight: 600; }
.inicio-empresa { font-size: 13px; font-weight: 500; color: var(--color-text-2); letter-spacing: 0; }
.inicio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.inicio-card { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.inicio-card-icon { width: 40px; height: 40px; }
.inicio-card-title { font-size: 17px; font-weight: 600; }
.inicio-card-text { margin: 0 0 var(--space-2); font-size: 13.5px; line-height: 1.5; color: var(--color-text-2); }
.inicio-card .btn-primary { margin-top: auto; }
.inicio-familia { margin-top: var(--space-5); }
.inicio-familia-ico { width: 22px; height: 22px; align-self: center; }
.inicio-familia.is-pronto .inicio-familia-ico { filter: grayscale(1); opacity: .45; }
.inicio-familia-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: var(--space-3); padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.inicio-familia-nombre { margin: 0; font-size: 16px; font-weight: 300; }
.inicio-familia-nombre b { font-weight: 600; color: var(--color-primary); }
.inicio-familia-head p { margin: 0; font-size: 13px; color: var(--color-text-3); }
.inicio-familia.is-pronto .inicio-familia-head { border-bottom-style: dashed; }
.inicio-familia.is-pronto .inicio-familia-nombre { color: var(--color-text-3); }
.inicio-pronto { margin-top: -4px; }
@media (max-width: 640px) { .inicio-grid { grid-template-columns: 1fr; } }

/* ═══════════ Cuenta y contraseñas ═══════════ */
.badge.provisoria { background: var(--color-warn-soft); color: var(--color-warn); }
.pass-row { display: flex; gap: 8px; }
.pass-row input { flex: 1; min-width: 0; font-family: var(--font-mono); }
.login-link { background: none; border: none; padding: 0; font: inherit; font-size: 13px; color: var(--color-primary); cursor: pointer; align-self: flex-start; }
.login-link:hover { text-decoration: underline; }
.login-msg { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--color-text-2); }
.user-block .user-info { cursor: pointer; }
.modal-form { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.user-avatar { cursor: pointer; }
.modal-bloque { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.modal-bloque label { align-self: stretch; }

/* ---------- Ficha de empresa (consola) ---------- */
.ficha-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.ficha-head .view-title { margin: 0; }
.stat-de { font-size: .6em; font-weight: 500; color: var(--color-text-3); }
.stat-card .tall-storage-track { margin-top: 10px; }
.ficha-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 820px; }
.ficha-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.ficha-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--color-text); }
.ficha-form input[type="text"], .ficha-form input[type="number"] {
  font-size: 16px; font-weight: 400; padding: 10px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.ficha-form input:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.ficha-form label.product-row { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; line-height: 1.4; }
.ficha-form label.check-row:not(.product-row) { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.ficha-hint { margin: 0; font-size: 12px; font-weight: 400; color: var(--color-text-3); }
.ficha-acciones { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.ficha-ok { margin: 0; font-size: 13.5px; color: var(--color-success); }

/* Paleta personalizada: selector de color + su código, lado a lado */
.color-par { display: flex; align-items: center; gap: 6px; }
.color-par input[type="text"] {
  width: 92px; font-size: 13px; padding: 7px 8px; text-transform: uppercase;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
}
.color-par input[type="text"]:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.color-par input.is-invalid { border-color: var(--color-danger); }

/* Licencias por módulo: uso de la empresa arriba de la tabla de usuarios */
.licencias-uso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--space-4); font-size: 12.5px; }
.licencia-chip { padding: 4px 10px; border-radius: var(--radius-full); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text-2); }
.licencia-chip b { font-family: var(--font-mono); font-weight: 600; color: var(--color-text); margin-left: 4px; }
.licencia-chip.llena { border-color: var(--color-warn); }
.texto-alerta { color: var(--color-warn); font-weight: 700; }

/* Tu plan (app) y solicitudes de ampliación (consola) */
.modal-card textarea {
  font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.modal-card textarea:focus-visible { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus); }
.plan-modulos { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--space-4); }
.plan-modulo { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.plan-ampliar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.plan-ampliar .report-hint { margin: 4px 0 0; }
.plan-pendiente { margin: 8px 0 0; font-size: 13px; color: var(--color-warn); font-weight: 600; }
.solicitud-msg { min-width: 220px; max-width: 420px; white-space: pre-wrap; }

/* Estado de la empresa: selector en el contrato y aviso fijo al pie en la app */
.ficha-form select {
  font-size: 16px; font-weight: 400; padding: 10px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.ficha-form input[type="date"] {
  font: inherit; font-size: 16px; font-weight: 400; padding: 9px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
/* Centrado sobre el área de contenido (a la derecha del menú lateral de 232 px), sin tapar el menú. */
.aviso-empresa {
  position: fixed; left: calc(232px + (100% - 232px) / 2); bottom: 16px; transform: translateX(-50%); z-index: 9;
  width: min(760px, calc(100% - 232px - 32px)); padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow-2);
  background: var(--color-warn-soft); color: var(--color-text); border: 1px solid var(--color-warn);
}
.aviso-empresa.bloqueo { background: var(--color-danger-soft); border-color: var(--color-danger); }
.aviso-empresa a { color: inherit; font-weight: 600; }
body.con-aviso-empresa .app-main { padding-bottom: 110px; }
@media (max-width: 720px) { .aviso-empresa { left: 50%; width: calc(100% - 32px); bottom: 12px; } }
@media print { .aviso-empresa { display: none; } }

/* ---------- Cotizaciones: editor, visor e impresión (módulo Cotizaciones C2) ---------- */
.cot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-4); align-items: start; }
.cot-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.cot-eco { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.cot-eco-fila { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.cot-eco-fuerte { font-weight: 700; }
.cot-eco-total { font-weight: 800; font-size: 16px; border-top: 1px solid var(--color-border); padding-top: 6px; }
.cot-eco-sub { font-size: 12px; color: var(--color-text-3); }
.cot-eco-sep { height: 1px; background: var(--color-border); margin: 6px 0; }
.cot-aviso { margin: 6px 0 0; font-size: 12px; color: var(--color-warn); font-weight: 600; }
.cot-cabecera { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); }
.cot-campo { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--color-text-2); }
.cot-campo-ancho { grid-column: 1 / -1; }
.cot-fx { display: flex; gap: 6px; }
.cot-fx input { flex: 1; min-width: 0; }
.cot-tabla td { vertical-align: top; padding: 8px 10px; }
.cot-tabla th { padding: 10px; }
.cot-tabla .control { min-height: 36px; }
.cot-desc { min-width: 200px; }
.cot-desc input { width: 100%; }
.cot-num { width: 78px; }
.cot-unidad { width: 64px; }
.cot-gp { width: 70px; }
.cot-precio { width: 110px; }
.cot-total { white-space: nowrap; font-weight: 600; padding-top: 16px !important; }
.cot-tabla [data-pv] { display: inline-block; padding-top: 8px; white-space: nowrap; }
.cot-detalle-prev { font-size: 12px; color: var(--color-text-3); margin-top: 4px; white-space: pre-wrap; }
.cot-acciones { white-space: nowrap; display: flex; gap: 2px; align-items: center; }
.cot-acciones .btn-icon { position: relative; }
.cot-badge { position: absolute; top: -4px; right: -4px; font-size: 9px; font-weight: 800; background: var(--color-primary); color: var(--color-on-primary); border-radius: var(--radius-full); padding: 0 4px; }
.cot-botonera { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cot-acciones-finales { margin-top: var(--space-4); }
.cot-bloque { display: flex; flex-direction: column; gap: 8px; }
.cot-bloque-titulo { font-size: 13px; font-weight: 700; }
.cot-par { display: flex; gap: 8px; align-items: center; }
.cot-par input[type="text"] { flex: 1; min-width: 0; }
.cot-par input[type="number"] { width: 130px; }
.cot-condicion { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--color-border); }
.cot-notas label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; }
.cot-notas textarea, .cot-condicion textarea { font: inherit; resize: vertical; }
.cot-asunto { font-weight: 700; font-size: 15px; margin: 0 0 var(--space-3); }
.cot-cond-ro p { margin: 2px 0 8px; font-size: 13px; color: var(--color-text-2); white-space: pre-wrap; }
.cot-nota { font-size: 13px; color: var(--color-text-2); white-space: pre-wrap; margin: 0; }
.cot-nota-interna { background: var(--color-warn-soft); padding: 8px 12px; border-radius: var(--radius-md); }
.cfg-cot { display: flex; flex-direction: column; gap: var(--space-3); max-width: 820px; }
.cfg-cot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); align-items: end; }
.cfg-cot-grid .form-field { margin: 0; max-width: none; }
.cfg-cot-monedas { display: flex; gap: 14px; font-weight: 400; min-height: 36px; align-items: center; }
.cfg-cot-titulo { font-size: 13px; font-weight: 700; margin-top: var(--space-2); }
.cfg-cot-plantilla { display: flex; flex-direction: column; gap: 6px; }
.cfg-cot-plantilla textarea, .cfg-cot-ancho textarea { font: inherit; resize: vertical; }
.cfg-cot-ancho { max-width: none; }
.print-detalle { font-size: 11px; color: #555; white-space: pre-wrap; }
.print-condicion { margin: 2px 0 6px; font-size: 12px; white-space: pre-wrap; }
.print-pie { margin-top: 14px; font-size: 11px; color: #555; }
.print-totales { width: auto; margin-left: auto; }

@media (max-width: 960px) {
  .cot-layout { grid-template-columns: 1fr; }
  .cot-eco { position: static; order: -1; }
}
@media (max-width: 720px) {
  /* En el teléfono cada línea es una tarjeta: las celdas se apilan con su nombre de columna. */
  .cot-tabla thead { display: none; }
  .cot-tabla, .cot-tabla tbody, .cot-tabla tr, .cot-tabla td { display: block; width: 100%; }
  .cot-tabla { min-width: 0; }
  .cot-tabla tr { border-bottom: 1px solid var(--color-border); padding: 8px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .cot-tabla td { border: none; padding: 0 12px; }
  .cot-tabla td.cot-desc, .cot-tabla td.cot-acciones { grid-column: 1 / -1; }
  .cot-tabla td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--color-text-3); text-transform: uppercase; letter-spacing: .06em; }
  .cot-num, .cot-unidad, .cot-gp, .cot-precio { width: 100%; }
  .cot-par input[type="number"] { width: 100px; }
}

/* Editor: datos y totales arriba lado a lado; las líneas a todo el ancho (con costos son muchas columnas). */
.cot-ed { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "cab eco" "lineas lineas" "resto resto"; gap: var(--space-4); align-items: start; }
.cot-ed .cot-cabecera { grid-area: cab; }
.cot-ed .cot-eco { grid-area: eco; position: static; }
.cot-lineas { grid-area: lineas; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cot-resto { grid-area: resto; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); align-items: start; }
@media (max-width: 900px) {
  .cot-ed { grid-template-columns: 1fr; grid-template-areas: "cab" "eco" "lineas" "resto"; }
}

/* Catálogo (módulo Cotizaciones) */
.cat-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.cat-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.cat-form textarea { font: inherit; resize: vertical; padding: 10px 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); }
.cat-ancho { grid-column: 1 / -1; }
.cat-lista { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.cat-opcion { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); cursor: pointer; font: inherit; font-size: 13.5px; }
.cat-opcion:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }

/* Cotizaciones · seguimiento (C4): visor con pestañas, OC, bitácora, documentos y aprobación */
.badge.quote-badge-anulada { background: var(--color-surface-2); color: var(--color-text-3); text-decoration: line-through; }
.cot-visor-cab { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.cot-visor-estado { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.cot-oc { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; border: 1px solid var(--color-border); }
.cot-oc-recibida { background: var(--color-success-soft); color: var(--color-success); border-color: transparent; }
.cot-oc-pendiente { background: var(--color-warn-soft); color: var(--color-warn); border-color: transparent; }
.cot-oc-sin { background: var(--color-danger-soft); color: var(--color-danger); border-color: transparent; }
.cot-fila-no td { opacity: .55; }
.cot-res-celda { white-space: nowrap; }
.cot-chip { display: inline-block; margin: 0 4px 4px 0; padding: 2px 8px; border-radius: var(--radius-full); background: var(--color-surface-2); border: 1px solid var(--color-border); font-size: 11.5px; color: var(--color-text-2); text-decoration: none; }
.cot-chip:hover { border-color: var(--color-primary); color: var(--color-text); }
.cot-nota-nueva { display: flex; gap: 8px; align-items: flex-start; margin-bottom: var(--space-3); }
.cot-nota-nueva textarea { flex: 1; font: inherit; resize: vertical; }
.cot-bitacora { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cot-bitacora li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0 10px 14px; border-left: 2px solid var(--color-border); font-size: 13.5px; }
.cot-bitacora li.cot-bit-estado, .cot-bitacora li.cot-bit-oc { border-left-color: var(--color-primary); }
.cot-bitacora li.cot-bit-version { border-left-color: var(--color-warn); }
.cot-bit-fecha { font-size: 11.5px; color: var(--color-text-3); }
.cot-docs { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cot-docs li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.cot-docs li .btn-icon { margin-left: auto; }
.cot-aprob-lista { display: flex; flex-direction: column; gap: 6px; }
.modal-card label.cot-aprob-fila, .cot-aprob-fila { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 13.5px; }
.cot-aprob-uni { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12.5px; color: var(--color-text-3); }
.cot-aprob-uni input { width: 80px; }

/* Tablero comercial (módulo Cotizaciones C5) */
.tablero-valor { font-size: 26px; }
.tablero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); align-items: start; }
.tablero-grid .report-card { margin: 0; }
.tablero-embudo { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.tablero-embudo-fila { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.tablero-barra { height: 10px; background: var(--color-surface-2); border-radius: var(--radius-full); overflow: hidden; }
.tablero-barra span { display: block; height: 100%; border-radius: var(--radius-full); }
.tablero-serie { display: flex; align-items: flex-end; gap: 10px; height: 160px; margin-top: 12px; }
.tablero-mes { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.tablero-mes-barras { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.tablero-mes-barras span { width: 40%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 2px; }
.tablero-mes-env { background: var(--color-primary); opacity: .45; }
.tablero-mes-apr { background: var(--color-success); }
.tablero-leyenda { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-3); margin-top: 8px; }
.tablero-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* Maestro de clientes: formulario, ficha con pestañas y contactos como tarjetas */
.cli-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-3); }
.cli-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.modal-card .cli-form label.check-row { flex-direction: row; align-items: center; font-weight: 400; }
.cli-form textarea { font: inherit; resize: vertical; padding: 10px 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); }
.cli-form select { font-size: 16px; padding: 10px 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); }
.cli-ancho { grid-column: 1 / -1; }
.cli-contactos { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.cli-contacto { display: flex; flex-direction: column; gap: 10px; padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.cli-contacto.inactivo { opacity: .6; }
.cli-contacto-cab { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cli-contacto-cab .cell-muted { font-size: 12.5px; }
.cli-contacto-nombre { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.cli-estrella { color: var(--color-warn); font-size: 15px; }
.cli-contacto-datos { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.cli-contacto-datos a { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text); text-decoration: none; min-width: 0; }
.cli-contacto-datos a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-contacto-datos a:hover { color: var(--color-primary); }
.cli-contacto-datos svg { width: 15px; height: 15px; flex: none; color: var(--color-text-3); }
.cli-contacto-nota { margin: 0; font-size: 12.5px; color: var(--color-text-2); background: var(--color-surface-2); padding: 6px 10px; border-radius: var(--radius-md); }
.cli-contacto-acciones { display: flex; align-items: center; gap: 12px; margin-top: auto; }

/* Inicio: adicionales incluidos en un módulo */
.inicio-incluye { margin: -4px 0 12px; font-size: 12.5px; color: var(--color-text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Consola → Módulos: mapa de la plataforma */
.mod-seccion { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-3); margin: var(--space-5) 0 var(--space-2); }
.mod-card { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }
.mod-anidada { margin: 0; background: var(--color-surface-2); box-shadow: none; }
.mod-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.mod-nombre { font-weight: 700; font-size: 15px; }
.mod-datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px var(--space-5); margin: 0; }
.mod-datos dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-3); margin-bottom: 4px; }
.mod-datos dd { margin: 0; font-size: 13.5px; }
.mod-ancho { grid-column: 1 / -1; }
.mod-chip { display: inline-block; margin: 0 4px 4px 0; padding: 2px 9px; border-radius: var(--radius-full); background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 600; }
.mod-flag { background: var(--color-surface-2); color: var(--color-text-2); border: 1px solid var(--color-border); }
.mod-empresa { display: inline-block; margin: 0 6px 4px 0; padding: 2px 9px; border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 12.5px; }
.mod-hijos { border-left: 3px solid var(--color-primary); padding-left: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.mod-hijos-titulo { font-size: 12px; font-weight: 700; color: var(--color-text-2); }
.badge.mod-tipo-base { background: var(--color-surface-2); color: var(--color-text-2); }
.badge.mod-tipo-modulo { background: var(--color-primary-soft); color: var(--color-primary); }
.badge.mod-tipo-adicional { background: var(--color-warn-soft); color: var(--color-warn); }
.badge.mod-tipo-transversal { background: var(--color-success-soft); color: var(--color-success); }

/* ---------- Configuración: listas de la OT ---------- */
.cfg-listas { display: flex; flex-direction: column; gap: var(--space-5); }
.cfg-lista { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.cfg-lista .status-list { max-width: none; }
.cfg-lista-inactiva .control { color: var(--color-text-3); }
.cfg-lista-ingreso { flex: 0 0 auto !important; width: auto; }
.cfg-lista-nueva { max-width: 420px; }
@media (max-width: 640px) {
  .cfg-lista .status-row { flex-wrap: wrap; }
  .cfg-lista .status-row > .control:first-child { flex-basis: 100%; }
}

/* Centro de costo de la OT cuando no es el facturable (garantía, interno…) */
.badge-cc { background: var(--color-surface-2); color: var(--color-text-2); border: 1px solid var(--color-border); }
.wo-card-cc { margin-top: 4px; }

/* ---------- Seguimiento de cobro ---------- */
.badge.cobro-sin_oc { background: var(--color-warn-soft); color: var(--color-warn); }
.badge.cobro-en_ejecucion { background: var(--color-surface-2); color: var(--color-text-2); }
.badge.cobro-por_facturar, .badge.cobro-facturada { background: var(--color-primary-soft); color: var(--color-primary); }
.badge.cobro-vencida { background: var(--color-danger-soft); color: var(--color-danger); }
.badge.cobro-pagada { background: var(--color-success-soft); color: var(--color-success); }
.cot-cobro { display: flex; flex-direction: column; gap: var(--space-3); max-width: 760px; }
.cot-cobro-docs { display: flex; flex-direction: column; gap: 8px; }
.cot-cobro-doc { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cot-cobro-doc .check-row { flex: 1 1 240px; }
.cot-cobro-doc .control { flex: 0 1 220px; }

/* ---------- Notas de la OT ---------- */
.nota-ot-acciones { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.nota-ot { display: flex; flex-direction: column; gap: 4px; }
.nota-ot-texto { white-space: pre-wrap; }
.cot-bitacora li.nota-ot-pendiente { border-left: 3px solid var(--color-warn); }
.nota-ot .link-btn { align-self: flex-start; }
.badge-btn { border: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }

@media (max-width: 720px) {
  .cfg-indice { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
