@import url("https://fonts.bunny.net/css?family=ibm-plex-sans:400,500,600,700");

:root {
  /* Carbón para el texto y los botones. Ámbar apagado solo para lo activo. */
  --p900: #1f1c19;
  --p800: #2a2724;
  --p700: #3a342e;
  --p600: #2a2724;
  --p500: #3d3834;
  --p400: #c4a06a;
  --p300: #e0d5c6;
  --p200: #ddd2c2;
  --p100: #f3ece3;
  --p50: #f7f3ec;
  --degradado: #a67c45;
  --ambar: #c4a06a;
  --on-accent: #f7f4ef;
  --ink: #2a2724;
  --muted: #6e675f;
  --faint: #8a8278;
  --line: #e3ddd4;
  --line-soft: #efeae3;
  --bg: #f3f1ed;
  --surface: #faf9f7;
  --sidebar: #2a2724;
  --sidebar-text: #f4efe8;
  --sidebar-muted: #c4bbb1;
  --ok: #1b6b38;
  --ok-bg: #e8f3eb;
  --warn: #8f5d08;
  --warn-text: #7a4e06;
  --warn-bg: #fbf3e4;
  --warn-line: #e4c98a;
  --err: #b42318;
  --err-text: #9a1f16;
  --err-bg: #fbeceb;
  --err-line: #f0c7c2;
  --info: #5c5348;
  --info-bg: #f3ece3;
  --sync: #a67c45;
  --sombra: 0 1px 2px rgba(42, 39, 36, 0.06);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #eadcc8;
  color: var(--ink);
}

button,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--p800);
}

a:hover {
  color: var(--p900);
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
  transition: grid-template-columns 0.2s ease;
}

.shell.menu-compacto {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--sidebar);
  border-right: 1px solid #3a342e;
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 24px;
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  margin: 0 2px 0 4px;
  padding-right: 14px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-width: 0;
}

