/* =========================
   WerkstattGeist — tema claro
========================= */

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

:root {
  --font-body: Arial, Helvetica, sans-serif;
  --font-display: "Montserrat", Arial, Helvetica, sans-serif;

  /* Marca */
  --brand-red: #c1272d;
  --brand-red-dark: #9e1f24;

  /* Acción / UI (teal) */
  --primary: #0f6b6c;
  --primary-hover: #0d5a5b;
  --primary-bg: rgba(15, 107, 108, 0.12);
  --primary-line: rgba(15, 107, 108, 0.35);
  --primary-soft: #e6f3f3;

  --accent-cyan: #0d8a8c;
  --accent-medium: #127475;
  --accent-navy: #0a3a44;

  --bg: #f0f3f6;
  --text: #1a1d24;
  --muted: #5c6370;

  --line: #e2e6ec;
  --line2: #cfd4dc;

  --surface: #ffffff;
  --glass: #ffffff;
  --card: #ffffff;
  --panel: #ffffff;

  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow2: 0 2px 12px rgba(15, 23, 42, 0.06);

  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;

  --danger-bg: #ffebee;
  --danger-line: #ef9a9a;
  --ring: 0 0 0 3px rgba(15, 107, 108, 0.22);

  --hero-gradient: linear-gradient(105deg, #0a3a44 0%, #0f6b6c 45%, #b71c1c 100%);

  /* Fondo pantalla: difuminado verde ↔ azul (más notorio; afinar con estas variables) */
  --page-bg-tint: #e2e9e5;
  --page-tint-mid-1: rgba(218, 232, 224, 0.97);
  --page-tint-mid-2: rgba(213, 225, 242, 0.97);
  --page-edge-green: rgba(48, 120, 88, 0.42);
  --page-edge-blue: rgba(38, 88, 168, 0.4);
  --page-halo-nw: rgba(55, 130, 98, 0.28);
  --page-halo-se: rgba(50, 95, 180, 0.3);
}

/* El degradado va en <html> y el <body> es transparente: así cubre toda la ventana (evita “solo gris” en la columna de contenido). */
html {
  min-height: 100%;
  background-color: var(--page-bg-tint);
  background-image:
    linear-gradient(
      120deg,
      var(--page-edge-green) 0%,
      var(--page-tint-mid-1) 36%,
      var(--page-tint-mid-2) 64%,
      var(--page-edge-blue) 100%
    ),
    radial-gradient(1000px 720px at 0% 0%, var(--page-halo-nw) 0%, transparent 58%),
    radial-gradient(1000px 700px at 100% 100%, var(--page-halo-se) 0%, transparent 55%),
    radial-gradient(68vw 48vh at 70% 12%, rgba(40, 125, 145, 0.12) 0%, transparent 50%);
  background-attachment: fixed;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Generic UI ---------- */

.muted {
  color: var(--muted);
}

a {
  color: inherit;
}

.btn,
.button-link {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.btn:hover,
button:hover,
.button-link:hover {
  transform: translateY(-1px);
  background: #f6f8fa;
  border-color: var(--line2);
  box-shadow: var(--shadow2);
}

.btn:active,
button:active,
.button-link:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn:disabled,
button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary-line);
}

.btn.ghost:hover {
  background: var(--primary-bg);
}

.btn.danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: #b71c1c;
}

/* Cabecera hero: acciones sólido teal + texto claro */
.btn-hero,
.topbar-hero .btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  font-weight: 700;
}

.btn-hero:hover,
.topbar-hero .btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

/* Logout: rojo marca */
.btn-logout {
  width: 100%;
  background: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  color: #fff !important;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  justify-content: center;
  padding: 12px 14px;
}

.btn-logout:hover {
  background: var(--brand-red-dark) !important;
  border-color: var(--brand-red-dark) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn.sm {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

select {
  color-scheme: light;
  cursor: pointer;
  min-height: 44px;
  font-size: 15px;
}

select option {
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  font-size: 15px;
}

select[size] {
  overflow-y: auto;
  min-height: auto;
  padding: 6px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--surface);
}

label {
  display: block;
  margin: .5rem 0;
}

/* Card */
.card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 800;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

/* ---------- App shell ---------- */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px 18px 18px;
  border-right: 1px solid var(--line);
  background: var(--glass);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-lg);
  background: transparent;
  border: none;
}

