:root{
  --bg:#eef2f7;
  --card:#ffffff;
  --line:#e6eaf1;
  --text:#0f172a;
  --muted:#6b7280;
  --brand:#1f3b70;
  --brand2:#1f6aa5;
  --shadow: 0 12px 28px rgba(15, 23, 42, .08);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }

.topbar{
  height:64px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  font-weight:800;
  letter-spacing:.2px;
}
.brand-badge{
  width:56px;
  height:36px;
  border-radius:10px;
  background: var(--brand);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}
.brand-title{
  font-weight:800;
  color:#0b1220;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:14px;
  color: var(--muted);
}
.topbar-right .pill{
  background:#fff;
  border:1px solid var(--line);
  border-radius:999px;
  padding:8px 12px;
  font-weight:600;
}
.topbar-right .link{
  font-weight:700;
  color: var(--brand2);
}
.topbar-right .icon{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
}

.page{
  max-width: 1280px;
  margin: 18px auto;
  padding: 0 14px;
}

/* =========================================================
   NUEVO: Layout en columna (3 tarjetas apiladas a todo ancho)
   ========================================================= */
.stack-main{
  display:grid;
  grid-template-columns: 1fr;
  gap:18px;
  align-items:start;
}

/* Cards */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

/* Header de card con botón colapsar */
.card-h{
  padding:16px 18px;
  font-size: 22px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.card-b{
  padding: 14px 18px 18px;
}

.section-title{
  font-size:18px;
  font-weight:800;
  margin: 18px 0 10px;
}

.small-muted{ color: var(--muted); font-size: 13px; }

/* Botón colapsar */
.collapse-btn{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  user-select:none;
  font-weight:900;
  color: var(--brand2);
}
.collapse-btn:hover{
  filter: brightness(0.98);
}

.card.collapsed .card-b{
  display:none;
}
.collapse-btn .tri{
  display:block;
  transform: rotate(90deg); /* abierto = ▼ (rotado) */
  transition: transform .15s ease;
}
.card.collapsed .collapse-btn .tri{
  transform: rotate(0deg);  /* cerrado = ▶ */
}

/* Tables */
.table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.table th{
  text-align:left;
  color: var(--muted);
  font-weight:700;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
}
.table td{
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align:middle;
}
.table tr:last-child td{ border-bottom:none; }

.tr-hover:hover{
  background:#f7fafc;
  cursor:pointer;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:#94a3b8;
}
.dot.green{ background:#22c55e; }
.dot.yellow{ background:#f59e0b; }
.dot.red{ background:#ef4444; }

.progress{
  height: 12px;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}
.progress > span{
  display:block;
  height:100%;
  width:0%;
  background: var(--brand2);
  border-radius:999px;
}

.phase-row{
  display:grid;
  grid-template-columns: 140px 1fr 52px;
  align-items:center;
  gap:12px;
  padding: 10px 0;
}
.phase-row .label{ color: var(--muted); font-weight:700; }
.phase-row .pct{ text-align:right; color: var(--muted); font-weight:800; }

.detail-title{
  font-size:22px;
  font-weight:900;
  margin: 0 0 2px;
}
.detail-subtitle{
  color: var(--muted);
  font-weight:700;
  margin: 0 0 10px;
}

.doc-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.doc-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}
.doc-item .name{
  font-weight:700;
  color:#0b1220;
}
.doc-item .meta{
  color: var(--muted);
  font-size:13px;
}
.doc-item .dl{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color: var(--brand2);
}

.photos{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
}
.photo{
  border-radius:14px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#fff;
  aspect-ratio: 4/3;
  display:flex;
  align-items:center;
  justify-content:center;
}
.photo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Responsive */
@media (max-width: 1024px){
  .photos{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px){
  .phase-row{ grid-template-columns: 110px 1fr 52px; }
  .photos{ grid-template-columns: 1fr; }
}

/* =========================================================
   LOGIN (restaurar el look “lindo” del ingreso)
   ========================================================= */

.login-body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px 14px;
  background: var(--bg);
}

.login-card{
  width: 520px;
  max-width: 92vw;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-logo{
  width: 56px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  margin-bottom: 10px;
}

.login-card h2{
  margin: 0 0 12px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: .2px;
}

.alert{
  background:#fee2e2;
  border: 1px solid #fecaca;
  color:#991b1b;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0 14px;
  font-weight: 800;
}

.alert.ok{
  background:#dcfce7;
  border:1px solid #bbf7d0;
  color:#166534;
}

.login-card form{
  display:grid;
  gap:12px;
}

.login-card label{
  display:block;
  font-weight: 800;
  color: var(--muted);
  margin-top: 2px;
}

.login-card input{
  width:100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 15px;
  outline: none;
  background:#fff;
}

.login-card input:focus{
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}

.btn{
  height: 40px;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn.primary{
  background: var(--brand2);
  color:#fff;
}

.btn.primary:hover{
  filter: brightness(0.95);
}

/* =========================
   Admin upload rows (solo UI)
   ========================= */
.admin-upload{
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}

.upload-row{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:8px;
  flex-wrap: wrap;
}

.upload-row input[type="file"]{
  max-width: 520px;
}

/* =========================
   Datos del proyecto (mini sección colapsable)
   ========================= */
.subpanel{
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.subpanel-h{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 12px;
  font-weight: 900;
  color: #0b1220;
  cursor: pointer;
  user-select: none;
}

.subpanel-h:hover{
  filter: brightness(0.99);
}

.subpanel-toggle{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color: var(--brand2);
}

.subpanel-b{
  padding: 12px 12px 14px;
  border-top: 1px solid var(--line);
}

.subpanel.collapsed .subpanel-b{
  display:none;
}

/* =========================
   Delete buttons (admin-only UI)
   ========================= */

.doc-link{ flex:1; }
.doc-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.del-btn{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  cursor:pointer;
  color:#ef4444;
  line-height:1;
}
.del-btn:hover{ filter: brightness(0.97); }

/* Fotos: overlay delete */
.photo-wrap{ position: relative; }

.photo-del-form{
  position:absolute;
  top:8px;
  right:8px;
  margin:0;
}

.photo-del{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.92);
  font-weight:900;
  cursor:pointer;
  color:#ef4444;
  line-height:1;
}
.photo-del:hover{ filter: brightness(0.97); }

/* =========================
   GANTT (solo portal web)
   ========================= */

.gantt-legend{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.g-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 10px;
  font-weight:800;
  color: var(--muted);
  font-size:13px;
}
.g-dot{
  width:10px; height:10px; border-radius:50%;
  background:#94a3b8;
}
.g-dot.done{ background:#22c55e; }
.g-dot.doing{ background: var(--brand2); }
.g-dot.pend{ background:#f59e0b; }
.g-dot.block{ background:#ef4444; }

.gantt-wrap{
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  overflow:hidden;
}

.gantt-axis{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:0;
  border-bottom:1px solid var(--line);
  background:#f8fafc;
}
.gantt-axis-left{
  padding:12px 14px;
  font-weight:900;
  color: var(--muted);
}
.gantt-axis-right{
  position:relative;
  padding:12px 14px 12px 14px; /* derecha vuelve a 14px */
}
.gantt-scale{
  position:relative;
  height:26px;
}

.gantt-tick{
  position:absolute;
  top:0;
  transform: translateX(-50%);
  text-align:center;
}
.gantt-tick-line{
  position:absolute;
  top:0;
  left:50%;
  transform: translateX(-50%);
  width:1px;
  height:26px;
  background: var(--line);
}
.gantt-tick-label{
  position:relative;
  top:10px;
  font-size:12px;
  color: var(--muted);
  font-weight:800;
  background:#f8fafc;
  padding:0 6px;
}

.gantt-row{
  display:grid;
  grid-template-columns: 360px 1fr;
  border-bottom:1px solid var(--line);
}
.gantt-row:last-child{ border-bottom:none; }

.gantt-left{
  padding:12px 14px;
}
.gantt-task-title{
  font-weight:900;
  color: var(--text);
}
.gantt-task-meta{
  margin-top:6px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.g-badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  color: var(--muted);
  font-size:12px;
}

.gantt-right{
  padding:12px 14px 12px 14px;
}
.gantt-track{
  position:relative;
  height:34px;
  border-radius:10px;
  background:#f3f4f6;
  overflow:hidden;
  border:1px solid var(--line);
}
.gantt-bar{
  position:absolute;
  top:5px;
  height:24px;
  border-radius:10px;
  display:flex;
  align-items:center;
  padding:0 10px;
  font-weight:900;
  font-size:12px;
  color:#fff;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.gantt-bar-label{ opacity:.95; }

/* Etiqueta afuera cuando no entra en la barra */
.gantt-bar-out{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  left: calc(var(--bar-left, 0px) + var(--bar-width, 0px) + 10px);
  font-weight:900;
  font-size:12px;
  color: var(--text);
  white-space:nowrap;
  pointer-events:none;
}

.gantt-bar.done{ background:#22c55e; }
.gantt-bar.doing{ background: var(--brand2); }
.gantt-bar.pend{ background:#f59e0b; }
.gantt-bar.block{ background:#ef4444; }

@media (max-width: 1024px){
  .gantt-axis, .gantt-row{ grid-template-columns: 1fr; }
  .gantt-axis-left{ display:none; }
}

/* Línea vertical de HOY */
.gantt-wrap{ position: relative; }
.gantt-today{
  position:absolute;
  top:0;
  bottom:0;

  /* timeline arranca después de la columna izquierda sticky */
  left: calc(var(--leftcol, 360px) + (var(--today-px, 0) * 1px));

  width:2px;
  background:#ef4444;
  opacity:.75;
  pointer-events:none;
  z-index: 2;
}

/* Badge "Atrasada" (sutil) */
.g-badge-bad{
  border-color:#fecaca;
  color:#b91c1c;
  background:#fff;
}

/* Motivo de bloqueo (solo texto, no rompe layout) */
.g-block-reason{
  color:#b91c1c;
  font-weight:900;
  font-size:12px;
  max-width: 420px;
}
.g-block-line{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height: 1.2;
}
@media (max-width: 1024px){
  .g-block-reason{ max-width: 100%; }
}

/* Borde sutil de barra si está atrasada */
.gantt-bar.overdue{
  box-shadow: 0 0 0 2px rgba(185, 28, 28, .25);
}

.gantt-track::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:2px;
  height:100%;
  background: var(--line);
}

.gantt-scale::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:2px;
  height:100%;
  background: var(--line);
}

/* =========================
   5) Swimlanes (Etapas)
   ========================= */
.gantt-lane{
  display:grid;
  grid-template-columns: 360px 1fr;
  border-bottom:1px solid var(--line);
  background:#f8fafc;
}
.gantt-lane-title{
  grid-column: 1 / -1;
  padding:10px 14px;
  font-weight:900;
  color: var(--text);
}

@media (max-width: 1024px){
  .gantt-lane{ grid-template-columns: 1fr; }
}

/* Dependencias: waiting */
.g-wait{
  color: var(--muted);
  font-weight:900;
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 420px;
}
@media (max-width: 1024px){
  .g-wait{ max-width: 100%; }
}

/* Si está esperando deps, hacemos la barra más “apagada” (sin cambiar paleta) */
.gantt-bar.waiting{
  opacity: .85;
}

/* =========================
   8) Exportar PDF (print)
   ========================= */
.g-btn{
  height:34px;
  border-radius:12px;
  padding:0 14px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  cursor:pointer;
  color: var(--brand2);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.g-btn:hover{ filter: brightness(0.98); }

.g-end{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  color: var(--muted);
  font-weight:900;
  font-size:12px;
}

@media print{
  .topbar,
  .g-btn,
  .icon,
  a.link{
    display:none !important;
  }

  body{ background:#fff !important; }
  .page{
    max-width:none !important;
    margin:0 !important;
    padding:0 !important;
  }
  .card{
    box-shadow:none !important;
    border:none !important;
    border-radius:0 !important;
  }

  /* Evitar cortes feos */
  .gantt-row,
  .gantt-lane{
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* =========================
   FIX: Gantt largo (meses) -> scroll horizontal + ancho real
   ========================= */

.gantt-wrap{
  overflow-x: auto;               /* scroll horizontal cuando hay muchos días */
  -webkit-overflow-scrolling: touch;
}

/* El panel derecho (timeline) se hace "más ancho" según días */
.gantt-axis-right,
.gantt-right{
  overflow: visible;
}

/* Timeline con ancho mínimo calculado (días * pxPorDía) */
.gantt-scale,
.gantt-track{
  min-width: var(--timeline-px, 900px);
}

.gantt-scale,
.gantt-track{
  width: var(--timeline-px, 900px); /* ancho real, no solo mínimo */
}

/* Mantener la columna izquierda visible cuando scrolleas horizontal */
.gantt-axis-left,
.gantt-left{
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

/* Header sticky también */
.gantt-axis{
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Para que el header izquierdo no quede transparente */
.gantt-axis-left{
  background: #f8fafc;
}

/* Scrollbar discreta (sin cambiar look general) */
.gantt-wrap::-webkit-scrollbar{ height: 10px; }
.gantt-wrap::-webkit-scrollbar-thumb{
  background: rgba(15,23,42,.12);
  border-radius: 999px;
}
.gantt-wrap::-webkit-scrollbar-track{
  background: rgba(15,23,42,.05);
  border-radius: 999px;
}

/* =========================
   HISTORIAL DEL CRONOGRAMA
   ========================= */

.hist-card{
  margin-top: 16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  padding:12px 14px;
}

.hist-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap: wrap;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}

.hist-title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

.hist-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.hist-filter{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  font-size:12px;
  color: var(--brand2);
  text-decoration:none;
}
.hist-filter:hover{ filter: brightness(0.98); }
.hist-filter.active{
  background: rgba(31,106,165,.10);
  border-color: rgba(31,106,165,.25);
}

.hist-list{
  padding-top:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.hist-row{
  display:grid;
  grid-template-columns: 90px 120px 1fr;
  gap:10px;
  align-items:flex-start;
  padding:10px 10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.hist-ts{
  font-weight:900;
  color: var(--muted);
  font-size:12px;
}

.hist-tag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:24px;
  padding:0 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  border:1px solid var(--line);
  background:#fff;
  color: var(--muted);
}

.hist-tag.ok{ border-color:#bbf7d0; color:#166534; background:#f0fdf4; }
.hist-tag.danger{ border-color:#fecaca; color:#991b1b; background:#fef2f2; }
.hist-tag.warn{ border-color:#fde68a; color:#92400e; background:#fffbeb; }
.hist-tag.info{ border-color:#bfdbfe; color:#1e40af; background:#eff6ff; }
.hist-tag.muted{ border-color: var(--line); color: var(--muted); background:#fff; }

.hist-body .hist-main{
  font-weight:900;
  color: var(--text);
}
.hist-sub{
  margin-top:2px;
  font-size:12px;
  color: var(--muted);
  font-weight:800;
}
.hist-by{
  margin-top:4px;
  font-size:12px;
  color: var(--muted);
}

@media (max-width: 820px){
  .hist-row{
    grid-template-columns: 1fr;
    gap:6px;
  }
}

/* =========================
   GANTT MASTER - layout por tarjetas
   ========================= */

.master-stack{
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.master-card-h{
  font-size: 18px;
  padding: 12px 14px;
}

.master-card-b{
  padding: 12px 14px 14px;
}

.master-mini{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Botón global (arriba de tabla Proyectos) */
.quick-actions{
  display:flex;
  justify-content:flex-end;
  margin-bottom: 10px;
}

/* =========================
   MOBILE: Topbar compacta
   ========================= */
@media (max-width: 640px){
  .topbar{
    height:auto;
    padding:12px 12px;
    align-items:flex-start;
    flex-direction:column;
    gap:10px;
  }

  .brand{
    width:100%;
    gap:10px;
  }

  .brand-badge{
    width:46px;
    height:34px;
  }

  .brand-title{
    font-size:14px;
    line-height:1.2;
  }

  .topbar-right{
    width:100%;
    justify-content:space-between;
    gap:10px;
  }

  /* opcional: ocultar pill en móvil para ganar espacio */
  .topbar-right .pill{
    display:none;
  }
}

/* =========================
   MOBILE: tablas scrolleables
   ========================= */
.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
  border:1px solid var(--line);
  border-radius:12px;
}

.table-wrap .table{
  min-width: 900px; /* fuerza scroll en móvil */
}

@media (max-width: 640px){
  .table th, .table td{
    padding:10px 8px;
    font-size:13px;
  }
}

/* =========================
   MOBILE: anti-desborde global
   ========================= */
img, table { max-width: 100%; }

@media (max-width: 640px){
  .card-h{ font-size: 18px; padding: 14px 14px; }
  .card-b{ padding: 12px 14px 14px; }
}

@media (max-width: 640px){
  .topbar-right{
    flex-wrap: wrap;
  }
  .topbar-right .link{
    padding: 6px 0;
  }
}

/* =========================
   HOME (mover desde home.html)
   ========================= */
.home-wrap{ max-width: 1100px; margin: 18px auto; padding: 0 14px; }

.hero{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.hero h1{ margin:0; font-size:26px; }
.hero p{ margin:6px 0 0; color:var(--muted); font-weight:600; }

.grid-tools{
  margin-top:18px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:18px;
}

.tool{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:140px;
}
.tool .t-title{ font-weight:900; font-size:18px; margin:0; }
.tool .t-desc{ color:var(--muted); font-weight:600; margin:0; line-height:1.35; }
.tool .t-actions{ margin-top:auto; display:flex; gap:10px; align-items:center; }

.btnx{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  color: var(--brand2);
  cursor:pointer;
  text-decoration:none;
}
.btnx.primary{
  background: var(--brand2);
  color:#fff;
  border-color: transparent;
}
.btnx:hover{ filter: brightness(0.98); text-decoration:none; }

.tag-admin{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  color:#0b1220;
  background:#f1f5f9;
  border:1px solid var(--line);
  border-radius:999px;
  padding:8px 12px;
  white-space:nowrap;
}

/* MOBILE home */
@media (max-width: 1024px){
  .grid-tools{ grid-template-columns: 1fr; }
  .hero{ flex-direction:column; align-items:flex-start; }
}

/* MOBILE extra: botones full width en home */
@media (max-width: 640px){
  .hero{ padding: 14px; }
  .hero h1{ font-size: 20px; }
  .btnx.primary{ width:100%; }
  .tool{ min-height: auto; }
  .tool .t-actions{ flex-wrap: wrap; }
  .tool .t-actions .btnx{ width:100%; }
}

/* =========================
   ADMIN USERS (mobile-friendly)
   ========================= */

.admin-user-form{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  align-items:end;
}

/* inputs del admin (reemplaza el inline sin cambiar look) */
.admin-user-form input[type="text"],
.admin-user-form input[type="password"],
.admin-user-form input:not([type]){
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
}

/* MOBILE: form en 1 columna */
@media (max-width: 820px){
  .admin-user-form{
    grid-template-columns: 1fr;
  }
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 12px;
}

.chk {
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =========================
   FIX CHECKBOXES (Admin Visibilidad)
   ========================= */

.chk input[type="checkbox"]{
  /* si algún reset los dejó sin "look", esto los revive */
  appearance: auto;
  -webkit-appearance: checkbox;
  -moz-appearance: checkbox;

  /* tamaño visible y consistente */
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;

  /* color moderno (Chrome/Edge/Firefox) */
  accent-color: var(--brand2);

  /* por las dudas: evita que queden invisibles por opacidad */
  opacity: 1;
  visibility: visible;
}

/* =========================
   PROYECTOS: filtros + badge solicitante
   ========================= */

.filters{
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.filters-row{
  display:grid;
  grid-template-columns: 1fr 1fr auto;
  gap:10px;
  align-items:end;
}

.f-field input{
  width:100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background:#fff;
}
.f-field input:focus{
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}

.f-actions{
  display:flex;
  gap:10px;
  align-items:center;
}

@media (max-width: 820px){
  .filters-row{ grid-template-columns: 1fr; }
  .f-actions .btn{ width: 100%; }
}

.namecell{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}

.badge-initials{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight: 1000;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(15,23,42,.10);
  color:#fff;
  flex: 0 0 auto;
  user-select:none;
}

.meta-row{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  margin: 8px 0 12px;
}

.meta-edit-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  align-items:end;
}
.meta-edit-grid input{
  width:100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background:#fff;
}
.meta-edit-grid input:focus{
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}

@media (max-width: 820px){
  .meta-edit-grid{ grid-template-columns: 1fr; }
}

/* =========================
   Textarea (admin meta)
   ========================= */
.ta{
  width:100%;
  min-height: 72px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background:#fff;
  font-family: inherit;
}
.ta:focus{
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}

/* =========================
   NOTIFICACIONES (Topbar)
   ========================= */

.notif-btn{
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}
.notif-btn:hover{ filter: brightness(0.98); }

.notif-ico{ font-size: 16px; line-height: 1; }

.notif-badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color:#fff;
  font-weight: 900;
  font-size: 11px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 2px solid #f8fafc; /* se integra con topbar */
}

/* Dropdown panel */
.notif-panel{
  position:absolute;
  top: 56px;
  right: 18px;
  width: 460px;
  max-width: calc(100vw - 28px);
  background:#fff;
  border:1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow:hidden;
  display:none;
  z-index: 9999;
}

.notif-panel.open{ display:block; }

.notif-head{
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}
.notif-head-title{ font-weight: 900; color: var(--text); }
.notif-head-sub{ font-weight: 800; color: var(--muted); font-size: 12px; }

.notif-list{
  max-height: 380px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.notif-empty{
  padding: 14px 12px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.notif-item{
  display:block;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration:none;
  color: inherit;
}
.notif-item:hover{ background:#f8fafc; text-decoration:none; }
.notif-item:last-child{ border-bottom:none; }

.notif-item.unread{ background: rgba(31,106,165,.06); }
.notif-item.read{ opacity: .92; }

.notif-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.notif-title{
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.notif-body{
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
}

.notif-meta{
  margin-top: 8px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

.notif-foot{
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background:#fff;
}

/* Level pill */
.notif-pill{
  border:1px solid var(--line);
  border-radius:999px;
  padding: 3px 10px;
  font-weight: 900;
  font-size: 11px;
  text-transform: lowercase;
}
.notif-pill.info{ background:#eff6ff; border-color:#bfdbfe; color:#1e40af; }
.notif-pill.warn{ background:#fffbeb; border-color:#fde68a; color:#92400e; }
.notif-pill.danger{ background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.notif-pill.ok{ background:#f0fdf4; border-color:#bbf7d0; color:#166534; }

/* Mobile tweak */
@media (max-width: 640px){
  .notif-panel{
    right: 12px;
    width: calc(100vw - 24px);
  }
}
