/* =============================================================================
   Sistema visual de la app — guía de estilo
   -----------------------------------------------------------------------------
   Producto: herramienta contable/patrimonial (facturas → asientos), uso interno.
   Objetivo estético: CONFIANZA, ORDEN y CALMA; alto contraste, jerarquía clara y
   superficies con profundidad sutil. Solo PRESENTACIÓN: no cambia estructura ni
   lógica; todas las clases funcionales (grids, combobox, PDF) se preservan.
   Self-hosted, sin CDN (offline, subpath, HTTPS sin mixed-content).
   ============================================================================= */

:root {
  /* === Identidad de marca Matas Aremuns ===================================
     Del logo: casa en SLATE azulado (#5F7581) + tejado de sierra industrial en
     NARANJA bermellón (#E8481C). El slate estructura (fondos, titulares, tablas);
     el naranja es el ACENTO (acciones, activo, foco) — se usa con intención, no
     por todas partes. Tipografía: sans geométrica en caja alta tracked (wordmark). */

  /* --- Neutros slate (la casa gris-azulada) --- */
  --bg:             #edf1f4;   /* fondo de la app (slate muy claro → las tarjetas flotan) */
  --surface:        #ffffff;   /* tarjetas / paneles */
  --surface-2:      #f3f6f8;   /* superficie sutil (cabeceras de tabla, hovers) */
  --fg:             #2b3843;   /* texto cuerpo (slate oscuro) */
  --heading:        #33424e;   /* títulos (slate del logo) */
  --muted:          #62737e;   /* texto secundario (contraste AA sobre blanco) */
  --border:         #e0e6ea;   /* bordes / divisores */
  --border-strong:  #c5cfd6;   /* bordes en hover/elementos interactivos */

  /* --- Acento: naranja bermellón de la marca --- */
  --primary:        #e8481c;   /* acento (el naranja de la marca) */
  --primary-strong: #c93c12;   /* acento hover/activo (AA sobre blanco) */
  --primary-fg:     #ffffff;
  --primary-soft:   #fceae2;   /* tinte para selección / hover suave */
  --primary-ring:   rgba(232, 72, 28, 0.30);

  /* --- Slate azulado de la marca (estructura secundaria) --- */
  --slate:          #5f7581;   /* el gris-azulado del tejado */
  --slate-strong:   #4c626d;
  --slate-soft:     #e9eef1;   /* tinte slate (cabeceras, chips neutros) */

  --ok:      #157f52;  --ok-bg:     #eefbf3;  --ok-border:     #b5e8cd;
  --warn:    #b45309;  --warn-bg:   #fffbeb;  --warn-border:   #fde68a;
  --danger:  #d13b1c;  --danger-bg: #fdeee9;  --danger-border: #f6cdbf;
  --error: var(--danger);   /* compat: clases antiguas referencian --error */

  /* --- Tipografía (estilografía de marca) --- */
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Display geométrica para el wordmark y titulares de marca; cae limpio a la del sistema. */
  --font-display: "Avenir Next", "Century Gothic", "Futura", var(--font-sans);

  /* --- Radios --- */
  --radius-sm: 8px;
  --radius:    11px;
  --radius-lg: 16px;

  /* --- Elevación (profundidad) --- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.16);

  --ease: 0.16s cubic-bezier(0.4, 0, 0.2, 1);

  /* Gradiente sutil del botón primario (naranja con volumen). */
  --primary-grad: linear-gradient(180deg, #ee5628 0%, #e8481c 55%, #dc3f16 100%);

  /* compat con variables referenciadas por reglas antiguas */
  --card: var(--surface);
  --accent: var(--primary);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  color: var(--heading); font-family: var(--font-display);
  letter-spacing: -0.01em; line-height: 1.22;
}
a { color: var(--primary-strong); }
a:hover { color: var(--primary); }
/* Eyebrow / etiqueta de marca: caja alta tracked, como el wordmark del logo. */
.eyebrow, .page-title .kicker {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem;
  font-weight: 700; color: var(--primary);
}
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Foco accesible y consistente (no-inputs). */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Navbar --- */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* Filete naranja de marca bajo la cabecera (el acento del logo). */
  box-shadow: inset 0 -3px 0 0 var(--primary), var(--shadow-xs);
  /* #40: en pantalla estrecha la cabecera ENVUELVE en vez de desbordar horizontalmente. */
  flex-wrap: wrap; gap: 0.5rem;
}
/* #40: las tablas anchas (histórico, listados) hacen scroll DENTRO de su contenedor;
   el body de la página nunca arrastra en horizontal. */