.brand-mark {
  height: 52px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
  border-radius: 6px;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  font-size: 1.1rem;
}

.brand-rh {
  color: var(--brand-red);
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px 10px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
  justify-content: flex-start;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.9;
}

.nav-item:hover {
  background: #f0f3f5;
  border-color: var(--line);
}

.nav-item:hover .nav-icon {
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-bg);
  border-color: var(--primary-line);
  box-shadow: none;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.mini-user {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #f6f8fa;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
}

/* Main + topbar */
.main {
  padding: 20px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.topbar-hero,
.topbar.topbar-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  background: var(--hero-gradient);
  border: none;
  box-shadow: var(--shadow);
}

.topbar-hero .h1 {
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.topbar-hero .topbar-sub,
.topbar-hero #viewSubtitle,
.topbar-hero .muted {
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0.01em;
  font-family: var(--font-body);
  font-weight: 400;
  margin: 6px 0 0;
}

.h1 {
  margin: 0;
  font-size: 1.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Views */
.view {
  display: grid;
  gap: 16px;
}

.view.hidden {
  display: none;
}

/* Dashboard cards */
.grid.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  font-size: 28px;
  font-weight: 900;
  margin: 6px 0;
  letter-spacing: -0.4px;
}

/* Toolbar + split */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 12px 14px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow2);
}

.field {
  display: grid;
  gap: 6px;
}

/* Controles con clase .field (no confundir con contenedor grid .field) */
input.field,
select.field,
textarea.field {
  display: block;
  width: 100%;
  max-width: 100%;
}

.field label,
.field span {
  font-size: 12px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  align-items: start;
}

/* Lists */
.list {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow2);
}

.row:hover {
  background: #f9fafb;
  border-color: var(--line2);
}

.row-title {
  font-family: var(--font-display);
  font-weight: 800;
}

.row-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
}

.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f0f3f5;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Tables (admin/users) */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

th {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  font-family: var(--font-display);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
}

tr:hover td {
  background: #f6f8fa;
}

/* Modals */
dialog.modal {
  border: none;
  padding: 0;
  border-radius: var(--radius-xl);
  background: transparent;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  width: min(780px, calc(100vw - 24px));
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.18);
  padding: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.grid.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

/* Responsive */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .grid.cards {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .grid.form {
    grid-template-columns: 1fr;
  }
}

/* Scrollbar (optional) */
*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0);
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.06);
}

/* =========================
   Dashboard visual additions
   (pegar al final)
========================= */

.kpi-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.25fr 1fr;
  align-items: start;
}

/* Head coherente */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.kpi-value {
  font-size: 34px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: -0.3px;
  font-family: var(--font-display);
  color: var(--text);
}

.kpi-hours-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  margin-top: 8px;
  gap: 0;
}

/* Lista de técnicos: sin recorte por defecto (p. ej. técnico). */
.kpi-hours-scroll {
  min-height: 0;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

/* Admin, lider de taller, administrativo: tope fijo y barra de desplazamiento vertical. */
.kpi-hours-scroll--mgmt {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

.kpi-hours-scroll--mgmt::-webkit-scrollbar {
  width: 8px;
}

.kpi-hours-scroll--mgmt::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 4px;
}

.kpi-hours-scroll--mgmt::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.kpi-hours-scroll--mgmt::-webkit-scrollbar-thumb:hover {
  background: var(--primary-line);
  background-clip: content-box;
}

@supports (scrollbar-color: auto) {
  .kpi-hours-scroll--mgmt {
    scrollbar-color: var(--line2) rgba(15, 23, 42, 0.05);
    scrollbar-width: thin;
  }
}

.kpi-tech-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-tech-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.kpi-tech-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kpi-tech-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.kpi-tech-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.kpi-tech-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-tech-hrs {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 12px;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 58%;
}

.kpi-hrs-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.kpi-hrs-ref {
  color: var(--muted);
  font-weight: 600;
}

.kpi-hrs-reg {
  color: var(--primary);
  font-weight: 700;
}

.kpi-hrs-sep {
  color: var(--line2);
  font-weight: 500;
}

.kpi-hrs-n {
  font-size: 11px;
  font-weight: 500;
}

/* Barra: track = 100% = h. ref.; relleno = scaleX(reg/ref) (ver client/app.js) */
.kpi-tech-bar,
.kpi-total-bar {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.06);
}

.kpi-total-bar {
  margin-top: 6px;
  height: 8px;
  min-width: 0; /* en grid, el track usa todo el ancho del card */
}

