/* === RESET & BASE === */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  color: #333;
  background: #f9f9f9;
}

/* === LAYOUT PRINCIPAL === */
body { display: flex; flex-direction: column; }

.container {
  display: flex;
  flex-direction: row; /* ✅ Escritorio: sidebar al lado */
  flex: 1;
  min-height: 100vh;
}

main, .main-content {
  flex: 1;
  padding: 1rem;
  background-color: white;
  margin-bottom: 3rem; /* espacio para footer */
}

/* === SIDEBAR === */
.sidebar {
  width: 240px;
  background-color: #f0f4f8;
  padding: 1rem;
}

.sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #005a87;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: #333;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.sidebar nav a:hover {
  background-color: #d0e6f7;
  color: #003e64;
  font-weight: 600;
}

.sidebar nav a.active {
  background-color: #d9e9f4;
  color: #005a87;
}

.sidebar nav a i { margin-right: 10px; }

/* Todas las tablas: permitir salto de línea */
table.dataTable,
table.display {
  width: 100% !important; /* Que usen todo el ancho disponible */
}

/* Permitir saltos de línea en todas las columnas */
table.dataTable td,
table.dataTable th {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ❌ Evitar salto de línea en columnas específicas */
table.dataTable td.no-wrap,
table.dataTable th.no-wrap {
  white-space: nowrap !important;
}

/* === HEADER MÓVIL === */
.mobile-header { display: none; }
.menu-toggle { font-size: 1.5rem; cursor: pointer; }

/* ===== Utilidades de texto ===== */
.u-wrap { overflow-wrap: break-word; word-break: break-word; white-space: normal; }

.clamp-2, .clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.is-open { -webkit-line-clamp: unset !important; overflow: visible !important; }

/* Botón tipo link */
.btn-link {
  background: none; border: none; padding: 0;
  color: #0d6efd; font-weight: 600; cursor: pointer; margin-left: 6px;
}

#usuario-logueado, #usuario-logueado-movil {
  font-size: 0.95rem; color: #005a87; font-weight: bold;
}
#usuario-logueado { margin-left: 1rem; }
#usuario-logueado-movil { margin-left: auto; }

/* === CONTENIDO === */
h1, h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.content-wrapper {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: flex-start; align-items: flex-start;
  margin: 20px auto; max-width: 1200px; padding: 0 10px;
}

/* === FORMULARIOS Y TABLAS === */
#form-cliente, .tabla-container {
  max-width: 1000px; margin: 2rem auto; background: white;
  padding: 1rem; border-radius: 8px; box-shadow: 0 0 8px rgba(0,0,0,.1);
}

.scroll-wrapper { overflow-x: auto; width: 100%; }

form { display: flex; flex-direction: column; width: 100%; }

label { margin-bottom: 5px; font-weight: 600; }

input, textarea {
  width: 100%; padding: .5rem; margin-bottom: 1rem;
  border: 1px solid #ccc; border-radius: 6px; font-size: 1rem;
}

/* === SISTEMA DE BOTONES (GLOBAL: PC + MÓVIL) === */
button, .btn, .btn-card {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.2rem; border: 0; border-radius: .75rem;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  color: #fff;
}



button:hover, .btn:hover, .btn-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

.btn:focus { outline: 2px solid rgba(13,110,253,.35); outline-offset: 2px; }
.btn:active { transform: scale(.99); }