.brand-icon {
  display: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.shell.menu-compacto .brand-logo {
  display: none;
}

.shell.menu-compacto .brand-icon {
  display: block;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.nav button,
.nav a.nav-enlace {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: none;
  cursor: pointer;
  background: transparent;
  padding: 9px 12px;
  border-radius: 3px;
  color: var(--sidebar-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
}

.nav button:hover,
.nav a.nav-enlace:hover {
  background: #38342f;
  color: var(--sidebar-text);
}

.nav button.activo,
.nav a.nav-enlace.activo {
  background: #35302b;
  color: var(--sidebar-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ambar);
}

.nav-marca {
  display: none;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: #3a342e;
  color: var(--sidebar-text);
}

.nav button.activo .nav-marca,
.nav a.nav-enlace.activo .nav-marca {
  background: var(--ambar);
  color: var(--sidebar);
}

.nav-etiqueta {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell.menu-compacto .nav button,
.shell.menu-compacto .nav a.nav-enlace {
  justify-content: center;
  padding: 10px 8px;
}

.shell.menu-compacto .nav-marca {
  display: inline-flex;
}

.shell.menu-compacto .nav-etiqueta {
  display: none;
}

.nav .cuenta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ambar);
  flex: none;
}

.menu-toggle {
  position: absolute;
  top: 28px;
  right: -11px;
  z-index: 5;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--sombra);
}

.menu-toggle:hover {
  background: var(--p50);
  color: var(--p700);
  border-color: var(--p300);
}

.main {
  min-width: 0;
  padding: 28px 36px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.h1 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.h1-lista {
  font-size: 28px;
}

.h1-obra {
  font-size: 26px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
}

.crumbs {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 6px;
}

.crumbs a {
  text-decoration: none;
}

.fila-titulo {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 180ms ease, border-color 180ms ease, transform 120ms ease;
}

a.btn {
  display: inline-block;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-md {
  padding: 9px 20px;
  font-size: 15px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-primary {
  background: var(--p600);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--p500);
  color: var(--on-accent);
}

.btn-primary:active:not(:disabled) {
  background: var(--p900);
  color: var(--on-accent);
}

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

.btn:focus-visible,
.nav button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: 2px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--p50);
}

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

.obra-acciones {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-texto {
  border: none;
  background: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-error {
  background: var(--err-bg);
  color: var(--err-text);
}

.badge-warning {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-success {
  background: var(--ok-bg);
  color: var(--ok);
}

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

.badge-brand {
  background: var(--p100);
  color: var(--p700);
}

.badge-neutral {
  background: var(--line-soft);
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sombra);
}

.scroll {
  overflow-x: auto;
}

.tabla-obras {
  min-width: 860px;
}

.cabecera,
.fila-obra,
.fila-factura {
  display: grid;
  gap: 16px;
  align-items: center;
}

.cabecera {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--faint);
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.cols-obras {
  grid-template-columns: 36px minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1.4fr) 180px;
}

.meta-responsable {
  display: block;
}

.sub-obra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.responsables {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: min-content;
  inline-size: auto;
}

.responsables-rotulo {
  color: var(--muted);
  font-size: 14px;
}

.responsables-fichas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.responsables-fichas li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-inline-size: 220px;
  padding: 2px 2px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.responsables-fichas li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.responsables-fichas button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 22px;
  block-size: 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.responsables-fichas button:hover:not(:disabled) {
  background: var(--line-soft);
  color: var(--ink);
}

.responsables-fichas button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.anadir-responsable {
  anchor-name: --anadir-responsable;
}

.panel-responsables {
  position-anchor: --anadir-responsable;
  inset: auto;
  margin: 0;
  top: anchor(bottom);
  left: anchor(left);
  margin-block-start: 6px;
  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  inline-size: min(280px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 32px rgb(42 39 36 / 12%);
}

.panel-responsables:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-responsables search {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-responsables label[for="buscar-responsable"] {
  color: var(--muted);
  font-size: 1rem;
}

.panel-responsables input[type="search"] {
  font: inherit;
  font-size: max(1rem, 1em);
  min-block-size: 48px;
  padding: 0 12px;
  border: 1px solid #767676;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.responsables-opciones {
  display: flex;
  flex-direction: column;
  max-block-size: 240px;
  overflow: auto;
}

.opcion-usuario {
  display: flex;
  align-items: center;
  gap: 8px;
  min-block-size: 48px;
}

.opcion-usuario input {
  accent-color: var(--p600);
  flex: none;
}

.opcion-usuario label {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.opcion-correo {
  color: var(--muted);
  font-size: 0.8rem;
}

.opcion-vacia {
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.panel-responsables input:focus-visible,
.responsables-fichas button:focus-visible,
.anadir-responsable:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: 2px;
}

@supports not selector(:popover-open) {
  [popover]:not(.\:popover-open) {
    display: none;
  }
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.cols-facturas {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.4fr) 120px 140px 72px;
  gap: 14px;
}

.fila-obra,
.fila-factura {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.fila-obra:hover,
.fila-factura:hover,
.fila-obra.marcada,
.fila-usuario.marcada {
  background: var(--p100);
}

.marca-fila {
  display: grid;
  place-items: center;
}

.marca-fila input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--p700);
}

.enlace-fila {
  display: inline;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: start;
}

.enlace-fila:hover {
  text-decoration: underline;
}

.btn-menu {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.btn-menu svg {
  display: block;
  fill: currentColor;
}

.btn-menu:hover,
.btn-menu[aria-expanded="true"],
.btn-menu:has(+ .menu-popover:is(:popover-open, .\:popover-open)) {
  background: var(--p50);
  border-color: var(--p300);
}

.btn-menu:focus-visible,
.enlace-fila:focus-visible,
.menu-popover [focusgroup~="menu"] > button:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: 2px;
}

.menu-fila {
  display: inline-flex;
}

.menu-popover {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 4px;
  box-shadow: 0 12px 32px rgba(31, 28, 25, 0.16);
  min-width: 148px;
}

.menu-popover [focusgroup~="menu"] {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-popover [focusgroup~="menu"] > button {
  font: inherit;
  font-weight: 600;
  text-align: start;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}

.menu-popover [focusgroup~="menu"] > button:hover,
.menu-popover [focusgroup~="menu"] > button:focus-visible {
  background: var(--p50);
}

.menu-popover [focusgroup~="menu"] > button.menu-peligro {
  color: var(--err-text);
}

.menu-popover [focusgroup~="menu"] > button.menu-peligro:hover,
.menu-popover [focusgroup~="menu"] > button.menu-peligro:focus-visible {
  background: var(--err-bg);
}

@supports (position-area: block-end) {
  .menu-popover {
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
    inset: auto;
    margin: 0;
  }
}

@supports not (position-area: block-end) {
  .menu-popover {
    position: fixed;
    inset: auto;
    margin: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .menu-popover {
    opacity: 0;
    translate: 0 -0.25rem;
    transition: opacity, translate, display, overlay;
    transition-duration: 0.15s;
    transition-behavior: allow-discrete;
  }

  .menu-popover:is(:popover-open, .\:popover-open) {
    opacity: 1;
    translate: 0 0;
    transition-duration: 0.1s;

    @starting-style {
      opacity: 0;
      translate: 0 -0.25rem;
    }
  }
}

.paginas {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.fila-factura.sel {
  background: var(--p50);
  box-shadow: inset 3px 0 0 var(--degradado);
}

.obra-nombre {
  min-width: 0;
}

.obra-nombre strong {
  font-weight: 600;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.num {
  font-variant-numeric: tabular-nums;
}

.barra-mini {
  height: 4px;
  background: var(--p100);
  border-radius: 2px;
}

.barra-mini span {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--degradado);
}

.pasos {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
}

.paso {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 10px 12px 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--sombra);
}

.paso.activo {
  border-color: var(--p400);
  background: var(--p50);
}

.paso-texto {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
  min-width: 0;
}

.paso-texto>span {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.paso small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.punto {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--p100);
  color: var(--muted);
}

.paso.activo .punto {
  background: var(--p600);
  color: var(--on-accent);
}

.paso.hecho .punto {
  background: var(--ok-bg);
  color: var(--ok);
}

.dropzone {
  border: 2px dashed var(--p300);
  background: var(--surface);
  border-radius: 12px;
  padding: 56px 24px;
  transition: background 180ms ease, border-color 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: center;
}

.dropzone:hover,
.dropzone.sobre {
  background: var(--p50);
  border-color: var(--p400);
}

.oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--p100);
  color: var(--degradado);
  display: grid;
  place-items: center;
  font-size: 26px;
}

.leyendo {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
}

.preview-scan {
  position: relative;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fake-line {
  height: 7px;
  border-radius: 3px;
  background: var(--line);
}

.scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--degradado);
  box-shadow: 0 0 10px 3px rgba(166, 124, 69, 0.35);
  animation: exscan 1.2s ease-in-out infinite alternate;
}

@keyframes exscan {
  from {
    top: 0;
  }

  to {
    top: calc(100% - 2px);
  }
}

.revision {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.panel-doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 240px;
  max-width: 320px;
}

.panel-doc-cab {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-doc-cab strong {
  font-size: 16px;
  color: var(--p700);
}

.cifras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cifras strong {
  font-size: 22px;
  color: var(--p700);
}

.aviso-ambar {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.aviso-rojo {
  background: var(--err-bg);
  color: var(--err-text);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lista-aps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 999 1 460px;
  min-width: 0;
}

.ap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.ap.abierto:not(.revisado) {
  border-color: var(--p300);
}

.ap-cab {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
}

.ap-acciones {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.btn-linea {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-linea:hover {
  background: var(--bg);
  color: var(--ink);
}

.btn-linea-peligro {
  color: var(--err-text);
  border-color: #f0d2cc;
}

.btn-linea-peligro:hover {
  background: var(--err-bg);
  color: var(--err-text);
}

.ap-acciones .pill-ok,
.ap-acciones .btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
}

.linea-form {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 140px auto;
  gap: 8px;
  align-items: end;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.linea-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.linea-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  background: var(--surface);
}

.linea-botones {
  display: flex;
  gap: 8px;
}

.linea-mini {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.dto-acciones {
  display: flex;
  align-items: center;
  gap: 10px;
}

.codigo {
  font-size: 13px;
  font-weight: 700;
  color: var(--p800);
  cursor: pointer;
}

.card-descuentos {
  margin-top: 12px;
}

.card-descuentos .fila-titulo {
  padding: 14px 18px 10px;
}

.dto-fila {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 800px) {
  .linea-form {
    grid-template-columns: 1fr;
  }
}

.dto-fila .codigo {
  cursor: default;
  white-space: nowrap;
}

.dto-fila .num {
  white-space: nowrap;
}

.dto-fila .ap-nombre strong {
  display: block;
}

.ap-nombre {
  cursor: pointer;
  min-width: 0;
}

.ap-nombre strong {
  font-size: 15px;
}

.docs-obra {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.docs-obra-fila {
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-width: 0;
}

.docs-obra-fila .btn-texto:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  min-width: 0;
}

.acciones-fichero {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
}

.partidas {
  border-top: 1px solid var(--line-soft);
  padding: 6px 18px 12px;
  overflow-x: auto;
}

.partidas-inner {
  min-width: 520px;
}

.subap {
  margin-top: 6px;
}

.subap-cab {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg);
  text-align: left;
  cursor: pointer;
}

.subap-cab .codigo {
  cursor: pointer;
}

.subap-nombre {
  min-width: 0;
}

.subap-nombre strong {
  display: block;
  font-size: 14px;
}

.subap .partidas-inner {
  padding: 4px 10px 8px;
}

.subap-cuerpo {
  margin: 4px 0 8px 18px;
}

.subap-dentro .subap-cab {
  background: var(--surface);
}

.subap-dentro .subap-nombre strong {
  font-style: italic;
  font-weight: 600;
}

.grid-part,
.grid-ctrl-p {
  display: grid;
  gap: 12px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.grid-part {
  grid-template-columns: 48px minmax(140px, 1fr) 36px 72px 96px 110px;
}

.grid-ctrl-p {
  grid-template-columns: 54px minmax(0, 1fr) 130px 130px 90px;
}

.resumen-contraste {
  padding: 16px 18px;
}

.grid-resumen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 130px 130px;
  gap: 12px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.grid-resumen > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.resumen-total {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
}

.sin-bloque {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.th {
  padding: 8px 0;
  font-size: 12px;
  color: var(--faint);
  font-weight: 600;
}

.td {
  padding: 8px 0;
  font-size: 13px;
  border-top: 1px solid var(--bg);
}

.der {
  text-align: right;
}

.pill-ok {
  border: none;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.subida {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px dashed var(--p300);
  border-radius: 12px;
  padding: 14px 18px;
}

.subida.sobre {
  background: var(--p50);
}

.subida .sub {
  display: block;
  margin-top: 4px;
  max-width: 62ch;
}

.cruce {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows: minmax(420px, 1fr);
  gap: 12px;
  align-items: stretch;
  height: calc(100dvh - 230px);
  min-height: 560px;
}

.cruce-lista,
.cruce-destino {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  height: auto;
  min-height: 0;
  max-height: 100%;
}

.cruce-lista {
  overflow: auto;
}

.cruce-destino {
  display: flex;
  flex-direction: column;
}

.cruce-cab {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.cruce-cab,
.cruce-pie {
  padding: 10px 16px;
}

.cruce-cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.cruce-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.cruce-form-acciones {
  display: flex;
  gap: 8px;
}

.cruce-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line-soft);
}

.cruce-item .cruce-linea {
  flex: 1;
  border-bottom: 0;
}

.cruce-item.activa .cruce-linea,
.cruce-item.activa .cruce-item-acciones {
  background: var(--p100);
}

.cruce-item-acciones {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px 8px 0;
  background: var(--surface);
}

.cruce-linea {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.cruce-linea:hover {
  background: var(--bg);
}

.cruce-linea.activa {
  background: var(--p100);
}

.cruce-linea:focus-visible,
.cruce-flecha:focus-visible,
.cruce-rama:focus-visible,
.cruce-bloque:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: -2px;
}

.cruce-linea-texto {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cruce-linea-texto strong,
.cruce-sec-nombre strong,
.cruce-bloque .nombre > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cruce-linea .meta,
.cruce-dest-cab .meta,
.cruce-sec-nombre .meta,
.cruce-bloque .meta {
  color: var(--p700);
}

.cruce-punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a8a8a;
}

.cruce-punto.listo {
  background: var(--warn);
}

.cruce-punto.hecho {
  background: var(--ok);
}

.cruce-dest-cab {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 16px;
}

.cruce-dest-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.cruce-dest-cab .h2 {
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cruce-cifra {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.cruce-bloques {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cruce-arbol {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cruce-nodo {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding-left: calc(var(--nivel, 0) * 18px);
}

.cruce-flecha {
  flex: none;
  width: 22px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.cruce-flecha.hueco {
  visibility: hidden;
  pointer-events: none;
}

.cruce-flecha:hover:not(:disabled) {
  background: var(--bg);
}

.cruce-tri {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--p700);
  transform: rotate(0deg);
  transition: transform 150ms ease;
}

.cruce-tri.abierto {
  transform: rotate(90deg);
}

.cruce-rama {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
}

.cruce-rama:hover {
  background: var(--bg);
}

.cruce-rama .nombre {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cruce-rama .nombre strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cruce-bloque {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.cruce-bloque:hover:not(:disabled) {
  background: var(--bg);
}

.cruce-bloque.on {
  background: var(--p100);
}

.cruce-bloque .nombre {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cruce-bloque .cuantia {
  flex: none;
  font-weight: 600;
}

.cruce-bloque .marca {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  box-sizing: border-box;
}

.cruce-bloque .marca.on {
  background: var(--ink);
  box-shadow: inset 0 0 0 2.5px var(--surface);
}

.cruce-bloque:disabled,
.cruce-flecha:disabled {
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .cruce-tri,
  .shell,
  .btn,
  .nav button,
  .dropzone {
    transition: none;
  }

  .scan {
    animation: none;
    top: 0;
  }
}

.cruce-vacio {
  padding: 12px;
}

.cruce-pie {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
}

.cruce-pie .sub {
  margin: 0;
}

.h2 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.contrato {
  background: var(--surface);
  border: 1px solid var(--p300);
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1.5fr) 110px;
  gap: 18px;
  align-items: center;
}

.contrato.baja {
  border-color: var(--warn-line);
}

.contrato.hecho {
  border-color: var(--line);
}

.flecha {
  color: var(--p400);
  font-size: 20px;
  text-align: center;
}

input.campo,
select.campo {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  width: 100%;
}

input.campo:focus,
select.campo:focus,
select.apartado:focus,
.linea-form input:focus,
.elige-varios:focus-within {
  outline: 2px solid var(--ambar);
  outline-offset: 1px;
  border-color: var(--p600);
}

select.apartado {
  font-weight: 600;
  color: var(--p700);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  max-width: 100%;
}

.elige-varios {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface);
}

.cubre-ap {
  border: 0;
  margin: 0;
  padding: 0 0 8px;
  min-inline-size: 0;
}

.cubre-ap legend {
  padding: 0;
  font-weight: 700;
}

.cubre-desglose {
  margin: 2px 0 0 22px;
}

.cubre-desglose > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--p700);
}

.cubre-desglose > summary::-webkit-details-marker {
  display: none;
}

.cubre-desglose[open] > summary .cruce-tri {
  transform: rotate(90deg);
}

.cubre-fila.nivel-1 {
  padding-left: 18px;
}

.cubre-fila.nivel-2 {
  padding-left: 36px;
}

.cubre-ap .en-otro {
  font-weight: 500;
}

.elige-varios label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-weight: 600;
}

.elige-varios label span:first-of-type {
  flex: 1 1 auto;
  min-width: 0;
}

.elige-varios .cuantia {
  flex: none;
  font-weight: 600;
}

.elige-varios.bloqueado {
  opacity: 0.7;
}

.explica {
  width: 100%;
  min-height: 64px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--p800);
  font: inherit;
  resize: vertical;
}

.treeview {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 4px 0;
}

.treeview.bloqueado {
  opacity: 0.7;
}

.tv-fila {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding-left: calc(4px + var(--nivel, 0) * 18px);
}

.tv-fila.guia::before {
  content: "";
  position: absolute;
  left: calc(14px + (var(--nivel, 1) - 1) * 18px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.tv-flecha {
  flex: none;
  width: 22px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.tv-flecha.hueco {
  visibility: hidden;
  pointer-events: none;
}

.tv-tri {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--p700);
}

.tv-tri.abierto {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--p700);
  border-bottom: 0;
}

.tv-nodo,
.tv-carpeta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-weight: 600;
  color: var(--p800);
  border-radius: 4px;
  padding: 4px 8px 4px 2px;
  cursor: pointer;
}

.tv-carpeta {
  font-size: 12px;
}

.tv-nodo:hover:not(:disabled),
.tv-carpeta:hover:not(:disabled),
.tv-flecha:hover:not(:disabled) {
  background: var(--bg);
}

.tv-nodo.on {
  background: var(--p100);
}

.tv-nodo .nombre,
.tv-carpeta .nombre {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-nodo .cuantia {
  flex: none;
}

.tv-nodo .marca {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  box-sizing: border-box;
}

.tv-nodo .marca.on {
  background: var(--ink);
  box-shadow: inset 0 0 0 2.5px var(--surface);
}

.tv-punto {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.syncbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
}

.punto-sync {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sync);
  display: inline-block;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pill.activo {
  border-color: var(--p600);
  background: var(--p600);
  color: var(--on-accent);
}

.banda {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.crece {
  flex: 1 1 560px;
  min-width: 0;
}

.detalle {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  flex: 1 1 360px;
  min-width: 0;
}

.detalle-cab {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cerrar {
  border: none;
  background: none;
  font-size: 20px;
  color: var(--faint);
  cursor: pointer;
}

.linea-cmp {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.linea-cmp.mala {
  border-color: var(--err-line);
  background: var(--err-bg);
}

.nota-err {
  color: var(--err-text);
  font-weight: 600;
  font-size: 12px;
}

.detalle-pie {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 0 0 8px 8px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi strong {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi small {
  font-size: 12px;
  color: var(--faint);
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.muestra {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.muestra-pres {
  width: 2px;
  height: 12px;
  background: var(--ink);
  display: inline-block;
}

.fila-ctrl {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(160px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  font-size: 13px;
  cursor: pointer;
  border-top: 1px solid var(--line-soft);
}

.fila-ctrl.estatica {
  cursor: default;
}

.muestra-fact {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  background: var(--degradado);
  display: inline-block;
}

.track .marca-fact {
  width: 3px;
  background: var(--degradado);
}

.track .marca {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  background: var(--ink);
  transform: translateX(-50%);
}

.fila-ctrl .meta.num {
  line-height: 1.35;
}

.fila-ctrl .der {
  white-space: nowrap;
}

.track-bloque {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.track-cifras {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
}

.track-cifras span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.track {
  position: relative;
  height: 10px;
  margin: 6px 8px;
  background: var(--bg);
  border-radius: 3px;
  overflow: visible;
}

.track .marca {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  background: var(--ink);
  transform: translateX(-50%);
}

.track .contratado,
.track .facturado {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 3px;
}

.track .contratado {
  background: var(--p200);
}

.track .facturado {
  background: var(--degradado);
  z-index: 1;
}

.track .marca {
  z-index: 2;
}

.alerta {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.alerta:hover {
  border-color: var(--p300);
}

.rojo {
  color: var(--err-text);
}

.verde {
  color: var(--ok);
}

.ambar {
  color: var(--warn);
}

.apagado {
  color: var(--faint);
}

.estado-msg {
  color: var(--err-text);
}

@media (max-width: 900px) {

  .shell,
  .shell.menu-compacto {
    grid-template-columns: 1fr;
  }

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

  .shell.menu-compacto .brand-logo {
    display: block;
    max-width: 140px;
  }

  .shell.menu-compacto .brand-icon {
    display: none;
  }

  .shell.menu-compacto .nav-marca {
    display: none;
  }

  .shell.menu-compacto .nav-etiqueta {
    display: block;
  }

  .shell.menu-compacto .nav button {
    justify-content: flex-start;
  }

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

  .contrato,
  .cruce {
    grid-template-columns: 1fr;
  }

  .cruce {
    height: auto;
    min-height: 0;
    grid-template-rows: auto;
  }

  .cruce-lista,
  .cruce-destino {
    height: auto;
    max-height: 70dvh;
  }

  .resumen-contraste {
    max-height: none;
  }

  .main {
    padding: 20px 16px 48px;
  }
}

.login-pagina {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 5fr) minmax(340px, 6fr);
}

.login-lado {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: 100dvh;
  padding: 44px 48px 40px;
  background:
    radial-gradient(ellipse 90% 55% at 12% 0%, rgba(196, 160, 106, 0.28), transparent 58%),
    linear-gradient(165deg, #3a342e 0%, #2a2724 46%, #1f1c19 100%);
  color: var(--sidebar-text);
  box-shadow: inset 4px 0 0 var(--ambar);
  overflow: hidden;
}

.login-lado::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(244, 239, 232, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 239, 232, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  pointer-events: none;
}

.login-lado > * {
  position: relative;
  z-index: 1;
}

.login-lado-texto {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 28ch;
}

.login-lema {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.login-uso {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-formulario {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(196, 160, 106, 0.16), transparent 60%),
    var(--bg);
}

.login-caja {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(31, 28, 25, 0.08);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
}

.login-caja h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.login-ayuda {
  margin: 0 0 8px;
  color: var(--muted);
}

.login-caja .estado-msg {
  margin: 4px 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--err-line);
  border-radius: 8px;
  background: var(--err-bg);
  color: var(--err-text);
}

.login-caja .btn-primary {
  background: var(--ambar);
  color: var(--p900);
}

.login-caja .btn-primary:hover {
  background: #d4b483;
}

.login-caja form,
.ficha-usuario {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-caja label,
.ficha-usuario label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.login-caja form {
  gap: 6px;
}

.login-caja label {
  margin-top: 6px;
}

.login-caja input.campo {
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 10px 12px;
}

.login-clave-fila {
  position: relative;
}

.login-clave-fila .campo {
  padding-inline-end: 48px;
}

.login-ver {
  position: absolute;
  inset-inline-end: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.login-ver svg {
  display: block;
}

.login-ver:hover {
  color: var(--ink);
}

.login-ver:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: 2px;
}

.login-enviar {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
}

.login-sr {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.login-marca {
  display: block;
  width: min(248px, 100%);
  height: auto;
  margin: 0;
}

@media (max-width: 800px) {
  .login-pagina {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .login-lado {
    min-height: 0;
    gap: 12px;
    padding: 22px 20px 18px;
    box-shadow: inset 0 4px 0 var(--ambar);
  }

  .login-lema {
    font-size: 16px;
  }

  .login-uso {
    display: none;
  }

  .login-marca {
    width: 180px;
  }

  .login-formulario {
    place-items: start center;
    padding: 16px 16px 32px;
  }
}

.cols-usuarios {
  grid-template-columns: 36px minmax(140px, 1.4fr) minmax(220px, 2.2fr) minmax(120px, 1fr) 56px;
}

.cabecera.cols-usuarios > *,
.fila-usuario > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fila-usuario {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.tabla-usuarios {
  min-width: 860px;
}

.ficha-usuario {
  padding: 22px 22px 18px;
}

.sesion {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #3a342e;
}

.sesion-quien {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 4px;
}

.sesion-inicial {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #3a342e;
  color: var(--ambar);
  font-size: 13px;
  font-weight: 700;
}

.sesion-nombre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--sidebar-text);
}

.sesion-salir {
  font: inherit;
  font-weight: 600;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid #4a433c;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

.sesion-salir:hover {
  color: var(--sidebar-text);
  border-color: var(--ambar);
}

.shell.menu-compacto .sesion {
  align-items: center;
}

.shell.menu-compacto .sesion-nombre,
.shell.menu-compacto .sesion-salir-texto {
  display: none;
}

.shell.menu-compacto .sesion-salir {
  width: 36px;
  height: 36px;
  padding: 0;
}

.shell.menu-compacto .sesion-salir::before {
  content: "↪";
}

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(31, 28, 25, 0.28);
}

.modal::backdrop {
  background: rgba(31, 28, 25, 0.48);
}

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

.modal-cerrar {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-cerrar:hover {
  background: var(--p50);
  color: var(--ink);
}

.alc-linea {
  display: flex;
  align-items: center;
  gap: 6px;
}

.alc-linea .alc-fijo {
  color: #0033cc;
  font-weight: 700;
}

.alc-linea input {
  flex: 1;
  min-width: 0;
}

.mano-obra {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.mano-obra-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.mano-obra-cab .h2 {
  font-size: 15px;
  font-weight: 600;
}

.mano-obra-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.mano-obra-toggle:focus-visible {
  outline: 2px solid var(--ambar);
  outline-offset: 3px;
  border-radius: 4px;
}

.mano-obra-resumen {
  margin: 0;
  color: var(--muted);
}

.mano-obra-precio {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mano-obra-precio .campo {
  width: 8.5rem;
}

.parte-obra {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.isp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.isp-on {
  background: var(--warn-bg);
  border-color: var(--warn-line, var(--warn-border));
}

.isp-estado {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: min(100%, 22rem);
  flex: 1 1 22rem;
}

.isp-pill {
  flex: none;
  margin-top: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--line-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}

.isp-on .isp-pill {
  border-color: var(--warn-line, var(--warn-border));
  background: #fff;
  color: var(--warn-text, #7a4e06);
}

.isp-titulo {
  margin: 0;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--ink);
}

.isp-ayuda {
  margin: 2px 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 13px;
}

.isp-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media (max-width: 720px) {
  .isp-estado,
  .isp-acciones {
    flex-basis: 100%;
  }
}