.kpi-tech-bar-fill,
.kpi-total-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-cyan) 100%);
  transform-origin: 0% 50%;
  transition: transform 0.28s ease;
  will-change: transform;
  box-sizing: border-box;
}

.kpi-tech-bar-fill--over,
.kpi-total-bar-fill.kpi-tech-bar-fill--over {
  background: linear-gradient(90deg, var(--brand-red-dark) 0%, #e53935 100%);
}

.kpi-total-wrap {
  margin-top: 4px;
  width: 100%;
  min-width: 0;
}

.kpi-total-line {
  font-size: 11px;
  margin: 0 0 2px;
  line-height: 1.4;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kpi-hours-total-foot {
  display: block;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
  font-size: 11px;
  margin: 10px 0 0;
  line-height: 1.35;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.monthly-report-by-tech {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #f6f8fa;
}

.monthly-report-by-tech-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.monthly-report-detail-title {
  font-weight: 700;
  font-size: 14px;
  margin: 8px 0 10px;
}

.table.table--monthly-by-tech {
  font-size: 13px;
}

/* Subtabs */
.subtable {
  margin-top: 14px;
}

.subtable-head {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.subtab {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.subtab:hover {
  border-color: var(--primary-line);
  color: var(--text);
}

.subtab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Task list estilo móvil */
.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow2);
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-card:hover {
  background: #f9fafb;
  border-color: var(--line2);
  box-shadow: var(--shadow);
}

.asesor-part-card .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.task-title h4 {
  margin: 0;
  font-size: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.task-title p {
  margin: 4px 0 0;
  font-size: 13px;
}

.task-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #eef1f4;
  color: var(--text);
  font-size: 12px;
}

/* Chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f0f3f5;
  font-family: var(--font-body);
}

.chip.info {
  background: var(--primary-bg);
  border-color: var(--primary-line);
}

.chip.ok {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.20);
}

.chip.warn {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.22);
}

.chip.urgent {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

/* Pestaña flotante: buscar y filtrar órdenes */
.task-filter-panel {
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
}

.task-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  background: #f6f8fa;
  transition: background 0.15s;
}

.task-filter-header:hover {
  background: #eef1f4;
}

.task-filter-title {
  font-weight: 600;
  font-size: 14px;
}

.task-filter-toggle {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s;
}

/* Solo se pliegan los campos; Limpiar/Aplicar siguen visibles */
.task-filter-panel.collapsed .task-filter-collapsible {
  display: none;
}

.task-filter-body {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.task-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.task-filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 600px) {
  .task-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Archivo (órdenes completadas por mes) */
.archive-tasks-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.archive-month-block {
  margin: 0;
}

.archive-month-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-family: var(--font-display);
}

.archive-empty-msg {
  padding: 12px 0;
}

.archive-list-card {
  margin-top: 14px;
}

/* Tabla wrapper (para dashboard y admin) */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

/* Tablas del dashboard: altura máxima y barra de desplazamiento */
.subtable .table-wrap {
  max-height: 280px;
  overflow-x: auto;
  overflow-y: auto;
}

/* Resumen operativo: ancho mínimo para que todas las columnas sean visibles (scroll horizontal) */
.table.table--dash-ops {
  table-layout: auto;
  width: 100%;
  min-width: 960px;
}

.table.table--dash-ops th,
.table.table--dash-ops td {
  vertical-align: middle;
  font-size: 13px;
}

.table.table--dash-ops td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table.table--dash-ops th:nth-child(9),
.table.table--dash-ops td:nth-child(9) {
  width: 108px;
  text-align: right;
}

.table.table--dash-ops .btn.dash-desc-btn {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

/* Resumen operativo general (reporte mensual) */
.monthly-report-toolbar {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.monthly-report-totals {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
}

.monthly-report-table-wrap {
  max-height: 480px;
  overflow: auto;
}

/* Lista "Mis órdenes de trabajo" en el dashboard: scroll si hay muchas */
.task-list {
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Empty */
.empty {
  padding: 10px 4px;
}

/* Responsive */
@media (max-width: 980px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------- Modal (Task detail) ---------- */
.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 18px;
  overflow: auto;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  position: relative;
  padding: 18px;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--text);
  background: #f0f3f5;
}

.modal-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-ot {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .06em;
}

.modal-h1 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.modal-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f0f3f5;
  color: var(--text);
  font-family: var(--font-body);
}

.badge-warn {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .25);
}

.badge-info {
  background: var(--primary-bg);
  border-color: var(--primary-line);
}

.badge-ok {
  background: rgba(34, 197, 94, .12);
  border-color: rgba(34, 197, 94, .25);
}

.badge-danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

.modal-title-input {
  font-size: 18px;
  font-weight: 700;
}

/* Switch de estados de orden (empleado) */
.status-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #f0f3f5;
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--line);
}

.status-switch-btn {
  flex: 1;
  min-width: 104px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.status-switch-btn:hover {
  color: var(--text);
  background: #fff;
}

.status-switch-btn.active {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-line);
}

.status-switch.status-switch--locked,
.status-switch[aria-disabled="true"] {
  opacity: 0.75;
  pointer-events: none;
}

.status-switch--locked .status-switch-btn,
.status-switch[aria-disabled="true"] .status-switch-btn {
  cursor: not-allowed;
}

.status-switch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.part-requests-list,
.task-notes-list {
  max-height: 140px;
  overflow-y: auto;
}

.part-request-item,
.task-note-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #f9fafb;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.part-request-item .update-date,
.task-note-item .update-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Solicitudes de repuestos por orden (admin, líder, asesor repuestos) */
.part-requests-by-order {
  display: grid;
  gap: 16px;
}

.part-request-order-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow2);
  overflow: hidden;
}