/* Variantes de color (consistentes en PC y móvil) */
.btn-primario  { background-color: #0d6efd; }          /* Guardar */
.btn-primario:hover { background-color: #0b5ed7; transform: scale(1.02); }

.btn-secundario{ background-color: #6c757d; }          /* Cancelar / Editar */
.btn-secundario:hover { background-color: #5c636a; transform: scale(1.02); }

.btn-eliminar  { background-color: #dc3545; }          /* Eliminar */
.btn-eliminar:hover { background-color: #bb2d3b; transform: scale(1.02); }

.btn-agregar   { background-color: #198754; }          /* Agregar */
.btn-agregar:hover { background-color: #157347; transform: scale(1.02); }

.btn-imprimir {background-color: #17a2b8;  color: #fff; }
.btn-imprimir:hover {
    background-color: #138496; transform: scale(1.02); }

/* (Opcional) Outline para acciones secundarias en tabla */
.btn-outline {
  background: transparent; color: #0d6efd; border: 2px solid #0d6efd;
}
.btn-outline:hover { background: #0d6efd; color: #fff; }
/* Solo botones sin variante conocida (no toca primario, secundario, etc.) */
/* Solo .btn sin variante conocida (¡sin espacios entre :not!) */
.btn:not(.btn-primario):not(.btn-secundario):not(.btn-eliminar):not(.btn-agregar):not(.btn-imprimir):not(.btn-outline):not(.btn-link) {
  background-color: #4b5563; /* gris neutro */
  color: #fff;
}

/* Deshabilitados de .btn sin transparencia (ponelo al final del CSS) */
.btn:disabled,
.btn[disabled] {
  opacity: 1 !important;
  cursor: not-allowed;
}




/* --- KPI: botón ojo --- */
.kpi-toggle{
  all: unset;                         /* limpia estilos heredados del "button, .btn, ..." */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f3f4f6;               /* pastilla clara */
  border: 1px solid #e5e7eb;
  color: #374151;                     /* icono gris oscuro (sí se ve) */
  cursor: pointer;
}
.kpi-toggle:hover{ background:#e5e7eb; }
.kpi-toggle:active{ transform: scale(.98); }
.kpi-toggle:focus-visible{
  outline: 3px solid rgba(37,99,235,.25);
  outline-offset: 2px;
}


/* === CARDS DASHBOARD === */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem; padding: 2rem 1rem; max-width: 1200px; margin: 0 auto;
}



.card {
  background: white; border-radius: 12px; padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center; display: flex; flex-direction: column; gap: .75rem;
  transition: transform .2s ease;
}
.card:hover { transform: translateY(-4px); }
.card i { color: #005a87; }

/* === MODAL === */
.modal {
  display: none; position: fixed; z-index: 9999; top: 0; left: 0;
  width: 100vw; height: 100vh; background-color: rgba(0,0,0,.6);
  justify-content: center; align-items: center; padding: 1rem;
}

.modal-content {
  background-color: white; width: 80%; max-height: 90vh; overflow-y: auto;
  border-radius: 10px; box-shadow: 0 0 15px rgba(0,0,0,.3);
  padding: 1rem; animation: fadeIn .3s ease-in-out;
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #eee; padding-bottom: .5rem;
}

.close-modal { font-size: 1.5rem; cursor: pointer; color: #888; }

/* === TOGGLE === */
.toggle-cerradas {
  margin-bottom: 1rem; user-select: none; font-weight: 600;
  display: flex; align-items: center; gap: .5rem; color: #004d99; cursor: pointer;
}
.toggle-cerradas input { cursor: pointer; }

/* === DATATABLES === */
.dataTables_filter { float: left !important; text-align: left !important; margin-bottom: 1rem; }

.dataTables_wrapper .dataTables_filter { float: right; }
.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter input { width: 200px; }

.dataTables_length label, .dataTables_filter label {
  font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
}

.dataTables_length select, .dataTables_filter input {
  padding: 6px 10px; font-size: .9rem; border: 1px solid #ccc; border-radius: 6px;
  outline: none; transition: border-color .2s ease;
}
.dataTables_length select:focus, .dataTables_filter input:focus { border-color: #0077b6; }

/* === PAGINACIÓN DE DATATABLES === */
.dataTables_wrapper .dataTables_paginate {
  display: flex; justify-content: center; margin-top: 1rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background-color: #f0f4f8; border: 1px solid #ccc; border-radius: 6px;
  padding: 6px 12px; margin: 0 3px; font-size: .9rem; color: #333; cursor: pointer; transition: all .2s ease;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: #0077b6; color: #fff !important; border-color: #0077b6;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: #0077b6; color: #fff !important; border-color: #0077b6; font-weight: bold;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .5; cursor: default; }

/* === OVERLAY MENU MÓVIL === */
.overlay { display: none; }
.overlay.active {
  display: block; position: fixed; top: 0; left: 0;
  background-color: rgba(0,0,0,.3); width: 100%; height: 100%; z-index: 999;
}

/* === FOOTER === */
.footer {
  background-color: #f0f4f8; padding: 1rem; text-align: center;
  font-size: .95rem; color: #444; border-top: 1px solid #ddd; margin-top: 2rem;
}
.footer-content a { color: #005a87; text-decoration: none; font-weight: 500; }
.footer-content a:hover { text-decoration: underline; }

/* === ANIMACIONES === */
@keyframes fadeIn { from {opacity:0; transform: scale(.95);} to {opacity:1; transform: scale(1);} }
.fade-in { animation: fadeIn .6s ease-in-out; }

.main-content { display: flex; flex-direction: column; flex: 1; }
.content-wrapper { flex-grow: 1; }
.footer { margin-top: auto; }

/* === TOAST === */
.hidden { display: none !important; }

.toast {
  position: fixed; top: 1rem; left: 1rem; /* 📍 a la izquierda */
  background-color: #323232; color: #fff; padding: 1rem 1.5rem;
  border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: opacity .4s ease, transform .4s ease;
  z-index: 10001; font-weight: bold; transform: translateY(-20px);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* === SELECT BONITO === */
.select-estilo {
  padding: .5rem 1rem; border: 1px solid #ccc; border-radius: 8px; background-color: white;
  font-size: 1rem; color: #333; cursor: pointer; max-width: 300px;
  box-shadow: 0 2px 4px rgba(0,0,0,.05); transition: border-color .3s ease, box-shadow .3s ease;
}
.select-estilo:hover { border-color: #888; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.select-estilo:focus { outline: none; border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,.2); }

/* === PREVIEW FOTOS === */
.preview-fotos { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.foto-miniatura {
  width: 70px; height: 70px; object-fit: cover; border-radius: 10px; box-shadow: 0 2px 4px #0002;
}

/* === VISTA EN TARJETAS PARA CELULAR === */
.cards-container { display: none; flex-direction: column; gap: 1rem; padding: 1rem; }
.card-cliente {
  background-color: #fff; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.1);
  padding: 1rem; font-size: .95rem; border-left: 4px solid #0077b6; transition: transform .2s ease;
}
.card-cliente:hover { transform: translateY(-2px); }
.card-cliente h3 { margin: 0 0 .5rem; font-size: 1.1rem; color: #005a87; }
.card-cliente p { margin: .3rem 0; }
.card-cliente .acciones { margin-top: .8rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.card-cliente .btn { font-size: .9rem; padding: .5rem 1rem; flex: 1 1 auto; }

/* Mostrar tarjetas y ocultar tabla en pantallas pequeñas */
@media (max-width: 768px) {
  .tabla-container { display: none; }
  .cards-container { display: flex !important; }
}

/* Buscador móvil */
.buscador-movil { display: none; padding: 0 1rem 1rem; }
.buscador-movil input {
  width: 100%; padding: .75rem; font-size: 1rem; border: 1px solid #ccc; border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
@media (max-width: 768px) { .buscador-movil { display: block; } }

/* Ajuste específico para móvil */
@media (max-width: 768px) {
  .card-cliente .acciones { flex-direction: column; }
  .card-cliente .btn {
    flex: 1 1 100%; width: 100%; box-sizing: border-box;
    font-size: .95rem; padding: .6rem .9rem;
  }
}

/* === IA === */
textarea#pregunta {
  width: 100%; padding: 1rem; font-size: 1rem; border-radius: 8px; border: 1px solid #ccc;
  margin-bottom: 1rem; resize: vertical;
}

#respuesta {
  margin-top: 1rem; padding: 1rem; background-color: #f4f4f4;
  border-left: 4px solid #3b82f6; border-radius: 4px; display: none;
}

#respuesta.error { background-color: #ffeaea; border-left-color: #e53935; color: #d32f2f; }
.respuesta.cargando::before {
  content: "⏳"; animation: spin 1s linear infinite; display: inline-block; margin-right: .5rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .container { flex-direction: column; }

  .mobile-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: .75rem 1rem; background-color: white; position: sticky; top: 0; z-index: 1000; gap: .5rem;
  }
  .logo-mobile { font-size: 1.2rem; font-weight: bold; color: #005a87; flex-grow: 1; }

  .sidebar {
    transform: translateX(-100%); transition: transform .3s ease;
    position: fixed; top: 0; left: 0; width: 240px; height: 100%;
    background-color: #f0f4f8; padding: 1rem; z-index: 1000; display: flex; flex-direction: column;
  }
  .sidebar.open { transform: translateX(0); }

  /* Alineación de botones en formularios (solo layout en móvil) */
  .botones-acciones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

  /* Botones ocupan ancho completo en móvil (misma paleta global) */
  .btn { flex: 1 1 100%; min-width: auto; }

  .content-wrapper { flex-direction: column; }
  #form-cliente, .tabla-container { max-width: 100%; flex: 1 1 100%; }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { float: none; text-align: left; margin-bottom: 1rem; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; }
}

/* Contenedor con scroll suave en móvil */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

/* Que la tabla tenga ancho mínimo para forzar scroll y no aplastar columnas */
#tabla-usuarios {
  min-width: 900px; /* ajustá según tus columnas */
}

/* Evitar quiebres feos */
#tabla-usuarios td, #tabla-usuarios th {
  white-space: nowrap;
  vertical-align: middle;
}

/* Primera columna pegada a la izquierda para referencia */
#tabla-usuarios th:first-child,
#tabla-usuarios td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  box-shadow: 1px 0 0 #eee;
}

/* Columna Acciones pegada a la derecha en scroll */
#tabla-usuarios th.col-acciones,
#tabla-usuarios td.col-acciones {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 2;
  box-shadow: -1px 0 0 #eee;
}

/* En pantallas chicas, ocultá columnas “nice-to-have” para reducir scroll */
@media (max-width: 768px) {
  /* ejemplo: oculto Teléfono y Observaciones */
  #tabla-usuarios th:nth-child(5),
  #tabla-usuarios td:nth-child(5),
  #tabla-usuarios th:nth-child(6),
  #tabla-usuarios td:nth-child(6) {
    display: none;
  }
}

.tabla-container {
  margin-left: 0;
  margin-right: 0;
}

.content-wrapper {
  margin-left: 0;
  margin-right: 0;
}

table.dataTable th,
table.dataTable td {
  border-bottom: 1px solid #e5e7eb; /* línea sutil */
}

table.dataTable th {
  padding: 12px 16px; /* alto y ancho del padding */
  font-size: 0.95rem; /* un poquito más grande si querés */
}

/* Encabezados más “espaciosos” y sin cortes de línea */
table.dataTable thead th {
  white-space: nowrap !important;
  padding: 14px 18px !important;  /* más aire */
  line-height: 1.25;
}

/* (opcional) si la tabla de Vehículos queda corta de ancho mínimo */

/* Header móvil para el buscador */
.vista-header { display:flex; gap:.75rem; align-items:center; margin:.75rem 0; }
.vista-header .input { flex:1; max-width:420px; }

/* Grilla de cards */
.cards-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  gap:12px;
}

/* Estilo de cada card */
.orden-card{
  background:#fff;
  border:1px solid #e6e8ec;
  border-radius:14px;
  padding:12px;
  box-shadow:0 1px 8px rgba(0,0,0,.04);
}
.orden-card .top{
  display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;
}
.badge{
  font-size:.75rem; padding:.2rem .5rem; border-radius:999px; border:1px solid transparent;
}
.badge.PENDIENTE  { background:#fff7e6; color:#a05a00; border-color:#ffd599; }
.badge.EN_PROCESO { background:#e6f2ff; color:#004a99; border-color:#b7d3ff; }
.badge.FINALIZADA { background:#f0f5ff; color:#223e7a; border-color:#d6e2ff; }
.badge.CERRADA    { background:#e8fff1; color:#0c6b3c; border-color:#b5f0d0; }

.orden-card .meta{ font-size:.9rem; line-height:1.35rem; color:#333; }
.orden-card .meta .label{ color:#666; }

.orden-card .actions{ display:flex; gap:.5rem; margin-top:.6rem; flex-wrap:wrap; }
.orden-card .btn-xs{ font-size:.85rem; padding:.35rem .6rem; border-radius:8px; border:1px solid #e0e0e0; background:#4a6cf7; cursor:pointer; }
.orden-card .btn-xs.primary{ background:#6c757d; border-color:#4a6cf7; color:#fff; }
.orden-card .btn-xs.primaryy{ background:#0dcaf0; border-color:#4a6cf7; color:#fff; }
.orden-card .btn-xs.danger{ background:#dc3545; border-color:#ffc6c6; color:#fff; }

@media (max-width:768px){
  #tableView, .table-container { display:none !important; }
  #cardsOrdenes{ display:grid !important; }
  #toggleViewBtn{ display:none !important; } /* ya lo tenías */
}

/* Evitar clipping del popup/teclado en móvil   */
.form-container, .flex-container, main, body { overflow: visible !important; }

/* Grid responsive para las cards de categorías */
#cardsCategorias.cards-container{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 8px 0;
}
#cardsCategorias .categoria-card{
  max-width: none;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  padding: 1rem;
}
#cardsCategorias .categoria-card .card-actions{
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 600px){
  #cardsCategorias.cards-container{ grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .botones-acciones button,
  .botones-acciones .btn {
    justify-content: center;
    width: 100%;
    text-align: center;
  }
}
/* ---- Reportes Vehículos (anti-scroll / layout estable) ---- */
.charts-grid { align-items: stretch; }
.chart-card { overflow: hidden; }
.chart-card canvas { display:block; width:100% !important; height:260px !important; }



/* ---- dashboard admin ---- */
/* ===== Mobile polish ===== */

/* tamaños y espacios */
@media (max-width: 768px){
  body { font-size: 16px; }
  header { padding: .85rem 1rem; }
  .container { padding: .75rem; }

  /* chips de filtro: una sola fila scrolleable */
  #filters.filters {
    gap: .4rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    -webkit-overflow-scrolling: touch;
  }
  #filters .btn-chip { padding: .5rem .9rem; font-size: .95rem; }

  /* tarjetas (cards) con más aire y sin “apretar” */
  .card { padding: .85rem; border-radius: 14px; }

  /* KPIs en 2 columnas (y 1 si el ancho es muy chico) */
  .kpis { grid-template-columns: 1fr 1fr; gap: .75rem; }
}
@media (max-width: 420px){
  .kpis { grid-template-columns: 1fr; }
}

/* grillas principales: 1 columna en mobile */
@media (max-width: 900px){
  .charts { grid-template-columns: 1fr; gap: .75rem; }
  .grid-2 { grid-template-columns: 1fr; gap: .75rem; }
}

/* badges de estado: que no desborden */
.status {
  line-height: 1.2;
  white-space: nowrap;
  padding: .25rem .55rem;
  font-size: .82rem;
}

/* tablas scrolleables horizontalmente */
.card .table {
  display: block;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  border-spacing: 0; /* por si acaso */
}

/* celdas con mejor alto de toque */
.table th, .table td { padding: .6rem .7rem; }

/* textos largos cortan bien */
.wrap { max-width: 100%; word-break: break-word; }

/* canvas charts: que se adapten al alto del contenedor */
#chartLine, #chartDoughnut {
  width: 100% !important;
  height: 220px !important;   /* cómodo en mobile */
}
@media (min-width: 768px){
  #chartLine, #chartDoughnut { height: 280px !important; }
}

/* ===== Historial Vehículo: apilar buscador + datos + cards ===== */
.content-wrapper.stacked{
  display: flex;
  flex-direction: column;   /* apila vertical */
  gap: 14px;
  align-items: stretch;
}
.content-wrapper.stacked > *{ width: 100%; }

/* form compacto y flexible */
.form-inline{
  display: flex;
  gap: .6rem;
  align-items: center;
  max-width: 720px;         /* ancho cómodo para el buscador */
}
.form-inline input{ flex: 1; min-width: 220px; }

/* cabecera del vehículo + botón imprimir en misma fila */
#datosVehiculo{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
#datosVehiculo h3{ margin: 0; }
#cardsHistorial{ width: 100%; }  /* las cards ocupan toda la fila */

/* en pantallas chicas, el form pasa a columna */
@media (max-width: 600px){
  .form-inline{ flex-direction: column; align-items: stretch; }
  .form-inline label{ margin-bottom: .25rem; }
}


/* === PRESUPUESTO ENVIADO (badge adicional) === */
.badge-presu{
  display:inline-flex; align-items:center; gap:.35rem;
  background:#7C3AED; color:#fff;
  padding:.22rem .55rem; border-radius:999px;
  font-size:.75rem; font-weight:700; letter-spacing:.02em;
  border:1px solid #6b21a8;  /* leve borde para contraste */
}
.badge-presu::before{
  content:""; width:6px; height:6px; border-radius:50%; background:#fff; opacity:.9;
}

/* que no se corte feo dentro de celdas */
table.dataTable td .badge-presu{ white-space:nowrap; vertical-align:middle; }

/* Cards: grupo de badges juntos (estado + presu) */
.orden-card .badges{
  display:flex; align-items:center; gap:.4rem; flex-wrap:wrap;
}



/* Toolbar de filtros inicio ---------------------------------*/
/* Dejá los toggles a la IZQUIERDA */
.toolbar-filtros{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:flex-start; /* ← clave */
  margin:10px 0 18px 0;
  flex-wrap:wrap;
}
.filtro{ display:flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid #e5e7eb;
  background:#fff; border-radius:12px; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.switch-label{ font-size:14px; color:#374151; white-space:nowrap; }
.switch-label i{ margin-right:6px; color:#6b7280; }

/* Toggle tipo “switch” */
.switch{ position:relative; display:inline-block; width:44px; height:24px; }
.switch input{ opacity:0; width:0; height:0; }
.slider{
  position:absolute; cursor:pointer; inset:0; background:#e5e7eb; transition:.2s; border-radius:999px;
  box-shadow: inset 0 0 0 1px #d1d5db;
}
.slider:before{
  position:absolute; content:""; height:18px; width:18px; left:3px; top:3px; background:#fff; transition:.2s; border-radius:50%;
  box-shadow:0 1px 2px rgba(0,0,0,.15);
}
.switch input:checked + .slider{ background:#2563eb; box-shadow: inset 0 0 0 1px #1d4ed8; }
.switch input:checked + .slider:before{ transform: translateX(20px); }

/* Mobile: apilar prolijo */
@media (max-width:768px){
  .toolbar-filtros{ justify-content:flex-start; }
}

/* Toolbar de filtros fin ---------------------------------*/


/*   tabla de ordenes  inicio Sticky first/last (con scrollX) */
.dataTables_wrapper .dataTables_scrollBody table.dataTable thead th.sticky-left,
.dataTables_wrapper .dataTables_scrollBody table.dataTable tbody td.sticky-left {
  position: sticky; left: 0; z-index: 2; background: #fff;
}
.dataTables_wrapper .dataTables_scrollBody table.dataTable thead th.sticky-right,
.dataTables_wrapper .dataTables_scrollBody table.dataTable tbody td.sticky-right {
  position: sticky; right: 0; z-index: 2; background: #fff;
}

/* Estilo del row “child” (Ver más) */
.dt-child-wrap { padding: 10px 12px; background: #fafafa; border-left: 3px solid #e5e7eb; }
.dt-child-wrap .label { font-weight: 600; color: #374151; margin-right: 6px; }
.dt-child-wrap .item { margin: 6px 0; }


/*   tabla de ordenes  fin Sticky first/last (con scrollX) */

/* botones de ordenes inicio */
.dt-child-actions{
  margin-top:10px; display:flex; flex-wrap:wrap; gap:8px;
}
.dt-child-actions .btn{
  padding:6px 10px; font-size:12px; border-radius:8px;
}
.dt-child-actions .btn i{ margin-right:6px; }

/* botones de ordenes fin */

/* Oculta inputs de archivo sin romper el click programático en iOS/Safari */
.visualmente-oculto {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  /* no uses display:none / visibility:hidden para evitar bloqueos en iOS */
}


/* ====== Tabla Vehículos: layout estable y sin “empujar” ====== */
.tabla-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  padding: 10px;
}

/* No fuerces min-width gigante a la tabla */
#tablaVehiculos { min-width: 0; }
@media (max-width: 900px){
  #tablaVehiculos { min-width: 900px; } /* opcional para XS */
}

/* Wrap/no-wrap selectivo */
#tablaVehiculos td.dt-nowrap, #tablaVehiculos th.dt-nowrap { white-space: nowrap !important; }
#tablaVehiculos td.dt-wrap,   #tablaVehiculos th.dt-wrap   { white-space: normal !important; word-break: break-word; overflow-wrap: anywhere; }
#tablaVehiculos td.acciones { white-space: nowrap !important; display:flex; gap:8px; align-items:center; }

/* === Vehículos: que NUNCA se salga del contenedor === */
#tablaVehiculos{
  width: 100% !important;
  min-width: 0 !important;    /* anula min-width heredados */
  table-layout: fixed;        /* reparte el ancho y evita desborde */
}

/* Permitir salto de línea también en los TH (excepto los compactos) */
#tablaVehiculos thead th{ white-space: normal !important; }
#tablaVehiculos thead th.no-wrap,
#tablaVehiculos td.no-wrap{ white-space: nowrap !important; }

/* Columna Observaciones envuelve texto; Acciones compacto */
#tablaVehiculos td.dt-wrap, #tablaVehiculos th.dt-wrap{
  white-space: normal !important; word-break: break-word; overflow-wrap: anywhere;
}
#tablaVehiculos td.acciones{
  white-space: nowrap !important; display:flex; gap:8px; align-items:center;
}

/* Contenedor con scroll defensivo por si la pantalla es muy chica */
.tabla-container{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background:#fff;
  border-radius:12px;
  box-shadow:0 1px 6px rgba(0,0,0,.06);
  padding:10px;
}




/* SECCION USUARIOS
/* ===== Card form móvil para Usuarios ===== */
.card-form {
  max-width: 720px;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  border: 1px solid #eef2f7;
}
.card-form-header { margin-bottom: .5rem; }
.card-title { margin: 0 0 .25rem; font-size: 1.25rem; color: #005a87; }
.card-subtitle { margin: 0; color: #6b7280; font-size: .95rem; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: #0077b6; box-shadow: 0 0 0 3px rgba(0,119,182,.12);
}
.hint { color:#6b7280; font-size: .85rem; display:block; margin-top:.35rem; }

.fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: .75rem;
  background: #fafafa;
}
.fieldset legend {
  font-weight: 700; font-size: .95rem; color:#374151; padding: 0 .35rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Acciones pegajosas al borde inferior en móvil */
.sticky-actions {
  display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .75rem;
}
@supports (position: sticky) {
  .sticky-actions {
    position: sticky; bottom: env(safe-area-inset-bottom, 0);
    background: #fff; padding-top: .5rem; /* evita que el teclado tape los botones */
  }
}
.sticky-actions .btn { flex: 1 1 48%; justify-content: center; }

/* Más aire en inputs para dedo (móvil) */
@media (max-width: 768px){
  .card-form { margin: .75rem; padding: .9rem; }
  .field input, .field textarea, .field select { padding: .85rem 1rem; font-size: 1.05rem; }
  .sticky-actions .btn { flex-basis: 100%; }
}

/* === Tablas Responsivas AutoGest === */

/* Contenedor general */
.tabla-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  padding: 10px;
}

/* Tabla base */
table.dataTable {
  width: 100% !important;
  min-width: 600px; /* ancho mínimo razonable */
  border-collapse: collapse;
  table-layout: auto;
}

/* Encabezados y celdas compactas */
table.dataTable th,
table.dataTable td {
  padding: 8px 10px;
  font-size: 0.9rem;
  line-height: 1.3;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

/* En pantallas chicas: más compacto y sin scroll horizontal innecesario */
@media (max-width: 768px) {
  table.dataTable {
    min-width: 100%;       /* se ajusta al contenedor */
    font-size: 0.85rem;    /* texto más chico */
  }

  table.dataTable th,
  table.dataTable td {
    padding: 6px 8px;
  }

  /* Ocultá columnas poco esenciales si la tabla tiene muchas */
  #tabla-clientes th:nth-child(5),
  #tabla-clientes td:nth-child(5),
  #tabla-clientes th:nth-child(6),
  #tabla-clientes td:nth-child(6) {
    display: none;
  }

  /* Evita que las celdas se apilen raro */
  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
  }
}


.footer { margin-top: 2rem; color:#6b7280; font-size:.95rem }
.footer a { color: inherit; text-decoration: underline }
.footer a:hover { color:#111827 }
.footer .legal { font-size:.9rem; opacity:.9 }
.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Mostrar botón en móvil, ocultar en desktop */
.acciones-movil { display: none; margin: 0 0 12px; }
@media (max-width: 768px){
  .acciones-movil { display: block; }
  /* Ocultamos la tabla en el flujo normal cuando hay botón */
  #seccionTablaClientes { display: none; }
}

/* Modal básico */
.modal-tabla {
  position: fixed; inset: 0;
  display: none; /* .open -> flex */
  align-items: center; justify-content: center;
  z-index: 1000;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(1.5px);
}
.modal-tabla.open { display: flex; }

.modal-card{
  position: relative;
  background: #fff;
  width: 95%;
  max-width: 1100px;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: var(--al-shadow, 0 12px 30px rgba(0,0,0,.18));
  padding: 16px;
  overflow: auto;
}

.modal-close{
  position:absolute; right:10px; top:10px;
  width:36px; height:36px; border-radius:999px;
  background:#f3f4f6; color:#111; border:1px solid #e5e7eb;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; opacity:.9; z-index:1;
}
.modal-close:hover{ opacity:1; background:#e5e7eb; }
.modal-close i{ font-size:18px; line-height:1; }
/* Contenedor estable para el gráfico principal (ya lo tenías) */
.chart-wrap{
  position: relative;
  height: clamp(220px, 35vh, 360px);
}
#graficoClientesMes{
  width:100% !important;
  height:100% !important;
  display:block;
}

/* 🔧 Alto fijo y razonable para el gráfico de TOP */
#graficoTopClientes{
  width: 100% !important;
  height: 220px !important;   /* ajustá a gusto (180–260px) */
  display: block;
}

/* Si el card padre intenta estirar, no dejes que el canvas crezca más */
.card canvas{
  max-height: 360px; /* tope defensivo */
}

/* Cuando el modal está abierto, forzamos que la sección de la tabla se vea */
.modal-tabla.open #seccionTablaClientes {
  display: block !important;
  width: 100%;
}


/* Mostrar botón en móvil y ocultar la tabla en el flujo normal */
.acciones-movil { display:none; margin:0 0 12px; }
@media (max-width:768px){
  .acciones-movil { display:block; }
  #seccionTablaVehiculos { display:none; }
}

/* Cuando el modal de vehículos está abierto, mostrala sí o sí */
.modal-tabla.open #modalTablaVehBody #seccionTablaVehiculos {
  display: block !important;
  width: 100%;
}

/* Por si el wrapper quedó con ancho raro dentro del modal */
.modal-tabla.open #modalTablaVehBody .dataTables_wrapper {
  width: 100% !important;
}

.acciones-movil { display: none; margin: 0 0 12px; }

/* En mobile: mostramos el botón y ocultamos la tabla inline */
@media (max-width: 768px){
  .acciones-movil { display: block; }
  #seccionTablaOrdenes { display: none; }
}

/* ── Mostrar la sección de Órdenes cuando está dentro del modal ── */
.modal-tabla.open #modalTablaOrdenesBody #seccionTablaOrdenes {
  display: block !important;
  width: 100%;
}

/* Por si el wrapper quedaba con ancho raro dentro del modal */
.modal-tabla.open #modalTablaOrdenesBody .dataTables_wrapper {
  width: 100% !important;
}


/* Botón visible solo en mobile */
.acciones-movil { display: none; margin: 0 0 12px; }

@media (max-width: 768px){
  .acciones-movil { display: block; }
  /* Oculta la sección de la tabla en el flujo normal */
  #seccionTablaProductos { display: none; }
}

/* Modal básico (si ya lo tenés para otros reportes, usá el mismo) */
.modal-tabla {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  z-index: 1000; background: rgba(0,0,0,.4); backdrop-filter: blur(1.5px);
}
.modal-tabla.open { display: flex; }

.modal-card {
  position: relative; background: #fff; width: 95%; max-width: 1100px; max-height: 85vh;
  border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 16px; overflow: auto;
}
.modal-close {
  position:absolute; right:10px; top:10px; width:36px; height:36px; border-radius:999px;
  background:#f3f4f6; color:#111; border:1px solid #e5e7eb; display:flex; align-items:center; justify-content:center;
  cursor:pointer; opacity:.9;
}
.modal-close:hover{ opacity:1; background:#e5e7eb; }

/* Cuando el modal está abierto, mostramos la sección dentro del modal */
.modal-tabla.open #modalTablaProductosBody #seccionTablaProductos {
  display: block !important; width: 100%;
}
/* Para que DataTables use bien el ancho dentro del modal */
.modal-tabla.open #modalTablaProductosBody .dataTables_wrapper {
  width: 100% !important;
}

/* Botón “ver tabla” solo en móvil */
.acciones-movil { display: none; margin: 0 0 12px; }

@media (max-width: 768px){
  .acciones-movil { display: block; }
  /* 🔒 Ocultá la tabla de Stock Bajo en el layout normal (móvil) */
  #seccionTablaStockBajo { display: none; }
}

/* Cuando el modal está abierto, forzamos a mostrar la tabla dentro del modal */
.modal-tabla.open #modalTablaStockBajoBody #seccionTablaStockBajo {
  display: block !important;
  width: 100%;
}

/* Por si el wrapper de DataTables necesita ajuste de ancho en el modal */
.modal-tabla.open #modalTablaStockBajoBody .dataTables_wrapper {
  width: 100% !important;
}

/* Botón solo en móvil */
@media (max-width: 768px){
  .acciones-movil{ display:block; }
}
@media (min-width: 769px){
  .acciones-movil{ display:none; }
}

/* Tabla de servicios: oculta en móvil por defecto */
@media (max-width: 768px){
  #seccionTablaServicios,
  #seccionTablaServicios .dataTables_wrapper{
    display: none !important;
  }
}

/* Cuando abrís el modal, mostramos la tabla (está movida adentro del modal) */
@media (max-width: 768px){
  .modal-tabla.open #seccionTablaServicios,
  .modal-tabla.open #seccionTablaServicios .dataTables_wrapper{
    display: block !important;
  }
}

/* Modal oculto por defecto */
.modal-tabla{
  position: fixed; inset: 0;
  display: none; /* importante */
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
  z-index: 1000;
}
.modal-tabla.open{ display: flex; }

.modal-card{
  width: min(960px, 92vw);
  max-height: 86vh;
  background: #fff; border-radius: 12px;
  padding: 12px 14px; overflow: auto;
}
.modal-close{
  border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer;
  position: absolute; right: 12px; top: 6px;
}

.ai-chips{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 12px}
.chip{border:1px solid #e5e7eb;background:#f8fafc;border-radius:999px;padding:6px 10px;font-size:.9rem;cursor:pointer}
.chip:hover{background:#eef2ff}

.ai-history{max-height:55vh;overflow:auto;background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;padding:12px}
.ai-bubble{background:#fff;border-radius:12px;padding:10px 12px;margin:8px 0;box-shadow:0 2px 5px rgba(0,0,0,.04)}
.ai-bubble.user{border-left:4px solid #2563eb}
.ai-bubble.assistant{border-left:4px solid #ea580c}
.ai-bubble.pending{opacity:.7}

.ai-media{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px}
.ai-media img{width:100%;height:88px;object-fit:cover;border-radius:8px;border:1px solid #e5e7eb}
.ai-video{position:relative;display:block}
.ai-video .badge{position:absolute;left:6px;bottom:6px;background:#000;color:#fff;font-size:12px;padding:2px 6px;border-radius:6px;opacity:.85}

.ai-input{margin-top:12px}
.ai-input textarea{width:100%;resize:vertical;border-radius:10px;padding:10px}
.ai-actions{display:flex;gap:8px;margin-top:8px}
.btn:disabled{opacity:.7;cursor:not-allowed}

/* ====== IA – mejoras locales ====== */
.ai-chips{
  display:flex; flex-wrap:wrap; gap:.5rem; margin: .75rem 0 1rem;
}

/* Reutiliza tu botón secundario como “chip” en formato pastilla */
.btn.chip{
  padding:.5rem .9rem;
  border-radius:999px;
  font-size:.95rem;
  line-height:1;
}

/* Focus visible accesible */
.btn.chip:focus-visible{
  outline:3px solid rgba(37,99,235,.25);
  outline-offset:2px;
}

/* Historial: edge suavizado y borde tenue */
.ai-history{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:1rem;
  min-height:140px;
  max-height:420px;
  overflow:auto;
}

/* Área de entrada y acciones alineadas */
.ai-input{
  display:grid;
  gap:.75rem;
}
.ai-input textarea{
  width:100%;
  min-height:110px;
  resize:vertical;
  border-radius:12px;
  border:1px solid #e5e7eb;
  padding:.9rem 1rem;
}

/* Barra de acciones */
.ai-actions{
  display:flex; gap:.5rem; flex-wrap:wrap;
}

/* Hover específico del botón de enviar (azul) */
#btn-consultar:hover{ transform:translateY(-1px); }
#btn-consultar:active{ transform:translateY(0); }


/* modal modalPresupuesto */
/* Anula el max-width inline */
#modalPresupuesto .modal-content{ max-width:none !important; }
/* Tamaño normal en desktop */
#modalPresupuesto .modal-content{
  width: 92vw;
  max-width: 980px;
  max-height: 90vh;
  overflow: auto;
}

/* Full-screen en pantallas chicas */
@media (max-width: 768px){
  #modalPresupuesto.modal{
    padding: 0;                 /* sin márgenes alrededor */
  }
  #modalPresupuesto .modal-content{
    width: 100vw !important;
    height: 100vh !important;   /* ocupa todo el alto */
    max-width: none !important;
    max-height: none !important;
    border-radius: 0;           /* sin bordes redondeados estilo app */
    margin: 0;
    overflow: auto;             /* scroll interno del contenido */
  }
  /* Botón cerrar fijo arriba a la izquierda */
  #modalPresupuesto .cerrar-modal{
    position: fixed;
    top: 10px; left: 12px;
    font-size: 22px;
    z-index: 10001;
  }
}

/* (opcional) bloquear scroll del fondo cuando el modal está abierto */
body.modal-open{ overflow: hidden; }

/* Acordeón básico */
#modalPresupuesto details.acc {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  margin: 10px 0;
  overflow: hidden;
}
#modalPresupuesto details.acc > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .7rem .9rem; font-weight: 700; color: #111827;
  background: #f8fafc;
}
#modalPresupuesto details.acc > summary::-webkit-details-marker { display: none; }

/* Flecha */
#modalPresupuesto details.acc > summary .chev {
  transition: transform .2s ease;
}
#modalPresupuesto details.acc[open] > summary .chev {
  transform: rotate(180deg);
}

/* Cuerpo */
#modalPresupuesto details.acc .acc-body {
  padding: .9rem;
}

/* En desktop: abiertos por defecto; en mobile: cerrados */
@media (min-width: 769px){
  #modalPresupuesto details.acc { /* se abrirán por JS añadiendo [open] */ }
}


/* Mini card de foto con botón borrar para presupuesto*/
.foto-presu{
  position:relative; width:90px; height:90px;
  border-radius:10px; overflow:hidden;
  box-shadow:0 2px 6px rgba(0,0,0,.12);
  margin:4px; display:inline-block;
}
.foto-presu img{ width:100%; height:100%; object-fit:cover; display:block; }

.foto-del{
  position:absolute; top:6px; right:6px;
  width:28px; height:28px; border:0; border-radius:999px;
  background:#ef4444; color:#fff; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; opacity:.9; line-height:1;
  z-index: 1; /* por si acaso */
}
.foto-del:hover{ opacity:1; background:#dc2626; }
.foto-del[disabled]{ opacity:.6; cursor:not-allowed; }


//
/* ── Visor de fotos (lightbox) ───────────────────────────── */
#photoViewer {
  position: fixed; inset: 0;
  display: none; /* .open => flex */
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.92);
  z-index: 10000;
  padding: 16px;
}
#photoViewer.open { display: flex; }


#photoViewer img {
  max-width: 96vw; max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  user-select: none;
  -webkit-user-drag: none;
}

#pv-close, #pv-prev, #pv-next, #pv-counter {
  position: absolute; color: #fff;
  background: transparent; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

#pv-close {
  top: 10px; right: 12px; width: 40px; height: 40px;
  font-size: 26px; border-radius: 999px; background: #0007;
}
#pv-close:hover { background: #000c; }

#pv-prev, #pv-next {
  top: 50%; transform: translateY(-50%);
  width: 48px; height: 64px; font-size: 28px; border-radius: 12px; background: #0006;
}
#pv-prev { left: 8px; }
#pv-next { right: 8px; }
#pv-prev:hover, #pv-next:hover { background: #000b; }

#pv-counter {
  bottom: 10px; left: 50%; transform: translateX(-50%);
  font-weight: 600; background: #0007; padding: 6px 10px; border-radius: 999px;
  font-size: 14px;
}

/* cursor en miniaturas */
.foto-presu img, .preview-fotos img { cursor: zoom-in; }

/* ── Acordeones tipo botón (global) ───────────────────────── */
details.acc{
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fff;
  box-shadow:0 1px 6px rgba(0,0,0,.06);
  margin:8px 0;
  overflow:hidden;                 /* redondeo limpio al abrir */
}
details.acc > summary{
  list-style:none;
  display:flex; align-items:center; justify-content:space-between;
  gap:.5rem;
  padding:.75rem .95rem;
  font-weight:700; font-size:.95rem; color:#111827;
  cursor:pointer; user-select:none; background:#fff;
}
details.acc > summary::-webkit-details-marker{ display:none; }

details.acc > summary:hover{ background:#f9fafb; }
details.acc > summary:focus-visible{
  outline:3px solid rgba(13,110,253,.25);
  outline-offset:2px; border-radius:10px;
}
details.acc .acc-body{
  border-top:1px solid #eef2f7;
  padding:.9rem; background:#fff;
}

/* chevron animado */
details.acc .chev{
  font-size:18px; line-height:1; opacity:.9;
  transition:transform .2s ease;
}
details.acc[open] .chev{ transform:rotate(180deg); }

/* ── Variante “Fotos del presupuesto” ─────────────────────── */
details.acc-fotos > summary{
  background:#fff7e6;              /* amarillo suave */
  color:#8a5a00;
  border-bottom:1px solid #ffe5b3;
}
details.acc-fotos > summary:hover{ background:#ffefcc; }
details.acc-fotos[open] > summary{
  background:#f59e0b;              /* activo */
  color:#fff;
}
details.acc-fotos[open] .acc-body{ background:#fffef8; }

/* compactar un poco en pantallas chicas */
@media (max-width:480px){
  details.acc > summary{ padding:.65rem .8rem; }
  details.acc .chev{ font-size:16px; }
}


/* ── Variante “Agregar fotos nuevas” ─────────────────────── */
details.acc-nuevas > summary{
  background:#e6f2ff;            /* azul muy suave */
  color:#0b4a8b;
  border-bottom:1px solid #b7d3ff;
}
details.acc-nuevas > summary:hover{ background:#d7eaff; }

details.acc-nuevas[open] > summary{
  background:#2563eb;            /* abierto/activo */
  color:#fff;
}
details.acc-nuevas[open] .acc-body{
  background:#f7fbff;
}


/* ── Variante “Acciones del presupuesto” ─────────────────── */
details.acc-acciones > summary{
  background:#f3f4f6;          /* gris muy suave */
  color:#111827;
  border-bottom:1px solid #e5e7eb;
}
details.acc-acciones > summary:hover{ background:#e5e7eb; }

details.acc-acciones[open] > summary{
  background:#374151;          /* activo */
  color:#fff;
}
details.acc-acciones[open] .acc-body{
  background:#fafafa;
}

/* Accesibilidad del summary (opcional, si no lo tenés ya) */
details.acc-acciones > summary:focus-visible{
  outline:3px solid rgba(55,65,81,.35);
  outline-offset:2px;
  border-radius:10px;
}

/* Evita que el gesto hacia abajo refresque la página */
html, body {
  overscroll-behavior-y: contain;
}

#photoViewer { z-index: 2147483647 !important; }

body.pv-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
}

body.pv-open { overflow: hidden !important; position: fixed; width: 100%; }
#photoViewer { z-index: 2147483647 !important; }



/* monto de ordenes cerradas */
.kpi-card.is-masked #kpiIngresos{
  filter: blur(8px);
  opacity:.6;
  user-select:none;
}
.kpi-toggle { padding:.25rem; }




/* Modal full-screen para el mural de órdenes (genérico) */
.modal-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.75);  /* más oscuro */
  backdrop-filter: blur(3px);          /* desenfoca lo de atrás */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 8px;
  overflow-y: auto;          /* 👈 si el panel crece, que haga scroll el overlay */

}

/* Contenedor interno del mural */
/* Contenedor interno del mural: panel oscuro */
.modal-mural-inner {
  font-size: 1rem;         /* antes ~0.9rem por defecto */
  background: rgba(15, 23, 42, 0.96);  /* panel sólido */
  color: #f9fafb;
  max-width: 1600px;
  width: 100%;
  max-height: calc(100vh - 32px)
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 18px;
  padding: 16px 16px 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

/* Cabecera del mural */
.modal-mural-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Grid de cards genérico:
   - En pantallas chicas: 1 columna
   - En pantallas medianas/grandes: 2, 3 o más columnas según el ancho */
.cards-mural {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 8px 0;
}

/* Cards del mural: mismas que la vista móvil (blancas) */
.cards-mural .orden-card {
  background: #ffffff;
  color: #333333;
  border-color: #e6e8ec;
  max-width: 100%;  /* deja que la grilla maneje el ancho */
}

/* Aumentamos un pelo los datos importantes */
.cards-mural .orden-card .meta {
  font-size: 1.1rem;
  line-height: 1.4;
}
/* En el mural NO mostramos botones de acción */
.cards-mural .orden-card .actions {
  display: none;
}

/* Título del número de orden más fuerte */
.cards-mural .orden-card .top strong {
  font-size: 2.05rem;
}

/* Opcional: que los labels destaquen un poco más */
.cards-mural .orden-card .meta .label {
  font-weight: 600;
}

/* Footer con sello de última actualización */
.mural-footer {
  margin-top: 4px;
  font-size: 2.00rem;
  color: #6b7280;
  text-align: right;
}
