/* ================================
   VARIABLES / BASE
================================ */
:root{
  /* Colores corporativos (logo Hesego) */
  --brand1:#006E77;  /* teal oscuro */
  --brand2:#00A6B4;  /* turquesa */
  --brand3:#0ED2D2;  /* acento */

  --bg:#f4f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;

  --danger:#dc2626;
  --danger2:#b91c1c;

  --shadow: 0 10px 24px rgba(15,23,42,.08);
  --radius:14px;

  /* altura aproximada navbar (para sticky header en tabla) */
  --topbar-h: 76px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

/* Evita scroll horizontal por elementos que se desbordan */
body{ overflow-x:hidden; }

/* ================================
   NAVBAR / TOPBAR (FULL WIDTH FIX)
================================ */
/*
  PROBLEMA: tu navbar se ve hasta “la mitad” cuando el <header>
  quedó dentro de un contenedor con max-width o dentro del grid .layout.

  FIX robusto:
  - width: 100vw
  - “saca” el header del centrado usando margin-left calc(50% - 50vw)
*/
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;

  /* FULL WIDTH A PRUEBA DE CONTENEDORES */
  width: 100vw;
  margin-left: calc(50% - 50vw);

  color:#fff;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  padding:14px 18px;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;

  box-shadow: 0 10px 20px rgba(0,0,0,.08);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 240px;
}

.brand__logo{
  width:44px;
  height:44px;
  border-radius:12px;
  object-fit:contain;
  background:#fff;
  border:1px solid rgba(255,255,255,.35);
}

.brand__title{
  font-weight:900;
  letter-spacing:.3px;
  line-height: 1.05;
}
.brand__subtitle{
  font-size:12px;
  opacity:.92;
  margin-top:2px;
}

.topnav{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: wrap; /* para que no se rompa en pantallas pequeñas */
  justify-content: flex-end;
}

.navlink{
  color:#fff;
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  font-weight:800;
  white-space: nowrap;
}

.navlink:hover{ background: rgba(255,255,255,.14); }

.navlink--active{
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.35);
}

/* ================================
   LAYOUT GENERAL
================================ */
.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:16px;
  padding:16px 18px 22px;

  /* importantísimo: evita que los hijos “empujen” el grid */
  min-width: 0;
}

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

.sidebar{
  display:flex;
  flex-direction:column;
  gap:16px;

  min-width: 0;
}

.panel, .card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel{ padding:14px; }
.card{ padding:14px; }

.panel__title{
  font-weight:900;
  font-size:14px;
  margin-bottom:10px;
}

.panel__subtitle{
  margin-top:12px;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

.main{
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width: 0;
}

.card__header{ margin-bottom:12px; }

.card__header--row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap: wrap;
}

.card h2{
  margin:0;
  font-size:18px;
}

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

/* ================================
   FORMULARIOS / CAMPOS
================================ */
.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

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

.field textarea{
  resize: vertical;
  min-height: 140px; /* un poco más grande como pediste */
}

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color: rgba(0, 166, 180, .65);
  box-shadow: 0 0 0 4px rgba(0, 166, 180, .14);
}

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

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  min-width: 0;
}

.grid3{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
  min-width: 0;
}

@media (max-width: 720px){
  .grid2, .grid3{ grid-template-columns: 1fr; }
}

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

.form__row{
  display:grid;
  grid-template-columns: 1.2fr 1fr .8fr;
  gap:12px;
  min-width: 0;
}

.form__row--2col{
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px){
  .form__row, .form__row--2col{ grid-template-columns: 1fr; }
}

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

/* ================================
   BOTONES
================================ */
.btn{
  border:1px solid var(--line);
  background:#fff;
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  line-height: 1;
}

.btn--primary{
  background: var(--brand2);
  border-color: var(--brand1);
  color:#fff;
}
.btn--primary:hover{ filter: brightness(.95); }

.btn--ghost{
  background: rgba(255,255,255,.10);
  color:#fff;
  border-color: rgba(255,255,255,.25);
}
.btn--ghost:hover{ background: rgba(255,255,255,.16); }