.part-request-order-head {
  padding: 12px 16px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.part-request-order-head strong {
  font-size: 15px;
}

.part-request-list {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.part-request-order-card .part-request-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.part-request-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.part-request-desc {
  font-size: 14px;
}

.part-request-meta {
  font-size: 12px;
  margin-top: 4px;
}

.part-request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip.part-request-delivered {
  font-weight: 600;
}

.nav-item--notifications {
  position: relative;
}

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-item {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.notification-item.is-unread {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.04);
}

.notification-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.notification-item__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.notification-item__body {
  margin: 0 0 8px;
  line-height: 1.45;
}

.notification-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#notificationsFilterAll.active,
#notificationsFilterUnread.active {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

.notification-detail-modal {
  max-width: min(720px, 96vw);
}

.notification-detail-meta {
  margin-bottom: 12px;
}

.notifications-day-head {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.notifications-date-filter .field.sm {
  min-width: 100px;
}

.notification-detail-summary {
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: 14px;
  font-weight: 500;
}

.notification-detail-details {
  margin: 0 0 16px;
}

.notification-detail-block {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.06);
  margin-bottom: 10px;
}

.notification-detail-block:last-child {
  margin-bottom: 0;
}

.notification-detail-block__value {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  font-weight: 500;
  color: var(--text, #111827);
}

.notification-detail-context {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f9fafb;
}

.notification-context-head {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
}

.notification-context-block {
  margin-bottom: 12px;
}

.notification-context-block:last-child {
  margin-bottom: 0;
}

.notification-context-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 6px;
}

.notification-context-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.notification-context-list,
.notification-checklist {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 14px;
  line-height: 1.45;
}

.notification-checklist {
  list-style: none;
  padding-left: 0;
}

.notification-checklist-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.notification-checklist-mark {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent, #2563eb);
}

.notification-checklist-note {
  margin-top: 4px;
}

.notification-changes-table td {
  vertical-align: top;
  font-size: 13px;
  max-width: 220px;
  word-break: break-word;
}

.notification-change-old {
  color: var(--muted);
}

.notification-change-new {
  color: var(--text, #111827);
  font-weight: 500;
}

.project-updates-list {
  max-height: 180px;
  overflow-y: auto;
}

.project-update-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.project-update-item .update-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Vista de orden de trabajo: contenedor flex para que el body haga scroll */
.task-modal-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-card .modal-header {
  flex-shrink: 0;
}

.modal-card .modal-body {
  margin-top: 14px;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar visible en modal de órdenes de trabajo */
.modal-card .modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-card .modal-body::-webkit-scrollbar-track {
  background: #eef1f4;
  border-radius: 4px;
}

.modal-card .modal-body::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.22);
  border-radius: 4px;
}

.modal-card .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.32);
}

.modal-card .modal-actions {
  flex-shrink: 0;
  margin-top: 14px;
}