.lista { overflow-x: auto; }
@media (max-width: 640px) {
  .navbar { padding: 0.6rem 1rem; }
  .navbar-right { gap: 0.6rem; flex-wrap: wrap; }
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; color: var(--heading);
  font-size: 1.02rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.brand-sub { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }
.user { color: var(--muted); font-size: 0.9rem; }
.rol {
  text-transform: uppercase; font-size: 0.66rem; letter-spacing: 0.07em; font-weight: 700;
  color: var(--primary-strong); background: var(--primary-soft);
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 600;
  padding: 0.42rem 0.75rem; border-radius: var(--radius-sm);
  transition: background var(--ease), color var(--ease);
}
.nav-link:hover { color: var(--primary-strong); background: var(--primary-soft); }
.nav-link.activo { color: var(--primary-strong); background: var(--primary-soft); }
/* Salir de Administración de vuelta a facturas: acento para que se vea (no es un nav-link más). */
.nav-volver { color: var(--primary-strong); border: 1px solid var(--primary-ring); }
.nav-volver:hover { color: var(--primary-fg); background: var(--primary); border-color: var(--primary); }
.inline { display: inline; margin: 0; }

/* --- Layout --- */
.container { max-width: 960px; margin: 0 auto; padding: 1.75rem 1.25rem; }
/* Revisión (Rosa/Begoña/Marta): contenedor ancho para aprovechar el lateral y que el
   PDF se vea grande. Solo esas pantallas (clase extra), no dashboard/admin. */
.container--wide { max-width: 1600px; }
.page-title {
  margin-top: 0.25rem; font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em;
  position: relative; padding-left: 0.85rem;
}
/* Filete naranja de marca a la izquierda del título (acento del tejado de sierra). */
.page-title::before {
  content: ""; position: absolute; left: 0; top: 0.15em; bottom: 0.15em; width: 4px;
  border-radius: 4px; background: var(--primary-grad);
}
.volver { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.volver:hover { color: var(--primary-strong); }
.muted { color: var(--muted); }

/* --- Botones (con profundidad) ---
   `.btn` base = botón secundario VISIBLE (superficie + borde + sombra); las
   variantes lo especializan. Hover hace "lift". */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.55rem 1.05rem;
  font-size: 0.95rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--fg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--ease), box-shadow var(--ease),
              background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn-ghost, .btn-secondary { /* explícitos = el base, por compatibilidad */
  background: var(--surface); border-color: var(--border-strong); color: var(--fg);
}
.btn-primary {
  background: var(--primary-grad); color: var(--primary-fg); border-color: transparent;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
  background: var(--primary-strong); color: var(--primary-fg); border-color: transparent;
  box-shadow: 0 6px 18px var(--primary-ring); transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn-danger {
  background: var(--surface); border-color: var(--danger-border); color: var(--danger);
}
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); transform: translateY(-1px); }
.btn-warning {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn);
}
.btn-warning:hover { background: #fef3c7; border-color: var(--warn); color: var(--warn); transform: translateY(-1px); }
.btn-sm { padding: 0.33rem 0.8rem; font-size: 0.85rem; }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

/* --- Campos de formulario --- */
.campo { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.campo label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.campo select, .campo input,
.login-card input, .combobox-input,
.propuesta-col textarea, .rechazo textarea, .subida input, textarea, input, select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem; font-family: inherit;
  background: var(--surface); color: var(--fg);
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: #9aa7b8; }
input:hover, select:hover, textarea:hover, .combobox-input:hover { border-color: #b6c2d2; }
input:focus, select:focus, textarea:focus, .combobox-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.campo small.muted { font-size: 0.78rem; }

/* --- Login --- */
.login-card {
  max-width: 380px; margin: 9vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--primary);   /* filete de marca */
}
.login-logo { display: block; height: 76px; width: auto; margin: 0 auto 1.1rem; }
.login-card h1 { font-size: 1.35rem; margin: 0 0 0.25rem; text-align: center; }
.login-card .subtitle { text-align: center; }
.login-card .subtitle { color: var(--muted); margin: 0 0 1.25rem; }
.login-card label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.75rem 0 0.3rem; color: var(--muted); }
.login-card input { width: 100%; }
.login-card .btn-primary { width: 100%; margin-top: 1.35rem; }

/* --- Alertas / avisos --- */
.error, .aviso, .badge { border-radius: var(--radius); }
.error {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 0.6rem 0.8rem; font-size: 0.9rem;
}
.aviso {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn-border);
  padding: 0.6rem 0.8rem; font-size: 0.9rem;
}
.banner { margin: 0.5rem 0 1rem; box-shadow: var(--shadow-xs); }