.btnrow{
  display:flex;
  gap:10px;
  margin-top:10px;
  flex-wrap: wrap;
}

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

/* FIX: en panel de “Acciones” evita que el botón se vea gigante raro */
.panel .btncol .btn{
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
}

/* Botón danger */
.btn--danger{
  background: var(--danger);
  border-color: var(--danger2);
  color:#fff;
}
.btn--danger:hover{ background: var(--danger2); }

/* ================================
   BOTONES DE ICONO (ACCIONES TABLA)
================================ */
.iconbtn{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;

  /* evita deformaciones */
  flex: 0 0 auto;
}

.iconbtn:hover{ background:#f3f4f6; }

/* ================================
   TABLA + SCROLL
================================ */
.tableWrap{
  overflow:auto;              /* scroll horizontal */
  border-radius: 12px;
  border:1px solid var(--line);
  background:#fff;

  /* evita que se salga del grid */
  min-width: 0;
}

/* alto fijo + scroll vertical interno */
.tableWrap--fixed{
  max-height: 560px;          /* ajusta a gusto */
  overflow: auto;
}

/* tabla */
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 980px; /* si hay muchas columnas, activa scroll horizontal */
  background:#fff;
}

.table th{
  position: sticky;
  top: 0; /* header de tabla sticky */
  background:#f9fbff;
  text-align:left;
  font-size:12px;
  color:var(--muted);
  padding:12px;
  border-bottom:1px solid var(--line);
  z-index: 2;
}

.table td{
  padding:12px;
  border-bottom:1px solid var(--line);
  vertical-align: top;
}

/* columnas */
.col-check{ width: 52px; }
.col-actions{ width: 140px; } /* más compacto */
.col-evidencia{ width: 140px; }

/* Badges estados */
.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  white-space: nowrap;
}
.badge--pendiente{ background:#fff3b0; }
.badge--reprog{ background:#dbeafe; }
.badge--cerrado{ background:#dcfce7; }

/* ✅ ATRASADO: más sutil (o bórralo si no lo quieres) */
.row-late{ background:#fff7f7; }

/* Acciones: ahora quedan ordenadas en fila (iconos) */
.actions{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-start;
  flex-wrap: wrap;
}

/* checkbox seleccionar todos */
.checkAll{
  display:flex;
  gap:10px;
  align-items:center;
  font-size:12px;
  color:var(--muted);
}

/* ================================
   DIALOGS / MODALES
================================ */
.dlg{
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(720px, 92vw);
  box-shadow: var(--shadow);
}
.dlg--wide{ width: min(980px, 94vw); }
.dlg::backdrop{ background: rgba(15, 23, 42, .35); }

.dlg__head{
  padding: 14px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#fff;
  border-radius:16px 16px 0 0;
}
.dlg__title{ font-weight:900; }
.dlg__body{
  padding: 14px;
  background:#fff;
  border-radius:0 0 16px 16px;
}
.dlg__actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* =========================================
   FIX: btn--ghost SOLO para TOPBAR (navbar)
   y crear un estilo visible para paneles
========================================= */

/* 1) btn--ghost dentro del navbar: OK (blanco) */
.topbar .btn--ghost,
.topbar .navlink.btn--ghost{
  background: rgba(255,255,255,.10);
  color:#fff;
  border-color: rgba(255,255,255,.25);
}

.topbar .btn--ghost:hover,
.topbar .navlink.btn--ghost:hover{
  background: rgba(255,255,255,.16);
}

/* 2) btn--ghost fuera del navbar (paneles/cards): visible */
body .btn--ghost{
  background: #f1f5f9;         /* gris claro */
  color: var(--text);          /* texto oscuro */
  border-color: var(--line);
}

body .btn--ghost:hover{
  background: #e9eff6;
}

/* 3) Para que los botones en el panel "Acciones" siempre llenen el ancho */
.panel .btncol .btn{
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:14px 14px;
  border-radius:14px;
  white-space: nowrap;
}

/* 4) (Opcional) mejorar el multi-select del estado */
#filtro_estado[multiple]{
  min-height: 110px;
}