.modal-section {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.section-title {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-wrap label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mt {
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.modal-card .btn,
.task-modal-view .btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.modal-card .btn-ghost,
.task-modal-view .btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary-line);
}

.modal-card .btn-primary,
.task-modal-view .btn-primary,
.modal-card .btn.btn-primary,
.task-modal-view .btn.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------
   MODAL (Ventana flotante)
------------------------------ */
.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 9999;
  overflow: auto;
}

.modal {
  width: min(720px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal .modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal .modal-body,
.modal .modal-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.modal .modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
}

.icon-btn:hover {
  background: #f0f3f5;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.form-error {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f5c6cb;
  background: #fff5f5;
  color: #c62828;
  font-family: var(--font-body);
  font-size: 14px;
}

/* Refuerzo: botón primario relleno teal (sobreescribe duplicados al final del archivo) */
.btn.primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.btn.primary:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  color: #fff !important;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-page .login-card,
.login-page .card.login-card {
  width: 100%;
  max-width: 400px;
  margin: 0;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 1rem;
}

.login-page .card label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
}

.login-page .card .btn[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
}

.login-page .card .btn[type="submit"]:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.login-page .error,
#loginError {
  color: #c62828;
  font-size: 14px;
  font-family: var(--font-body);
  margin-top: 12px;
}

/* Subtítulos bajo títulos de card (formal) */
.card .card-head + .muted,
.card .muted {
  font-family: var(--font-body);
}

/* Modal: nueva orden — secciones (organización) */
#taskCreateModal .modal.modal--task-create {
  max-width: 560px;
  width: min(560px, 100%);
}

#taskCreateModal .form-lead {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1rem;
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

#taskCreateModal .form-section {
  padding: 0 0 1rem;
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

#taskCreateModal .form-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0.35rem;
  padding-bottom: 0;
}

#taskCreateModal .form-section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.65rem;
}

#taskCreateModal .form-section .field:last-child {
  margin-bottom: 0;
}

#taskCreateModal .mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
}

/* Modal nueva orden: bloque Cliente (mismo look que .btn.primary — sin pisar el relleno teal) */
#taskCreateModal .form-section--client {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

/* Bloque agrupado «Cliente y registro fotográfico»: separar sub-bloques y evitar doble borde con la sección padre */
#taskCreateModal .form-section[aria-labelledby="sec-client-photos-label"] > .form-section--create-photos {
  margin-top: 0.65rem;
  border-bottom: none;
  padding-bottom: 0;
}

#taskCreateModal .task-client-toggle.btn.primary {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#taskCreateModal .task-client-toggle.btn.primary:hover,
#taskCreateModal .task-client-toggle.btn.primary:focus-visible {
  color: #fff !important;
}

#taskCreateModal .task-client-toggle__chev {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  opacity: 0.9;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

#taskCreateModal .task-client-toggle.is-open .task-client-toggle__chev {
  transform: rotate(90deg);
}

#taskCreateModal .task-client-panel {
  margin-top: 0.65rem;
  padding: 0.85rem 0.9rem 0.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-line);
  background: var(--primary-soft);
}

#taskCreateModal .task-client-panel .field {
  margin-bottom: 0.75rem;
}

#taskCreateModal .task-client-panel .field:last-child {
  margin-bottom: 0.5rem;
}

#taskCreateModal .task-client-panel .field input {
  background: #fff;
}

/* Modal: elegir origen (nueva orden de trabajo) */
#taskOriginModal .modal.modal--task-origin {
  max-width: 520px;
  width: min(520px, 100%);
}

.task-origin-lead {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1rem;
}

.task-origin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .task-origin-grid {
    grid-template-columns: 1fr;
  }
}

.task-origin-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font: inherit;
}

.task-origin-btn:hover,
.task-origin-btn:focus-visible {
  outline: none;
  border-color: var(--primary-line);
  box-shadow: 0 0 0 1px var(--primary-soft);
  background: var(--primary-soft);
}

.task-origin-btn__label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.task-origin-btn__desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

#labModuleCreateModal .modal.modal--lab-module {
  max-width: 560px;
  width: min(560px, 100%);
}

#labModuleCreateModal .form-lab-module .form-lead {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1rem;
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

#labModuleCreateModal .form-lab-module .form-section {
  padding: 0 0 1rem;
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

#labModuleCreateModal .form-lab-module .form-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0.35rem;
  padding-bottom: 0;
}

#labModuleCreateModal .form-lab-module .form-section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.65rem;
}