/* --- Dashboard: contadores y tarjetas --- */
.counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}
/* Filete de marca a la izquierda de cada tarjeta (slate en reposo → naranja al pasar). */
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--slate); opacity: 0.55; transition: background var(--ease), opacity var(--ease);
}
.card .num { font-size: 2.15rem; font-weight: 800; color: var(--heading); line-height: 1.1;
  font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.card .lbl { color: var(--muted); font-size: 0.88rem; font-weight: 500; }
.card-link { text-decoration: none; color: inherit; transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease); }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-link:hover::before { background: var(--primary-grad); opacity: 1; }
.card-link:hover .num { color: var(--primary-strong); }
.placeholders { margin-top: 1.5rem; }

/* --- Filtros del histórico: rejilla ordenada de 2 columnas --- */
.filtros {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.5rem;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.filtros label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
}
.filtros select, .filtros input { width: 100%; box-sizing: border-box; }
.filtros-acciones {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.15rem;
}
/* "Descargar PDFs (ZIP)" en la esquina derecha del bloque de acciones de filtros. */
.filtros-acciones .zip-pdfs { margin-left: auto; }
@media (max-width: 640px) { .filtros { grid-template-columns: 1fr; } }
/* Toggle "solo pendientes de exportar": fila propia, checkbox en línea con su texto. */
.filtros label.filtro-check {
  grid-column: 1 / -1;
  flex-direction: row; align-items: center; gap: 0.5rem;
  color: var(--fg); font-weight: 600; cursor: pointer;
}
.filtros label.filtro-check input { width: auto; }