#labModuleCreateModal .form-lab-module .field {
  margin-bottom: 0.75rem;
}

#labModuleCreateModal .form-lab-module .form-section .field:last-child {
  margin-bottom: 0;
}

#labModuleCreateModal .form-lab-module textarea,
#labModuleCreateModal .form-lab-module input,
#labModuleCreateModal .form-lab-module select {
  width: 100%;
  box-sizing: border-box;
}

#labModuleCreateModal .form-section--client .task-client-toggle.btn.primary {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#labModuleCreateModal .form-section--client .task-client-panel {
  margin-top: 0.65rem;
  padding: 0.85rem 0.9rem 0.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-line);
  background: var(--primary-soft);
}

#labModuleCreateModal .form-section--client .task-client-panel .field input {
  background: #fff;
}

/* Fotos por etapa (órdenes — recepción / diagnóstico / repuestos / reparación) */
.task-photo-slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 680px) {
  .task-photo-slot-grid {
    grid-template-columns: 1fr;
  }
}

.task-photo-slot-grid--single {
  grid-template-columns: 1fr;
  max-width: 440px;
}

.task-photo-carousel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--surface);
}

.task-photo-carousel__subtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.task-photo-carousel__stage {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: stretch;
}

.task-photo-carousel__nav {
  align-self: stretch;
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  font-size: 1.35rem;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.task-photo-carousel__nav:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.task-photo-carousel__viewport {
  position: relative;
  min-height: 160px;
  border-radius: var(--radius-md);
  background: repeating-linear-gradient(-45deg, var(--line), var(--line) 1px, transparent 1px, transparent 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.task-photo-carousel__img {
  width: 100%;
  height: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.task-photo-carousel__img:not(.hidden) {
  cursor: zoom-in;
}

body.task-photo-lightbox-open {
  overflow: hidden;
}

.task-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: min(24px, 4vw);
  background: rgba(0, 0, 0, 0.88);
}

.task-photo-lightbox.hidden {
  display: none !important;
}

.task-photo-lightbox__frame {
  max-width: min(96vw, 1200px);
  max-height: 96vh;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-photo-lightbox__img {
  max-width: 100%;
  max-height: 96vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
}

.task-photo-carousel__placeholder {
  font-size: 13px;
  padding: 16px;
}

.task-photo-carousel__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.task-photo-carousel__counter {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#taskDetailModal .task-detail-photo-submenu-toggle {
  width: 100%;
  margin-bottom: 10px;
}

#taskDetailModal .task-detail-photo-submenu-panel.task-client-panel {
  margin-bottom: 0;
}

#taskDetailModal .task-photo-carousel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Agrupación por etapa (vista empleado) */
#taskModalEmployee .emp-stage-block:not(.hidden) {
  margin-top: 0.15rem;
}

/* Registro fotográfico · modal nueva orden */
#taskCreateModal .form-section--create-photos {
  margin-top: 4px;
}

#taskCreateModal .task-create-photos-lead {
  margin: 0 0 10px;
}

#taskCreateModal .task-photo-carousel--create-draft {
  max-width: 440px;
}

#taskCreateModal .task-photo-carousel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Registro fotográfico · modal laboratorio / módulos */
#labModuleCreateModal .form-section--create-photos {
  margin-top: 4px;
}

#labModuleCreateModal .task-create-photos-lead {
  margin: 0 0 10px;
}

#labModuleCreateModal .task-photo-carousel--create-draft {
  max-width: 440px;
}

/* Audios de recepción */
.task-audio-carousel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--surface);
  max-width: 540px;
}

.task-audio-carousel__stage {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: stretch;
}

.task-audio-carousel__nav {
  align-self: stretch;
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  font-size: 1.35rem;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.task-audio-carousel__nav:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.task-audio-carousel__nav:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.task-audio-carousel__viewport {
  position: relative;
  min-height: 60px;
  border-radius: var(--radius-md);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
}

.task-audio-carousel__player {
  width: 100%;
}

.task-audio-carousel__placeholder {
  font-size: 13px;
  padding: 8px;
}

.task-audio-carousel__meta {
  margin-top: 8px;
  font-size: 12px;
  word-break: break-all;
}

.task-audio-carousel__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.task-audio-carousel__counter {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#taskDetailModal .task-audio-carousel__actions,
#taskCreateModal .task-audio-carousel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#taskCreateModal .form-section--create-audios {
  margin-top: 4px;
}

#taskCreateModal .task-audio-carousel--create-draft {
  max-width: 440px;
}

#labModuleCreateModal .task-photo-carousel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Checklist diagnóstico (órdenes) */
.diagnostic-checklist-panel {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.diagnostic-checklist-mount {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diagnostic-checklist-item-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.diagnostic-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  margin: 0;
}

.diagnostic-checklist-note {
  margin: 0 0 0 28px;
  min-height: 52px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.4;
}

.diagnostic-checklist-note:disabled {
  opacity: 0.85;
  cursor: default;
}

.diagnostic-checklist-item input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Modal proyectos: técnicos y búsqueda de órdenes */
.project-tech-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fafbfc;
}

.project-tech-chk {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
}

.project-tech-chk input {
  margin-top: 3px;
  flex-shrink: 0;
}

.project-order-results {
  min-height: 2em;
  margin-top: 8px;
}

.project-order-hit {
  margin-bottom: 6px;
}

.project-order-hit .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  font-weight: 500;
}

.project-order-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.project-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 4px;
}

.project-linked-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-linked-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fafbfc;
  font-size: 14px;
}

.project-linked-task-row > div {
  min-width: 0;
}

/* Panel «Información de la orden» (vista empleado) */
.mEmp-info-panel {
  min-width: 0;
}

.mEmp-info-scroll {
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  scroll-behavior: smooth;
}

.mEmp-readonly-multiline {
  white-space: pre-wrap;
  min-height: 2.5rem;
}

.mEmp-veh-grid {
  display: grid;
  gap: 10px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mEmp-veh-grid .mEmp-veh-fuel-span {
  grid-column: 1 / -1;
}

.mEmp-info-meta {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

@media (max-width: 520px) {
  .mEmp-veh-grid {
    grid-template-columns: 1fr;
  }

  .mEmp-veh-grid .mEmp-veh-fuel-span {
    grid-column: auto;
  }
}

/* ============================================================
   Proyectos: selector de técnicos (tarjetas + chips) y filtros
   ============================================================ */
.project-tech-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.project-tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.project-tech-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--primary, #0a8278);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
}

.project-tech-chip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 700;
}

.project-tech-chip__remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.project-tech-search {
  width: 100%;
}

.project-tech-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fafbfc;
}

.project-tech-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.project-tech-card:hover {
  border-color: var(--primary, #0a8278);
}

.project-tech-card.is-checked {
  border-color: var(--primary, #0a8278);
  box-shadow: 0 0 0 1px var(--primary, #0a8278) inset;
}

.project-tech-card--readonly {
  cursor: default;
  pointer-events: none;
}

.project-tech-card input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #0a8278);
}

.project-tech-card__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #0a8278);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.project-tech-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-tech-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1d2939);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-tech-card__sub {
  font-size: 11px;
  color: var(--muted, #667085);
}

.project-tech-cards--empty {
  grid-template-columns: 1fr;
}

.project-tech-cards .muted {
  padding: 6px 4px;
}

.project-tech-cards__hint {
  grid-column: 1 / -1;
  margin: 4px 2px 0;
  font-style: italic;
}

/* Filtros compactos de órdenes en modal proyecto */
.project-order-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px 10px;
}

@media (max-width: 640px) {
  .project-order-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Sección de fotos del proyecto (creación + detalle) */
.project-create-photos,
.project-detail-photos {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-photo-grp {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fafbfc;
}

.project-detail-photos .project-photo-grp {
  background: #fff;
}

.project-photo-grp .section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #667085);
  margin: 0 0 4px;
}

/* Subpestañas Proyectos en vistas existentes */
.subtabs--projects {
  margin: 12px 0;
}

.project-grouped-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 0;
}

.project-group-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-group-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.project-group-card__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text, #1d2939);
}

.project-group-card__meta {
  font-size: 12px;
  color: var(--muted, #667085);
}

.project-group-card__tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 6px;
  border-left: 2px solid var(--line);
}

.project-group-card__task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #1d2939);
}

.project-group-card__task:hover {
  background: #f1f5f4;
}

.project-group-card__task-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary, #0a8278);
}

/* Lista de avances con autor y fecha (modal detalle) */
.project-updates-list .task-note-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  margin-bottom: 8px;
}

.project-updates-list .task-note-item .update-meta {
  font-size: 12px;
  color: var(--muted, #667085);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