/* --- Tablas (lista de facturas) --- */
.lista { margin-top: 1.5rem; }
table.facturas {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.facturas th, table.facturas td {
  padding: 0.85rem 0.95rem; border-bottom: 1px solid var(--border-strong); text-align: left;
  vertical-align: middle;
}
table.facturas thead th {
  background: var(--surface-2);
  color: var(--muted); font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
table.facturas tbody tr { transition: background var(--ease); }
table.facturas tbody tr:hover { background: var(--surface-2); }
table.facturas tr:last-child td { border-bottom: none; }
/* nowrap: el importe y el «€» NUNCA se parten en dos líneas (con el layout automático de
   la tabla, la columna se lleva el ancho que la cifra necesita y el resto lo absorbe la
   columna del proveedor, que sí puede envolver). */
table.facturas .num {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.facturas .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88rem; }
table.facturas .motivo { color: var(--muted); font-size: 0.85rem; max-width: 22rem; }
/* `.acciones-fila` se aplica a un <td>. OJO: NADA de `display:flex` aquí — un <td> en flex
   deja de ser celda (el navegador le fabrica una celda anónima alrededor): la fila pierde su
   separador bajo esta columna y los botones se salen del recuadro de la tabla. Se queda como
   celda normal (vertical-align:middle centra los botones, que ya son inline-flex) y la
   separación entre botones va por margen en vez de por `gap`. */
.acciones-fila { white-space: nowrap; }
.acciones-fila > * + * { margin-left: 0.4rem; }
/* Acciones APILADAS en columna (bandeja de Begoña): botones del MISMO ancho, sin partir
   el texto, con aire entre ellos → no se ven agolpados. El `<td>` sigue siendo celda
   (el flex va en el div interior, no en el td). */
.acciones-td { white-space: nowrap; }
.acciones-col { display: flex; flex-direction: column; gap: 0.45rem; min-width: 10.5rem; }
.acciones-col > form { display: block; margin: 0; }
.acciones-col .btn { display: flex; width: 100%; white-space: nowrap; padding-block: 0.46rem; }
/* Selección de facturas para el .txt (checkboxes del histórico). */
table.facturas th.check, table.facturas td.check { width: 2.2rem; text-align: center; }
.seleccion-acciones { display: flex; align-items: center; gap: 0.75rem; margin: 0.9rem 0; }

/* --- Cadena Begoña: subida --- */
.subida {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.95rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.subida label { font-weight: 600; font-size: 0.9rem; }

/* --- Revisión (modelo B): grid PDF + propuesta --- */
.revision-grid {
  display: grid;
  /* PDF (izda) un 20% más ancho que el formulario: 60% / 40%. */
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) { .revision-grid { grid-template-columns: 1fr; } }
.pdf-visor {
  width: 100%;
  /* proporción de folio A4 (+ barra del visor): la página entera sin recorte
     vertical; crece con el ancho de la columna. 85vh queda como suelo. */
  height: auto;
  aspect-ratio: 2 / 3;
  min-height: 85vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.propuesta-col { display: flex; flex-direction: column; gap: 1rem; }
.datos-factura, .auditoria, .alta-activo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.datos-factura h2, .auditoria h2 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Anotación de Begoña (solo lectura en la revisión). */
.anotacion-begona {
  margin-top: 0.75rem; padding: 0.65rem 0.85rem;
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius);
}
.anotacion-begona .etq {
  display: block; font-size: 0.74rem; font-weight: 700; color: var(--warn);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.anotacion-begona p { margin: 0.25rem 0 0; white-space: pre-wrap; }

/* Devolver a Begoña (Marta): separado de la firma. */
.rechazo { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rechazo textarea, .propuesta-col textarea { width: 100%; resize: vertical; }

/* --- Combobox con búsqueda (combobox.js) --- */
/* F.3.4 — chips de inmuebles múltiples (pantalla de Begoña) */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .6rem; border-radius: 999px;
  background: var(--fondo-suave, #eef2f7); border: 1px solid var(--borde, #cbd5e1);
  font-size: .9em;
}
.chip .chip-quitar {
  border: 0; background: none; cursor: pointer; font-size: .9em; line-height: 1;
  padding: 0 .1rem;
}

/* F.3.2 — panel de resolución tipo × inmueble (revisión) */
.panel-resolucion {
  border: 1px dashed var(--borde, #cbd5e1);
  border-radius: 8px;
  padding: .5rem .8rem;
  margin-bottom: .6rem;
  font-size: .92em;
}
.panel-resolucion p { margin: .2rem 0; }

.combobox { position: relative; }
.combobox-native { display: none !important; }       /* el select sigue en el DOM (form/HTMX) */
.combobox-input { width: 100%; box-sizing: border-box; }
.combobox-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  margin: 0; padding: 0.3rem; list-style: none;
  max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.combobox-option {
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combobox-option:hover, .combobox-option.is-active { background: var(--primary-soft); color: var(--primary-strong); }

/* --- Tabla del asiento --- */
table.asiento { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.5rem 0; }
table.asiento th, table.asiento td { padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--border); }
table.asiento th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.asiento .num { text-align: right; font-variant-numeric: tabular-nums; }
table.asiento .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
table.asiento .totales { font-weight: 700; border-top: 2px solid var(--border-strong); }
table.asiento .totales td { border-bottom: none; }
table.asiento .concepto { color: var(--muted); font-size: 0.82rem; }

/* --- Badges / estados --- */
.badge { display: inline-block; padding: 0.32rem 0.7rem; border-radius: 999px; font-size: 0.82rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.badge-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
/* Histórico de Begoña: en curso (ámbar) · con Rosa/Jessica (slate) · contabilizada (verde). */
.badge-curso { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.badge-revision { background: var(--slate-soft); color: var(--slate-strong); border: 1px solid var(--slate); }
.badge-hecho { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.aviso-ok { color: var(--ok); font-size: 0.85rem; font-weight: 600; margin: 0 0 0.3rem; }

/* Revisión: guía de edición + cuenta de gasto editable destacada (visibilidad Rosa/Jessica) */
.nota-edicion {
  background: var(--primary-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.8rem; margin: 0 0 1rem;
  font-size: 0.9rem; box-shadow: var(--shadow-xs);
}
.cuenta-override {
  border-left: 3px solid var(--primary); padding-left: 0.8rem; margin-top: 0.6rem;
}

.acciones { display: flex; gap: 0.6rem; margin: 0.75rem 0; flex-wrap: wrap; }

/* --- Auditoría --- */
.audit-list { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.audit-list li { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.audit-list li:last-child { border-bottom: none; }
.audit-accion { font-weight: 700; }
.audit-campo { color: var(--muted); }
.audit-list time { margin-left: auto; color: var(--muted); font-size: 0.78rem; }
.iva-detalle { margin-top: 0.5rem; font-size: 0.85rem; }

/* --- Panel de administración (G.10) --- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; margin: 1.25rem 0; }
.admin-card {
  display: block; padding: 1.2rem 1.25rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: inherit; background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.admin-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.admin-card h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.admin-card .muted { font-size: 0.9rem; }
.admin-card.disabled { opacity: 0.5; pointer-events: none; box-shadow: none; }
.admin-form { max-width: 640px; }
.admin-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 0.9rem 0; background: var(--surface); box-shadow: var(--shadow-xs); }
.admin-form legend { font-size: 0.82rem; font-weight: 700; color: var(--muted); padding: 0 0.45rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Tooltips de ayuda: «?» junto a cada parámetro de administración ────────── */
.tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: 0.35rem; }
.tip__q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 1; cursor: help; user-select: none;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.tip:hover .tip__q, .tip:focus-visible .tip__q, .tip:focus-within .tip__q {
  border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
}
.tip__bubble {
  position: absolute; left: 0; top: calc(100% + 9px); z-index: 60;
  width: max-content; max-width: min(320px, 78vw);
  padding: 0.58rem 0.72rem; border-radius: var(--radius-sm);
  background: var(--heading); color: #f1f5f9;
  font-size: 12.5px; font-weight: 400; line-height: 1.45;
  text-align: left; text-transform: none; letter-spacing: normal; white-space: normal;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none;
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
}
.tip:hover .tip__bubble, .tip:focus-within .tip__bubble { opacity: 1; visibility: visible; transform: translateY(0); }
.tip__bubble::before {
  content: ''; position: absolute; bottom: 100%; left: 7px;
  border: 6px solid transparent; border-bottom-color: var(--heading);
}

/* --- Pestañas del hub «Activos» (Inmuebles | Edificios) --- */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.25rem 0 1.1rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.5rem 1rem;
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.tab:hover { color: var(--heading); background: var(--surface-2); }
.tab-activa,
.tab-activa:hover {
  color: var(--primary-strong);
  background: var(--surface);
  border-color: var(--border) var(--border) var(--surface);
}
