/* ============================================================
   CP COMERCIAL — UI FUTURISTA 2030
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #F0F2F7;
  color: #0F1623;
  height: 100%;
  font-size: 19px; /* Aumentado de 17px a 19px para mejorar significativamente la legibilidad general */
  -webkit-font-smoothing: antialiased;
}

:root {
  --sidebar-w: 260px; /* Ligero ajuste para compensar el tamaño de la letra */
  --accent: #4F6EF7;
  --accent-2: #7C3AED;
  --accent-glow: rgba(79,110,247,.18);
  --surface: #FFFFFF;
  --surface-2: #F7F8FC;
  --border: rgba(0,0,0,.07);
  --border-strong: rgba(0,0,0,.12);
  --text-main: #0F1623;
  --text-sub: #4B5572;
  --text-muted: #475569; /* Antes #8F96A9 (~2.9:1 de contraste, por debajo del mínimo WCAG AA). Ahora ~7.1:1, nivel AAA — más cómodo para lectura prolongada */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  --shadow-accent: 0 8px 24px rgba(79,110,247,.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --color-blue-50:#EEF2FF;   --color-blue-800:#1E3A8A;
  --color-purple-50:#F5F3FF; --color-purple-800:#4C1D95;
  --color-coral-50:#FFF1F2;  --color-coral-800:#881337;
  --color-teal-50:#F0FDF9;   --color-teal-800:#134E4A;
  --color-amber-50:#FFFBEB;  --color-amber-800:#78350F;
  --color-green-50:#F0FDF4;  --color-green-800:#14532D;
  --color-gray-50:#F8FAFC;   --color-gray-800:#1E293B;
  --color-red-50:#FFF1F2;    --color-red-800:#881337;

  --row-hover: #F5F7FF;
  --row-hover-cell: #EEF2FF;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 22px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text-main);
  font-size: 17.5px; font-weight: 600; /* Aumentado de 15.5px */
  transition: all .15s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-block { width: 100%; justify-content: center; }
.btn-primary {
  background: linear-gradient(135deg, #4F6EF7 0%, #6B46F5 100%);
  border-color: transparent; color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: linear-gradient(135deg, #3D5CE8 0%, #5B36E5 100%); box-shadow: 0 10px 30px rgba(79,110,247,.35); }
.btn-danger { background: linear-gradient(135deg, #EF4444, #DC2626); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,.3); }
.btn-danger:hover { box-shadow: 0 8px 20px rgba(239,68,68,.4); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-sub); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; transform: none; }
.btn svg { flex-shrink: 0; }
.row-actions button svg { display: block; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #EBF0FA 0%, #F0F2F7 50%, #EDE9FF 100%);
  padding: 20px; position: relative; overflow: hidden;
}
.login-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 600px 500px at 90% 0%, rgba(79,110,247,.1) 0%, transparent 65%),
    radial-gradient(ellipse 400px 400px at 5% 100%, rgba(124,58,237,.08) 0%, transparent 65%);
}
.login-screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(79,110,247,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,110,247,.04) 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-card {
  background: rgba(255,255,255,.85); backdrop-filter: blur(20px);
  border: 1.5px solid rgba(255,255,255,.9);
  border-radius: var(--radius-xl); padding: 40px 36px;
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(79,110,247,.12), 0 4px 16px rgba(0,0,0,.06);
  position: relative; z-index: 1;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand-mark {
  width: 66px; height: 66px; border-radius: 18px;
  background: linear-gradient(135deg, #4F6EF7, #7C3AED); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; margin: 0 auto 18px;
  box-shadow: 0 8px 24px rgba(79,110,247,.4);
}
.login-brand-mark.small { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; box-shadow: none; }
/* Logo: el PNG trae su propio fondo cuadrado (sin transparencia) — el
   border-radius aquí recorta esas esquinas para que se vea como una
   insignia redondeada, no como un cuadrado negro con el ícono adentro. */
.login-logo {
  display: block; width: 120px; height: 120px; object-fit: cover;
  margin: 0 auto 18px; border-radius: 26px;
  box-shadow: 0 10px 28px rgba(15,22,35,.28);
  animation: loginLogoAparece .5s cubic-bezier(.4,0,.2,1) both;
}
@keyframes loginLogoAparece {
  from { opacity: 0; transform: translateY(-8px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-brand h1 { font-size: 30px; font-weight: 800; color: #0F1623; margin: 0 0 6px; letter-spacing: -.4px; } /* Aumentado de 26px */
.login-brand p { font-size: 18px; color: var(--text-muted); margin: 0; } /* Aumentado de 16px */
.login-form { display: flex; flex-direction: column; gap: 4px; }
.login-form label { font-size: 16.5px; font-weight: 600; color: var(--text-sub); margin-top: 14px; } /* Aumentado de 14.5px */
.login-form input {
  padding: 14px 16px; font-size: 18px; border-radius: 10px; /* Aumentado de 16px */
  background: #F7F8FC; border: 1.5px solid var(--border-strong); color: var(--text-main);
  transition: all .15s;
}
.login-form input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-glow); }
.login-form .btn { margin-top: 24px; padding: 14px; font-size: 19px; font-weight: 700; } /* Aumentado de 17px */
.login-error {
  color: #991B1B; background: #FFF1F2; border: 1.5px solid #FECDD3;
  padding: 12px 16px; border-radius: 10px; font-size: 17px; margin: 10px 0 0; text-align: center;
} /* Aumentado de 15px */
.login-hint { text-align: center; font-size: 16px; color: var(--text-muted); margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); } /* Aumentado de 14px */
.login-footer-badges { display: flex; justify-content: center; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.login-footer-badge { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 15.5px; } /* Aumentado de 13.5px */

/* ============================================================
   LAYOUT APP
   ============================================================ */
.app { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0F1623 0%, #1A2035 100%);
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: none;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 18px; font-weight: 800; font-size: 18px; color: #fff; /* Aumentado de 16px */
  border-bottom: 1px solid rgba(255,255,255,.07);
  letter-spacing: -.2px;
}
.tabs { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; flex: 1; }
.tab-btn {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 16px; border-radius: 10px; border: none;
  background: transparent; color: rgba(255,255,255,.5);
  font-size: 17.5px; font-weight: 500; /* Aumentado de 15.5px */
  transition: all .15s cubic-bezier(.4,0,.2,1);
}
.tab-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.tab-btn.active {
  background: linear-gradient(135deg, rgba(79,110,247,.35), rgba(124,58,237,.25));
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79,110,247,.4);
}
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.07); }
.mobile-topbar { display: none; }
.btn-hamburguesa { display: none; }
.btn-cerrar-menu {
  display: none; margin-left: auto; background: transparent; border: none;
  color: rgba(255,255,255,.6); font-size: 20px; line-height: 1; cursor: pointer;
  width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 8px;
}
.btn-cerrar-menu:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu-overlay { display: none; }
.btn-limpiar-filtros-movil { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 6px; margin-bottom: 6px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #4F6EF7, #7C3AED); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-info span:first-child { font-size: 17px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* Aumentado de 15px */
.user-role-badge { font-size: 14.5px; color: rgba(255,255,255,.4); text-transform: capitalize; } /* Aumentado de 13px */

.main { flex: 1; overflow-y: auto; padding: 28px 32px 48px; background: #F0F2F7; }
.view { display: none; }
.view.active { display: block; }

.view-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.view-header h2 { font-size: 32px; font-weight: 800; color: var(--text-main); margin: 0 0 4px; letter-spacing: -.5px; } /* Aumentado de 28px */
.view-subtitle { font-size: 17.5px; color: var(--text-muted); margin: 0; } /* Aumentado de 15.5px */

/* ============================================================
   STAT CARDS — con sombra de color
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 18px 20px; border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all .2s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #4F6EF7, #7C3AED);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(79,110,247,.15); }
.stat-card .stat-label { font-size: 15.5px; color: var(--text-muted); margin: 0 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; } /* Aumentado de 14px */
.stat-card .stat-value { font-size: 36px; font-weight: 800; margin: 0; color: var(--text-main); letter-spacing: -.5px; } /* Aumentado de 32px */
.stat-card .stat-value.danger { color: #EF4444; }

/* ============================================================
   MÓDULO PROYECTOS — la tabla llena el espacio vertical real
   disponible (en vez de adivinar con vh), y las 4 tarjetas de
   arriba son más compactas para dejarle más alto a la tabla.
   ============================================================ */
#view-proyectos.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 76px); /* 76px = padding vertical de .main (28px arriba + 48px abajo) */
}
#view-proyectos .view-header { margin-bottom: 10px; flex-shrink: 0; }
#view-proyectos .proyectos-vista-tabs { margin-bottom: 10px; flex-shrink: 0; }
#view-proyectos .toolbar { margin-bottom: 10px; flex-shrink: 0; }
#view-proyectos #proyectos-stats { flex-shrink: 0; }
#view-proyectos .table-wrap,
#view-proyectos .kanban-wrap {
  flex: 1 1 auto; min-height: 0; max-height: none;
}

.proyectos-fecha-personalizada { display: flex; gap: 8px; }
.proyectos-fecha-personalizada input {
  padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 16px; color: var(--text-main);
  box-shadow: var(--shadow-sm); min-width: 145px;
}
.proyectos-fecha-personalizada input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Tarjetas de stats de Proyectos — más compactas que las de Métricas,
   para ganarle espacio vertical a la tabla de abajo */
#proyectos-stats.stats-grid { margin-bottom: 12px; }
#proyectos-stats .stat-card { padding: 12px 16px; }
#proyectos-stats .stat-label { font-size: 12px; margin-bottom: 4px; }
#proyectos-stats .stat-value { font-size: 22px; }

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input {
  width: 100%; padding: 12px 14px 12px 40px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 18px; color: var(--text-main); /* Aumentado de 16px */
  box-shadow: var(--shadow-sm); transition: all .15s;
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.toolbar select {
  padding: 12px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  font-size: 17.5px; color: var(--text-main); min-width: 175px; /* Aumentado de 15.5px */
  box-shadow: var(--shadow-sm);
}
.toolbar select:focus { outline: none; border-color: var(--accent); }

/* ── Filtro de selección múltiple (estilo Excel) — Estado/Prioridad/Pago ── */
.filtro-multi { position: relative; }
.filtro-multi-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  font-size: 15.5px; font-family: inherit; color: var(--text-main); min-width: 175px;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.filtro-multi-btn:hover { border-color: var(--accent); }
.filtro-multi-btn svg { flex-shrink: 0; color: var(--text-muted); }
.filtro-multi-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  min-width: 230px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px;
}
.filtro-multi-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 14.5px; color: var(--text-main); cursor: pointer;
}
.filtro-multi-item:hover { background: var(--surface-2); }
.filtro-multi-item input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: var(--accent); }

/* ============================================================
   TABLA — futurista con hover de color
   ============================================================ */
.table-wrap {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); overflow: auto; max-height: 68vh;
  box-shadow: var(--shadow-md);
}
table.data-table { border-collapse: separate; border-spacing: 0; font-size: 17.5px; white-space: nowrap; width: 100%; } /* Aumentado de 15.5px */
table.data-table th, table.data-table td { padding: 16px 18px; border-bottom: 1px solid #F0F2F7; text-align: left; transition: background .1s; }
table.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F7F8FC; color: var(--text-muted);
  font-weight: 700; font-size: 14.5px; text-transform: uppercase; letter-spacing: .04em; /* antes .06em — combinado con mayúsculas y gris diluía el texto */
  border-bottom: 2px solid var(--border-strong);
}
table.data-table tbody tr { transition: background .1s; }

/* Filas alternadas — ayuda a seguir cada fila horizontalmente sin perderse */
table.data-table tbody tr:nth-child(even) { background: #E9EDF6; }
table.data-table tbody tr:nth-child(even) td.sticky-col,
table.data-table tbody tr:nth-child(even) td.acciones-col { background: #E9EDF6; }
table.data-table tbody tr:hover { background: var(--row-hover); }
table.data-table tbody tr:hover td { background: var(--row-hover); }
table.data-table tbody td:hover { background: var(--row-hover-cell) !important; }
table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.data-table td.center, table.data-table th.center { text-align: center; }

table.data-table th.sticky-col, table.data-table td.sticky-col {
  position: sticky; left: 0; background: var(--surface); z-index: 1;
  box-shadow: 2px 0 8px rgba(0,0,0,.06); font-weight: 700;
  width: 400px; min-width: 400px; max-width: 400px;
  overflow: hidden; text-overflow: ellipsis;
}
table.data-table thead th.sticky-col { background: #F7F8FC; z-index: 3; }
table.data-table tbody tr:hover td.sticky-col { background: var(--row-hover); }

table.data-table th.acciones-col, table.data-table td.acciones-col {
  position: sticky; left: 400px; background: var(--surface); z-index: 1;
  box-shadow: 2px 0 8px rgba(0,0,0,.04);
  width: 92px; min-width: 92px; max-width: 92px;
}
table.data-table thead th.acciones-col { background: #F7F8FC; z-index: 3; }
table.data-table tbody tr:hover td.acciones-col { background: var(--row-hover); }
.data-table tbody tr.fila-activa td { background: var(--row-hover-cell) !important; }
.data-table tbody tr.fila-activa td.sticky-col,
.data-table tbody tr.fila-activa td.acciones-col { background: var(--row-hover-cell) !important; }

/* ============================================================
   BADGES — más grandes y modernos
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 15.5px; font-weight: 600; padding: 6px 16px; /* Aumentado de 13.5px */
  border-radius: 999px; white-space: nowrap; letter-spacing: .01em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.badge-blue   { background: var(--color-blue-50);   color: var(--color-blue-800); }
.badge-purple { background: var(--color-purple-50); color: var(--color-purple-800); }
.badge-coral  { background: var(--color-coral-50);  color: var(--color-coral-800); }
.badge-teal   { background: var(--color-teal-50);   color: var(--color-teal-800); }
.badge-amber  { background: var(--color-amber-50);  color: var(--color-amber-800); }
.badge-green  { background: var(--color-green-50);  color: var(--color-green-800); }
.badge-gray   { background: var(--color-gray-50);   color: var(--color-gray-800); }
.badge-red    { background: var(--color-red-50);    color: var(--color-red-800); }

/* ============================================================
   ROW ACTIONS
   ============================================================ */
.row-actions { display: flex; gap: 4px; align-items: center; justify-content: center; }
.row-actions button {
  background: none; border: none; padding: 6px 8px; color: var(--text-muted);
  border-radius: var(--radius-sm); transition: all .12s;
}
.row-actions button:hover { background: var(--color-blue-50); color: var(--accent); transform: scale(1.1); }
.row-actions button.danger:hover { background: var(--color-red-50); color: #EF4444; transform: scale(1.1); }
.row-actions button[disabled] { opacity: .3; cursor: not-allowed; }
.dias-retraso { color: #EF4444; font-weight: 700; }
.dias-ok { color: #059669; font-weight: 600; }
.empty-row td { text-align: center; color: var(--text-muted); padding: 48px; font-size: 18px; } /* Aumentado de 16px */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }

/* ============================================================
   MODALES — glassmorphism
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,20,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; backdrop-filter: blur(8px);
}
.modal-overlay[hidden], [hidden] { display: none !important; }
.modal {
  background: rgba(255,255,255,.97); backdrop-filter: blur(20px);
  border-radius: var(--radius-xl); width: 100%; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.2), 0 0 0 1.5px rgba(255,255,255,.8);
  border: 1px solid var(--border);
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 620px; } /* Tamaño intermedio — formularios cortos que necesitan más aire que modal-sm (ej. costo adicional) */
.modal-lg { max-width: 820px; } /* Ajustado espacio horizontal para textos grandes */
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 22px; font-weight: 800; color: var(--text-main); letter-spacing: -.3px; } /* Aumentado de 19px */
.modal-close { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); padding: 6px; border-radius: 8px; }
.modal-close:hover { background: var(--color-red-50); color: #EF4444; }
.modal-body { padding: 24px 26px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* Formularios dentro de modal */
.form-grid fieldset { border: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid legend { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); padding: 0 0 10px; margin-bottom: 4px; border-bottom: 2px solid var(--color-blue-50); width: 100%; grid-column: 1/-1; } /* Aumentado de 13px */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1/-1; }
.field-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field label { font-size: 16.5px; font-weight: 600; color: var(--text-sub); } /* Aumentado de 14.5px */
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  padding: 12px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 17.5px; color: var(--text-main); /* Aumentado de 15.5px */
  background: var(--surface-2); transition: all .15s;
}
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.field input:disabled { background: #F0F2F7; color: var(--text-muted); }
.field-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.field textarea { resize: vertical; }
.file-or-link-row { display: flex; align-items: center; gap: 10px; }
.file-or-link-row input[type="file"] { flex: 1; padding: 9px 11px; font-size: 16px; } /* Aumentado de 14px */
.file-or-link-row span { font-size: 15.5px; color: var(--text-muted); flex-shrink: 0; } /* Aumentado de 13.5px */
.file-or-link-row input[type="text"] { flex: 1; }

/* ============================================================
   TOAST — moderno
   ============================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0F1623; color: #fff; padding: 15px 26px; border-radius: 12px;
  font-size: 18px; font-weight: 600; z-index: 200; /* Aumentado de 16px */
  box-shadow: 0 12px 40px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.08);
  letter-spacing: -.1px;
}
.toast.success::before { content: "✓ "; color: #4ADE80; font-weight: 800; }
.toast.error::before { content: "✕ "; color: #F87171; font-weight: 800; }

/* ============================================================
   PANEL EXPEDIENTE
   ============================================================ */
.panel-expediente {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(880px, 50vw); /* Más ancho que antes (era 560px fijo), pero nunca supera la mitad de la pantalla — en ventanas angostas cede a los breakpoints de tablet/móvil de más abajo */
  background: rgba(255,255,255,.97); backdrop-filter: blur(20px);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 50; box-shadow: -8px 0 40px rgba(0,0,0,.1);
}
.panel-expediente.abierto { transform: translateX(0); }
.panel-exp-header { padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-exp-header-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.panel-exp-nombre { font-size: 21px; font-weight: 800; color: var(--text-main); line-height: 1.3; letter-spacing: -.3px; } /* Aumentado de 18px */
.panel-exp-cliente { font-size: 16.5px; color: var(--text-muted); margin-top: 3px; } /* Aumentado de 14.5px */
.panel-exp-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-cerrar-panel { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); padding: 6px; border-radius: 8px; flex-shrink: 0; }
.btn-cerrar-panel:hover { background: var(--color-red-50); color: #EF4444; }
.panel-exp-body { overflow-y: auto; flex: 1; padding: 0 4px; }
.panel-backdrop { display: none; position: fixed; inset: 0; z-index: 49; background: rgba(10,12,20,.3); backdrop-filter: blur(2px); }
.panel-backdrop.activo { display: none; }

.exp-seccion { border-bottom: 1px solid #F0F2F7; }
.exp-seccion-header { padding: 15px 24px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background .1s; }
.exp-seccion-header:hover { background: var(--surface-2); }
.exp-seccion-icono { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.exp-seccion-titulo { font-size: 17.5px; font-weight: 700; color: var(--text-main); flex: 1; } /* Aumentado de 15.5px */
.exp-seccion-count { font-size: 14.5px; color: var(--text-muted); background: var(--surface-2); padding: 2px 10px; border-radius: 999px; font-weight: 600; } /* Aumentado de 13px */
.exp-chevron { color: var(--text-muted); font-size: 16px; transition: transform .2s; display: inline-block; }
.exp-chevron.abierto { transform: rotate(180deg); }
.exp-seccion-body { padding: 14px 24px 18px; background: #FAFBFC; display: none; }
.exp-seccion-body.abierto { display: block; }
.exp-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.exp-info-item label { font-size: 13.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; } /* Aumentado de 12px */
.exp-info-item span { font-size: 17.5px; color: var(--text-main); font-weight: 600; } /* Aumentado de 15.5px */
.exp-visita-card { background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.exp-visita-card:last-child { margin-bottom: 0; }
.exp-visita-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.exp-visita-meta .fecha { font-size: 15.5px; color: var(--text-muted); } /* Aumentado de 13.5px */
.exp-fotos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 8px; }
.exp-foto-thumb { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--color-blue-50); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: opacity .15s; }
.exp-foto-thumb:hover { opacity: .85; }
.exp-foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.exp-foto-mas { background: #0F1623; color: #fff; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; border-radius: 8px; aspect-ratio: 1; cursor: pointer; } /* Aumentado de 15px */
.exp-video-btn { background: linear-gradient(135deg, #1E3A8A, #1E40AF); border: none; border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; margin-top: 8px; cursor: pointer; width: 100%; transition: all .15s; }
.exp-video-btn:hover { background: linear-gradient(135deg, #1D4ED8, #2563EB); transform: translateY(-1px); }
.exp-video-play { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; flex-shrink: 0; }
.exp-video-info .v-nombre { font-size: 16.5px; font-weight: 700; color: #fff; } /* Aumentado de 14.5px */
.exp-video-info .v-sub { font-size: 13.5px; color: rgba(255,255,255,.6); } /* Aumentado de 12px */
.exp-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 17px; } /* Aumentado de 15px */
.badge-teal { background: var(--color-teal-50); color: var(--color-teal-800); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox { display: none; position: fixed; inset: 0; z-index: 200; background: rgba(10,12,20,.96); backdrop-filter: blur(10px); flex-direction: column; align-items: center; justify-content: center; }
.lightbox.activo { display: flex; }
.lightbox-media { position: relative; max-width: 90vw; max-height: 80vh; display: flex; align-items: center; justify-content: center; }
.lightbox-media img { max-width: 90vw; max-height: 78vh; border-radius: 12px; object-fit: contain; display: block; box-shadow: 0 32px 80px rgba(0,0,0,.5); }
.lightbox-media video { max-width: 90vw; max-height: 78vh; border-radius: 12px; display: block; }
.lightbox-btn-cerrar { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.12); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.15); border-radius: 50%; width: 44px; height: 44px; color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-btn-cerrar:hover { background: rgba(255,255,255,.25); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.15); border-radius: 50%; width: 50px; height: 50px; color: #fff; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; z-index: 201; }
.lightbox-nav:hover { background: rgba(255,255,255,.25); }
.lightbox-nav.prev { left: -64px; }
.lightbox-nav.next { right: -64px; }
.lightbox-nav:disabled { opacity: .25; cursor: default; }
.lightbox-footer { margin-top: 16px; display: flex; align-items: center; gap: 16px; }
.lightbox-contador { color: rgba(255,255,255,.5); font-size: 17px; } /* Aumentado de 15px */
.lightbox-dots { display: flex; gap: 6px; }
.lightbox-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.3); cursor: pointer; border: none; transition: background .15s; }
.lightbox-dot.activo { background: #fff; }
.lightbox-tipo-badge { background: rgba(255,255,255,.12); color: rgba(255,255,255,.8); font-size: 15.5px; padding: 5px 14px; border-radius: 999px; backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.15); } /* Aumentado de 13.5px */

/* ============================================================
   CALENDARIO
   ============================================================ */
.cal-top-bar{display:flex;align-items:center;gap:10px;margin-bottom:14px;flex-wrap:wrap}
.cal-nav-mes{display:flex;align-items:center;gap:6px}
.cal-nav-btn{width:36px;height:36px;border-radius:var(--radius-sm);border:1.5px solid var(--border-strong);background:var(--surface);cursor:pointer;font-size:18px;color:var(--text-sub);display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow-sm);transition:all .15s}
.cal-nav-btn:hover{background:var(--surface-2);transform:translateY(-1px);box-shadow:var(--shadow-md)}
.cal-mes-label{font-size:22px;font-weight:800;color:var(--text-main);min-width:200px;text-align:center;letter-spacing:-.3px} /* Aumentado de 19px */
.cal-btn-hoy{padding:8px 18px;border-radius:var(--radius-sm);border:1.5px solid var(--border-strong);background:var(--surface);font-size:16px;font-weight:600;color:var(--text-sub);cursor:pointer;box-shadow:var(--shadow-sm)} /* Aumentado de 14px */
.cal-vista-tabs{display:flex;gap:2px;background:#E4E7F0;border-radius:10px;padding:3px}
.cal-vista-tab{padding:8px 16px;border-radius:8px;border:none;background:transparent;font-size:16px;font-weight:600;color:var(--text-muted);cursor:pointer;transition:all .15s} /* Aumentado de 14px */
.cal-vista-tab.activo{background:#fff;color:var(--text-main);box-shadow:var(--shadow-sm)}
.cal-filtros-row{display:flex;gap:6px;margin-bottom:14px;flex-wrap:wrap;align-items:center}
.cal-filtro-label{font-size:14px;color:var(--text-muted);font-weight:700;text-transform:uppercase;letter-spacing:.05em} /* Aumentado de 12.5px */
.cal-tipo-btn{padding:8px 14px;border-radius:999px;border:1.5px solid var(--border-strong);background:var(--surface);font-size:15.5px;font-weight:600;color:var(--text-sub);cursor:pointer;display:flex;align-items:center;gap:5px;box-shadow:var(--shadow-sm);transition:all .15s} /* Aumentado de 13.5px */
.cal-tipo-btn.activo{border-color:var(--cc);background:color-mix(in srgb,var(--cc) 10%,white);color:var(--cc)}
.cal-tec-btn{padding:8px 14px;border-radius:999px;border:1.5px solid var(--border-strong);background:var(--surface);font-size:15.5px;font-weight:600;color:var(--text-sub);cursor:pointer;box-shadow:var(--shadow-sm);transition:all .15s} /* Aumentado de 13.5px */
.cal-tec-btn.activo{background:var(--text-main);color:#fff;border-color:var(--text-main)}
.cal-layout{display:flex;background:var(--surface);border-radius:var(--radius-lg);overflow:hidden;height:670px;box-shadow:var(--shadow-md);border:1.5px solid var(--border)} /* Altura fija en escritorio; en tablet/móvil las celdas son más pequeñas, no la ventana la que se comprime */
.cal-main-area{flex:1;display:flex;flex-direction:column;overflow:hidden}
/* Encabezado y días son celdas del MISMO grid (no dos grids separados) —
   así el ancho de columna se calcula una sola vez y nunca puede
   desincronizarse por una barra de scroll que reste ancho a uno de los dos.
   El encabezado queda "fijo" con position:sticky dentro de ese único grid. */
.cal-grid-body{display:grid;grid-template-columns:repeat(7,1fr);overflow-y:auto;flex:1}
.cal-grid-head-cell{
  position:sticky;top:0;z-index:2;
  padding:12px 6px;text-align:center;font-size:14px;font-weight:700;color:var(--text-muted);
  text-transform:uppercase;letter-spacing:.05em;
  background:var(--surface-2);border-bottom:1.5px solid var(--border);
} /* Aumentado de 12.5px */
.cal-dia{min-height:115px;border-right:1px solid #F0F2F7;border-bottom:1px solid #F0F2F7;padding:6px;cursor:pointer;transition:background .12s}
.cal-dia:nth-child(7n){border-right:none}
.cal-dia:hover{background:#F5F7FF}
.cal-dia.seleccionado{background:var(--row-hover-cell)}
.cal-dia.otro-mes{opacity:.4}
.cal-dia-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.cal-dia-num{width:30px;height:30px;display:flex;align-items:center;justify-content:center;font-size:16.5px;font-weight:700;color:var(--text-main);border-radius:50%} /* Aumentado de 14.5px */
.cal-dia-num.cal-hoy{background:linear-gradient(135deg,#4F6EF7,#7C3AED);color:#fff;box-shadow:0 2px 8px rgba(79,110,247,.4)}
.cal-chip{font-size:13px;font-weight:600;padding:3px 7px;border-radius:5px;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:3px} /* Aumentado de 11.5px */
.cal-chip-mas{font-size:12px;color:var(--text-muted);padding:1px 5px}
/* Igual que en Mes: encabezado y columnas del día son celdas del mismo
   grid (.cal-sem-body), no dos grids separados — ver comentario arriba de
   .cal-grid-body. minmax() reemplaza el wrapper con min-width inline que
   forzaba el scroll horizontal en pantallas angostas. */
.cal-sem-head-cell{position:sticky;top:0;z-index:2;background:var(--surface-2);border-bottom:1.5px solid var(--border)}
.cal-sem-dia-h{padding:8px 4px;text-align:center;border-right:1px solid #F0F2F7;cursor:pointer}
.cal-sem-dia-h:hover{background:var(--row-hover)}
.cal-sem-hoy .cal-sem-num{background:linear-gradient(135deg,#4F6EF7,#7C3AED);color:#fff;width:38px;height:38px;border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto;box-shadow:0 2px 8px rgba(79,110,247,.4)}
.cal-sem-dow{font-size:13px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.03em} /* Aumentado de 11.5px */
.cal-sem-num{font-size:25px;font-weight:800;color:var(--text-main);letter-spacing:-.3px} /* Aumentado de 22px */
.cal-sem-body{display:grid;grid-template-columns:50px repeat(7,minmax(70px,1fr));overflow:auto;flex:1}
.cal-sem-horas{display:flex;flex-direction:column}
.cal-sem-hora{height:60px;font-size:13px;color:var(--text-muted);padding:4px 6px;border-bottom:1px solid #F0F2F7;text-align:right;flex-shrink:0;font-weight:600} /* Aumentado de 11.5px */
.cal-sem-col{border-right:1px solid #F0F2F7;position:relative;min-height:660px}
.cal-sem-slot{height:60px;border-bottom:1px dashed #EAEDF5}
.cal-sem-ev{position:absolute;left:2px;right:2px;border-radius:6px;padding:4px 6px;font-size:13px;font-weight:700;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-height:26px;transition:all .12s} /* Aumentado de 11.5px */
.cal-sem-ev:hover{transform:scale(1.02);box-shadow:var(--shadow-md)}
/* Igual patrón que Mes/Semana: un único grid (.cal-tec-body) para el
   encabezado y TODAS las filas de técnicos — antes cada fila (y el
   encabezado) eran grids independientes, con tantas oportunidades de
   desalinearse como filas hubiera. El borde inferior de "fila" ahora vive
   en cada celda (.cal-tec-nombre / .cal-tec-cell), ya que ya no hay un
   div contenedor de fila al cual atribuírselo. */
.cal-tec-body{display:grid;grid-template-columns:130px repeat(7,minmax(90px,1fr));overflow:auto;flex:1}
.cal-tec-head-cell{position:sticky;top:0;z-index:2;background:var(--surface-2);border-bottom:1.5px solid var(--border)}
.cal-tec-nombre-h{padding:12px 14px;font-size:14px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;border-right:1px solid var(--border)} /* Aumentado de 12.5px */
.cal-tec-dia-h{padding:8px 4px;text-align:center;border-right:1px solid #F0F2F7}
.cal-tec-nombre{padding:10px 12px;font-size:15.5px;font-weight:700;color:var(--text-main);border-right:1px solid var(--border);border-bottom:1px solid #F0F2F7;background:var(--surface-2);display:flex;align-items:flex-start;gap:8px;padding-top:12px} /* Aumentado de 14px */
.cal-tec-avatar{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#4F6EF7,#7C3AED);color:#fff;display:flex;align-items:center;justify-content:center;font-size:12.5px;font-weight:800;flex-shrink:0}
.cal-tec-cell{padding:4px;border-right:1px solid #F0F2F7;border-bottom:1px solid #F0F2F7;min-height:74px;cursor:pointer;transition:background .1s}
.cal-tec-cell:hover{background:var(--row-hover)}
.cal-tec-ev{border-radius:4px;padding:3px 6px;margin-bottom:3px;font-size:13px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer} /* Aumentado de 11.5px */
.cal-panel-dia{width:320px;border-left:1.5px solid var(--border);display:flex;flex-direction:column;flex-shrink:0}
.cal-panel-header{padding:18px;border-bottom:1px solid var(--border);flex-shrink:0;background:var(--surface-2)}
.cal-panel-fecha{font-size:18px;font-weight:800;color:var(--text-main);letter-spacing:-.2px} /* Aumentado de 16px */
.cal-panel-sub{font-size:15.5px;color:var(--text-muted);margin-top:3px;font-weight:500} /* Aumentado de 13.5px */
.cal-panel-body{flex:1;overflow-y:auto;padding:12px}
.cal-ev-item{border-left:3px solid;border-radius:0 10px 10px 0;padding:12px 14px;margin-bottom:8px;background:var(--surface-2);cursor:pointer;transition:all .12s}
.cal-ev-item:hover{background:var(--row-hover);transform:translateX(2px)}
.cal-ev-tipo{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;margin-bottom:3px}
.cal-ev-nombre{font-size:16.5px;font-weight:700;color:var(--text-main);margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} /* Aumentado de 15px */
.cal-ev-meta{font-size:14.5px;color:var(--text-muted)} /* Aumentado de 13px */
.cal-ev-badge{display:inline-block;font-size:12px;font-weight:600;padding:2px 8px;border-radius:999px;margin-top:4px}

/* ============================================================
   FIX RESPONSIVE CALENDARIO
   Bug de Safari/móvil: los hijos flex necesitan min-height:0
   explícito para respetar overflow-y:auto en vez de desbordarse
   sobre el elemento vecino (efecto "superpuesto").
   ============================================================ */
.cal-layout,
.cal-main-area,
.cal-grid-body,
.cal-sem-body,
.cal-tec-body,
.cal-panel-dia,
.cal-panel-body {
  min-height: 0;
}

/* ============================================================
   MÉTRICAS — pipeline y facturación
   ============================================================ */
.pipeline-scroll{display:flex;align-items:center;gap:0;overflow-x:auto;padding-bottom:4px}

/* ============================================================
   RESPONSIVE — TABLET (768px - 1024px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 64px; }

  .sidebar { width: 64px; overflow: hidden; transition: width .25s cubic-bezier(.4,0,.2,1); }
  .sidebar:hover { width: 260px; box-shadow: 8px 0 32px rgba(0,0,0,.2); }
  .sidebar-brand span { display: none; white-space: nowrap; }
  .sidebar:hover .sidebar-brand span { display: block; }
  .tab-btn { justify-content: center; padding: 12px; }
  .tab-btn svg { margin-right: 0 !important; flex-shrink: 0; }
  .tab-btn span, .tab-btn:not(:hover) { overflow: hidden; }
  .sidebar:not(:hover) .tab-btn { font-size: 0; gap: 0; }
  .sidebar:hover .tab-btn { font-size: 17.5px; gap: 10px; justify-content: flex-start; }
  .sidebar:not(:hover) .user-info,
  .sidebar:not(:hover) .btn-logout span { display: none; }
  .sidebar:not(:hover) .btn-logout { padding: 8px; justify-content: center; }
  .sidebar:not(:hover) .sidebar-brand { padding: 22px 16px; }

  .main { padding: 20px 18px 40px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid fieldset { grid-template-columns: 1fr 1fr; }

  .panel-expediente { width: 480px; }

  /* Tabla tablet — scroll horizontal */
  .table-wrap { overflow-x: auto; }
  table.data-table th, table.data-table td { padding: 12px 14px; font-size: 16.5px; } /* Aumentado de 15px */

  /* ── Calendario tablet: celdas y textos más compactos ──
     No dependemos de vh — el calendario se ve más pequeño porque
     sus piezas (celdas, chips, panel) son más pequeñas, no porque
     se comprima para caber en la ventana. */
  .cal-top-bar { gap: 8px; margin-bottom: 10px; }
  .cal-mes-label { font-size: 19px; min-width: 155px; }
  .cal-nav-btn { width: 32px; height: 32px; font-size: 16px; }
  .cal-btn-hoy { padding: 6px 14px; font-size: 14.5px; }
  .cal-vista-tab { padding: 7px 14px; font-size: 14.5px; }
  .cal-filtros-row { margin-bottom: 10px; row-gap: 6px; }
  .cal-filtro-label { font-size: 13px; }
  .cal-tipo-btn, .cal-tec-btn { padding: 6px 12px; font-size: 14px; }

  .cal-layout {
    flex-direction: column;
    height: 62vh;
  }
  .cal-grid-head-cell { padding: 8px 4px; font-size: 12.5px; }
  .cal-dia { min-height: 58px; padding: 4px; }
  .cal-dia-num { width: 24px; height: 24px; font-size: 14px; }
  .cal-chip { font-size: 11px; padding: 2px 5px; }
  .cal-chip-mas { font-size: 10.5px; }

  .cal-panel-dia {
    width: 100%;
    border-left: none;
    border-top: 1.5px solid var(--border);
    height: 190px;
    flex-shrink: 0;
  }
  .cal-panel-header { padding: 12px 14px; }
  .cal-panel-fecha { font-size: 16px; }
  .cal-panel-sub { font-size: 13.5px; }
  .cal-ev-item { padding: 9px 11px; margin-bottom: 6px; }
  .cal-ev-nombre { font-size: 15px; }
  .cal-ev-meta { font-size: 13px; }
}

/* ============================================================
   CALENDARIO — TABLET EN HORIZONTAL (ancho >1024px pero bajo)
   Se activa por altura, no por ancho: cubre tablets anchos
   (ej. Lenovo en landscape) que quedan fuera del breakpoint
   de ancho de arriba. Mantiene el layout en fila (hay ancho de
   sobra) pero con las mismas celdas y textos compactos.
   ============================================================ */
@media (min-width: 1025px) and (max-height: 750px) {
  .cal-mes-label { font-size: 19px; min-width: 155px; }
  .cal-nav-btn { width: 32px; height: 32px; font-size: 16px; }
  .cal-btn-hoy { padding: 6px 14px; font-size: 14.5px; }
  .cal-vista-tab { padding: 7px 14px; font-size: 14.5px; }
  .cal-filtros-row { row-gap: 6px; }
  .cal-filtro-label { font-size: 13px; }
  .cal-tipo-btn, .cal-tec-btn { padding: 6px 12px; font-size: 14px; }

  .cal-layout { height: 58vh; }
  .cal-grid-head-cell { padding: 8px 4px; font-size: 12.5px; }
  .cal-dia { min-height: 52px; padding: 4px; }
  .cal-dia-num { width: 24px; height: 24px; font-size: 14px; }
  .cal-chip { font-size: 11px; padding: 2px 5px; }
  .cal-chip-mas { font-size: 10.5px; }

  .cal-panel-dia { width: 200px; }
  .cal-panel-header { padding: 10px 12px; }
  .cal-panel-fecha { font-size: 15px; }
  .cal-panel-sub { font-size: 13px; }
  .cal-ev-item { padding: 8px 10px; margin-bottom: 6px; }
  .cal-ev-nombre { font-size: 14px; }
  .cal-ev-meta { font-size: 12.5px; }
}

/* ============================================================
   RESPONSIVE — MÓVIL (< 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ── Layout principal ── */
  .app { flex-direction: column; height: 100dvh; }
  .main { padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }

  /* ── Barra superior móvil (hamburguesa) ── */
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 40;
    padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    background: rgba(15,22,35,.97); backdrop-filter: blur(16px);
    color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15);
  }
  .mobile-topbar-title { font-weight: 800; font-size: 15.5px; letter-spacing: .02em; text-transform: uppercase; }
  .btn-hamburguesa {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: -6px 0; flex-shrink: 0;
    background: transparent; border: none; color: #fff; cursor: pointer; border-radius: 8px;
  }
  .btn-hamburguesa:active { background: rgba(255,255,255,.12); }

  /* ── Overlay oscuro detrás del menú ── */
  .menu-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(10,12,20,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
    z-index: 998;
  }
  .menu-overlay.activo { opacity: 1; pointer-events: auto; }

  /* ── Sidebar → menú lateral deslizable (drawer) ── */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: auto; right: auto;
    width: min(82vw, 320px); height: 100dvh;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
    overflow-y: auto;
    z-index: 999;
  }
  .sidebar.abierto { transform: translateX(0); }
  .sidebar-brand { display: flex; padding-top: max(22px, env(safe-area-inset-top)); order: 0; }
  .btn-cerrar-menu { display: flex; }

  /* ── Usuario (nombre, rol, avatar) arriba del listado de módulos ── */
  .user-chip {
    order: 1; margin: 4px 14px 14px; padding: 14px; gap: 12px;
    background: rgba(255,255,255,.05); border-radius: 14px;
  }
  .user-avatar { width: 46px; height: 46px; font-size: 17px; }
  .user-info span:first-child { font-size: 15.5px; }
  .user-role-badge { font-size: 13px; }

  .tabs { order: 2; flex-direction: column; padding: 10px; gap: 2px; justify-content: flex-start; align-items: stretch; }
  .tab-btn {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 13px 14px; font-size: 16.5px; font-weight: 500;
    min-height: 44px; text-align: left; border-radius: 10px;
    color: rgba(255,255,255,.6);
  }
  .tab-btn svg { width: 20px; height: 20px; }
  .tab-btn.active { color: #fff; background: linear-gradient(135deg, rgba(79,110,247,.35), rgba(124,58,237,.25)); }

  .sidebar-footer { order: 3; display: block; padding-bottom: max(12px, env(safe-area-inset-bottom)); }

  body.menu-abierto { overflow: hidden; }

  /* ── Header de vista ── */
  .view-header { flex-direction: column; gap: 8px; margin-bottom: 10px; }
  .view-header h2 { font-size: 24px; } /* Aumentado de 23px */
  .view-header .btn { width: 100%; justify-content: center; }

  /* ── Stats cards 2 columnas ── */
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 10px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 28px; } /* Aumentado de 25px */
  .stat-card .stat-label { font-size: 13.5px; } /* Aumentado de 12px */

  /* ── Toolbar ── */
  .toolbar { flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .toolbar select { width: 100%; min-width: unset; }
  .filtro-multi-btn { width: 100%; min-width: unset; }
  .search-box { min-width: unset; }

  /* ── Tabla → Cards apiladas ── */
  .table-wrap {
    background: transparent; border: none;
    box-shadow: none; overflow: visible; max-height: none;
  }
  table.data-table { display: none !important; }
  .mobile-cards { display: flex; flex-direction: column; gap: 8px; }
  .mobile-card {
    background: var(--surface); border-radius: var(--radius-lg);
    border: 1.5px solid var(--border); padding: 12px 14px;
    box-shadow: var(--shadow-sm); cursor: pointer;
    transition: all .15s cubic-bezier(.4,0,.2,1);
  }
  .mobile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .mobile-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
  .mobile-card-nombre { font-size: 18px; font-weight: 800; color: var(--text-main); flex: 1; min-width: 0; margin-right: 0; line-height: 1.3; letter-spacing: -.2px; overflow-wrap: break-word; } /* Aumentado de 16px */
  .mobile-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .mobile-card-field label { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 1px; } /* Aumentado de 11px */
  .mobile-card-field span { font-size: 16px; color: var(--text-main); font-weight: 600; overflow-wrap: break-word; } /* Aumentado de 14.5px */
  .mobile-card-actions { display: flex; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .mobile-card-actions button { flex: 1; padding: 10px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface-2); font-size: 15px; font-weight: 600; color: var(--text-sub); display: flex; align-items: center; justify-content: center; gap: 5px; } /* Aumentado de 13.5px */
  .mobile-card-actions button:hover { background: var(--color-blue-50); color: var(--accent); border-color: var(--accent); }
  .mobile-card-actions button.danger:hover { background: var(--color-red-50); color: #EF4444; border-color: #EF4444; }

  /* ── Panel expediente → pantalla completa ── */
  .panel-expediente {
    width: 100%; top: 0; left: 0; right: 0; bottom: 0;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }
  .panel-expediente.abierto { transform: translateY(0); }
  .panel-exp-header { padding: 16px 18px; }
  .panel-exp-nombre { font-size: 19px; } /* Aumentado de 17px */

  /* ── Modales → bottom sheet ── */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92dvh; width: 100%;
  }
  .modal-lg, .modal-md, .modal-sm { max-width: 100%; }
  .modal-header { padding: 18px 20px; }
  .modal-body { padding: 18px 20px; }
  .modal-footer { padding: 16px 20px; flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .form-grid fieldset { grid-template-columns: 1fr; }

  /* ── Módulo Métricas ── */
  #metricas-container [style*="grid-template-columns:repeat(5"] {
    grid-template-columns: repeat(2,1fr) !important;
  }
  #metricas-container [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  #metricas-container [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #metricas-container [style*="grid-column:span 2"] {
    grid-column: span 1 !important;
  }

  /* ── Calendario móvil: celdas y textos compactos, no la ventana ── */
  .cal-top-bar { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .cal-mes-label { font-size: 17px; min-width: 115px; }
  .cal-nav-btn { width: 29px; height: 29px; font-size: 14.5px; }
  .cal-btn-hoy { padding: 5px 11px; font-size: 12.5px; }
  .cal-vista-tab { padding: 5px 11px; font-size: 12.5px; }
  .cal-filtros-row { gap: 4px; margin-bottom: 8px; row-gap: 5px; }
  .cal-filtro-label { font-size: 11.5px; }
  .cal-tipo-btn, .cal-tec-btn { padding: 4px 9px; font-size: 12px; }

  .cal-layout { height: 52vh; flex-direction: column; }
  .cal-grid-head-cell { padding: 5px 2px; font-size: 10.5px; }
  .cal-dia { min-height: 44px; padding: 3px; }
  .cal-dia-num { width: 19px; height: 19px; font-size: 11.5px; }
  .cal-chip { font-size: 9.5px; padding: 1px 3px; gap: 2px; }
  .cal-chip-mas { font-size: 9px; }

  .cal-panel-dia { width: 100%; border-left: none; border-top: 1.5px solid var(--border); height: 150px; flex-shrink: 0; }
  .cal-panel-header { padding: 10px 12px; }
  .cal-panel-fecha { font-size: 14px; }
  .cal-panel-sub { font-size: 12px; }
  .cal-ev-item { padding: 8px 10px; margin-bottom: 5px; }
  .cal-ev-nombre { font-size: 13.5px; }
  .cal-ev-meta { font-size: 11.5px; }

  /* ── Vista semana y técnico → ocultar en móvil muy pequeño ── */
  .cal-vista-tab:nth-child(2),
  .cal-vista-tab:nth-child(3) { font-size: 14px; padding: 6px 10px; } /* Aumentado de 12.5px */

  /* ── Login ── */
  .login-card { padding: 28px 22px; border-radius: var(--radius-xl); }
  .login-logo { width: 92px; height: 92px; border-radius: 20px; }
  .login-brand h1 { font-size: 26px; } /* Aumentado de 23px */

  /* ── Lightbox ── */
  .lightbox-nav.prev { left: -46px; }
  .lightbox-nav.next { right: -46px; }
  .lightbox-nav { width: 42px; height: 42px; font-size: 20px; }

  /* ── Toast ── */
  .toast { width: calc(100% - 28px); text-align: center; bottom: 76px; }
}

/* ============================================================
   RESPONSIVE — MÓVIL MUY PEQUEÑO (< 375px)
   ============================================================ */
@media (max-width: 375px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card .stat-value { font-size: 24px; } /* Aumentado de 22px */
  .tab-btn { min-width: 44px; font-size: 11.5px; padding: 6px 4px; } /* Aumentado de 10px */
  .view-header h2 { font-size: 22px; } /* Aumentado de 20px */
  .main { padding: 14px 12px 76px; }
}

/* ============================================================
   MÓDULO USUARIOS — cards de usuario
   ============================================================ */
.usuarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.usuario-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all .2s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.usuario-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--u-color, #4F6EF7);
}
.usuario-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.usuario-card.inactivo { opacity: .55; }

.usuario-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.usuario-avatar-lg {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.usuario-card-info { flex: 1; min-width: 0; }
.usuario-nombre { font-size: 19px; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.2px; } /* Aumentado de 17px */
.usuario-email { font-size: 15.5px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* Aumentado de 13.5px */

.usuario-rol-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13.5px; font-weight: 700; padding: 4px 12px; /* Aumentado de 12px */
  border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.rol-admin    { background: #EEF2FF; color: #3730A3; }
.rol-comercial{ background: #FFF7ED; color: #92400E; }
.rol-tecnico  { background: #F0FDF4; color: #14532D; }

.usuario-card-body { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.usuario-info-row { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--text-sub); } /* Aumentado de 14.5px */
.usuario-info-row svg { color: var(--text-muted); flex-shrink: 0; }

.usuario-accesos { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.acceso-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; padding: 4px 10px; /* Aumentado de 12px */
  border-radius: 999px; border: 1.5px solid;
}
.acceso-chip.tiene { background: #F0FDF4; color: #15803D; border-color: #86EFAC; }
.acceso-chip.no-tiene { background: #F8FAFC; color: var(--text-muted); border-color: var(--border); }

.usuario-card-footer { display: flex; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.usuario-card-footer button { flex: 1; padding: 10px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface-2); font-size: 15px; font-weight: 600; color: var(--text-sub); display: flex; align-items: center; justify-content: center; gap: 5px; transition: all .12s; } /* Aumentado de 13.5px */
.usuario-card-footer button:hover { background: var(--color-blue-50); color: var(--accent); border-color: var(--accent); }
.usuario-card-footer button.danger:hover { background: var(--color-red-50); color: #EF4444; border-color: #EF4444; }

.usuarios-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.usuarios-empty svg { margin-bottom: 16px; opacity: .3; }
.usuarios-empty h3 { font-size: 20px; font-weight: 700; color: var(--text-sub); margin-bottom: 6px; } /* Aumentado de 18px */

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

/* ============================================================
   MÓDULO PROYECTOS — layout con panel de detalle
   ============================================================ */
.proyectos-layout {
  display: flex; gap: 14px; align-items: flex-start;
}
.proyectos-lista {
  flex: 1; min-width: 0;
  transition: flex .25s cubic-bezier(.4,0,.2,1);
}
.proyectos-layout.con-detalle .proyectos-lista {
  flex: 0 0 45%;
}

.proyecto-detalle {
  width: 52%; flex-shrink: 0;
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  max-height: 70vh; overflow: hidden;
  position: sticky; top: 0;
}
.proyecto-detalle-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-shrink: 0; background: var(--surface-2);
}
.proyecto-detalle-codigo {
  font-size: 13px; font-weight: 700; color: var(--accent); /* Aumentado de 12px */
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px;
}
.proyecto-detalle-nombre {
  font-size: 21px; font-weight: 800; color: var(--text-main); /* Aumentado de 18px */
  letter-spacing: -.3px; margin-bottom: 2px;
}
.proyecto-detalle-cliente {
  font-size: 16.5px; color: var(--text-muted); /* Aumentado de 14.5px */
}
.proyecto-detalle-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pd-tab {
  padding: 13px 20px; border: none; background: transparent;
  font-size: 16.5px; font-weight: 500; color: var(--text-muted); /* Aumentado de 15px */
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; margin-bottom: -1px;
}
.pd-tab:hover { color: var(--text-main); }
.pd-tab.active {
  color: var(--accent); font-weight: 700;
  border-bottom-color: var(--accent);
}
.proyecto-detalle-body {
  flex: 1; overflow-y: auto; padding: 18px 24px;
}

/* Info grid dentro del detalle */
.pd-info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px;
}
.pd-info-card {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 12px 14px; border: 1px solid var(--border);
}
.pd-info-label {
  font-size: 13px; color: var(--text-muted); font-weight: 700; /* Aumentado de 12px */
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px;
}
.pd-info-val {
  font-size: 17.5px; font-weight: 600; color: var(--text-main); /* Aumentado de 15.5px */
}
.pd-info-val.verde { color: #059669; }

/* Tabla de componentes */
.comp-tabla {
  width: 100%; border-collapse: collapse; font-size: 16.5px; /* Aumentado de 15px */
}
.comp-tabla th {
  padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 700; /* Aumentado de 12px */
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1.5px solid var(--border); background: var(--surface-2);
}
.comp-tabla td {
  padding: 12px 10px; border-bottom: 1px solid #F0F2F7; vertical-align: middle;
}
.comp-tabla tr:last-child td { border-bottom: none; }
.comp-tabla tr:hover td { background: var(--row-hover); }
.comp-tabla td:last-child { text-align: right; }

.mat-chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 600; /* Aumentado de 13px */
}
.cat-melamina   { background: #E5F3DC; color: #163404; }
.cat-sinterizado{ background: #E8F1FC; color: #0B3D7A; }
.cat-madera     { background: #FBF0DA; color: #3E2202; }
.cat-vidrio     { background: #EEEAFB; color: #39307F; }
.cat-metal      { background: #EFF0F0; color: #2A2A28; }
.cat-otro       { background: #F0F4F8; color: #4B5572; }

.comp-totales {
  display: flex; gap: 16px; justify-content: flex-end;
  margin-top: 12px; padding-top: 12px; border-top: 1.5px solid var(--border);
  flex-wrap: wrap;
}
.comp-total-item { text-align: right; }
.comp-total-label { font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; } /* Aumentado de 12px */
.comp-total-val { font-size: 19px; font-weight: 800; color: var(--text-main); } /* Aumentado de 17px */
.comp-total-val.acento { color: var(--accent); }

.comp-costos-proy {
  margin-top: 16px; padding-top: 14px;
  border-top: 1.5px solid var(--border);
}
.comp-costos-titulo {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px;
}
.comp-costos-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
}
@media (max-width: 480px) {
  .comp-costos-grid { grid-template-columns: 1fr; }
}

.btn-add-comp {
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-strong); background: transparent;
  font-size: 16.5px; color: var(--text-muted); cursor: pointer; /* Aumentado de 15px */
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px; transition: all .15s;
}
.btn-add-comp:hover {
  background: var(--surface-2); color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 1024px) {
  .proyectos-layout { flex-direction: column; }
  .proyectos-layout.con-detalle .proyectos-lista { flex: 1; }
  .proyecto-detalle { width: 100%; position: static; max-height: none; }
}
@media (max-width: 768px) {
  .proyecto-detalle {
    position: fixed; inset: 0; bottom: 0;
    width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: none; z-index: 60;
  }
}

/* Panel detalle proyecto — mismo estilo que expediente */
.proyecto-detalle-tabs { display:flex; flex-shrink:0; border-bottom:1px solid var(--border); }
.pd-tab {
  padding: 13px 20px; border: none; background: transparent;
  font-size: 16.5px; font-weight: 500; color: var(--text-muted); /* Aumentado de 15px */
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; margin-bottom: -1px;
}
.pd-tab:hover { color: var(--text-main); }
.pd-tab.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }

#pd-body { padding: 18px 24px; }
#pd-badges { padding: 0 2px; }
.panel-exp-header { padding: 20px 24px; }

/* ============================================================
   MÓDULO COTIZADOR — calculadora de mesones
   ============================================================ */
.cot-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--color-blue-50); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 14px; font-size: 14px;
}
.cot-chip { color: var(--text-sub); }
.cot-chip b { color: var(--text-main); font-weight: 700; }

/* Selector Precio 1 / Precio 2 — colores distintos entre sí (y de otros
   toggles como Tabla/Por estado) para que a simple vista quede claro cuál
   nivel de precio está activo y no se confunda con la vista de Proyectos. */
.cot-precio-tabs {
  display: inline-flex; gap: 2px; background: #E4E7F0; border-radius: 10px; padding: 3px;
}
.cot-precio-tab {
  padding: 9px 18px; border-radius: 8px; border: none; background: transparent;
  font-size: 16px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.cot-precio-tab[data-nivel="1"].activo { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.cot-precio-tab[data-nivel="2"].activo { background: var(--accent-2); color: #fff; box-shadow: var(--shadow-sm); }

.cot-grid {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; margin-bottom: 14px;
}
.cot-bottom-grid {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px;
}
.cot-cell {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
  min-width: 0; /* evita que el contenido interno (scroll-row) expanda la celda en vez de scrollear */
}
.cot-cell-header { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1.5px solid var(--surface-2); }
.cot-cell-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cot-cell-title { font-size: 14.5px; font-weight: 700; color: var(--text-main); letter-spacing: -.1px; }

.cot-scroll-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex: 1; min-width: 0; }
.cot-loading, .cot-empty { font-size: 13px; color: var(--text-muted); padding: 10px 4px; }

.cot-sel-card {
  flex: 0 0 108px; border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 8px; cursor: pointer; transition: all .15s; background: var(--surface-2); text-align: center;
}
.cot-sel-card:hover { border-color: var(--accent); background: var(--color-blue-50); transform: translateY(-1px); }
.cot-sel-card.activo { border: 2px solid var(--accent); background: var(--color-blue-50); }
.cot-sel-card.cot-none.activo { border-color: var(--text-muted); background: var(--surface-2); }
.cot-sel-img { width: 100%; height: 52px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 6px; border-radius: 8px; background: var(--surface); }
.cot-sel-img img { width: 100%; height: 100%; object-fit: cover; }
.cot-sel-img svg { width: 100%; height: auto; max-height: 52px; }
.cot-sel-label { font-size: 12px; font-weight: 700; color: var(--text-main); line-height: 1.25; }
.cot-sel-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.cot-medidas-inner { display: flex; gap: 12px; flex: 1; }
.cot-esquema-box {
  flex: 0 0 130px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden;
}
.cot-campos-box { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.cot-campo-row { display: flex; align-items: center; gap: 8px; }
.cot-campo-letra {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cot-campo-letra.resta { background: var(--text-muted); }
.cot-campo-row input {
  flex: 1; height: 32px; padding: 0 10px; background: var(--surface-2); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text-main); font-size: 13px; font-family: inherit;
}
.cot-campo-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.cot-campo-unit { font-size: 11px; color: var(--text-muted); min-width: 22px; }

.cot-ml-pill {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 12px;
  background: var(--color-blue-50); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-sub); font-weight: 600;
}
.cot-ml-pill span:last-child { font-size: 16px; font-weight: 800; color: var(--accent); }

.cot-form-row { display: flex; align-items: center; gap: 10px; }
.cot-form-label { font-size: 13.5px; color: var(--text-sub); font-weight: 600; min-width: 150px; flex-shrink: 0; }
.cot-form-row input, .cot-form-row select {
  flex: 1; height: 34px; padding: 0 10px; background: var(--surface-2); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text-main); font-size: 13.5px; font-family: inherit;
}
.cot-form-row input:focus, .cot-form-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.cot-summary-row {
  display: flex; justify-content: space-between; align-items: center; padding: 7px 0;
  border-bottom: 1.5px solid var(--surface-2); font-size: 13.5px;
}
.cot-summary-row:last-child { border-bottom: none; }
.cot-summary-row span:first-child { color: var(--text-sub); font-weight: 500; }
.cot-summary-row span:last-child { font-weight: 700; color: var(--text-main); }

.cot-total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 12px; border-top: 2px solid var(--color-blue-50);
}
.cot-total-label { font-size: 13.5px; color: var(--text-sub); font-weight: 600; }
.cot-total-value { font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: -.03em; }

@media (max-width: 1024px) {
  .cot-grid, .cot-bottom-grid { grid-template-columns: 1fr; }
  .cot-sel-card { flex: 0 0 96px; }
  .cot-cell { padding: 14px 16px; }
}
@media (max-width: 768px) {
  .cot-medidas-inner { flex-direction: column; }
  .cot-esquema-box { flex: 0 0 auto; height: 100px; width: 100%; }
  .cot-form-label { min-width: 120px; }
  .cot-form-row { flex-wrap: wrap; }
  .cot-strip { font-size: 12.5px; padding: 8px 12px; gap: 6px; }
  .cot-sel-card { flex: 0 0 88px; padding: 6px; }
  .cot-sel-img { height: 44px; }
  .cot-sel-label { font-size: 11px; }
  .cot-sel-sub { font-size: 10px; }
  .cot-total-value { font-size: 22px; }
  .cot-cell-title { font-size: 13.5px; }
}
@media (max-width: 375px) {
  .cot-sel-card { flex: 0 0 78px; }
  .cot-form-label { min-width: 100%; margin-bottom: 2px; }
  .cot-form-row { flex-direction: column; align-items: stretch; gap: 4px; }
}

/* Grid de tarjetas de catálogo dentro de modales (ej. gestión de Lavaplatos) */
.catalog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px;
}
.catalog-card {
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 10px; background: var(--surface-2);
}
.catalog-img {
  width: 100%; aspect-ratio: 1; background: var(--surface); border-radius: 8px;
  overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.catalog-img img { width: 100%; height: 100%; object-fit: cover; }
.catalog-name { font-size: 12.5px; font-weight: 700; color: var(--text-main); }
.catalog-price { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 768px) {
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
}

/* ============================================================
   MÓDULO PROYECTOS — vista Kanban (agrupado por estado)
   ============================================================ */
.proyectos-vista-tabs {
  display: inline-flex; gap: 2px; background: #E4E7F0; border-radius: 10px;
  padding: 3px; margin-bottom: 16px;
}
.proyectos-vista-tab {
  padding: 9px 18px; border-radius: 8px; border: none; background: transparent;
  font-size: 16px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: all .15s;
}
.proyectos-vista-tab.activo { background: #fff; color: var(--text-main); box-shadow: var(--shadow-sm); }

.kanban-wrap {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 300px; background: var(--surface-2); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border); display: flex; flex-direction: column;
  max-height: 74vh;
}
.kanban-col-header { padding: 14px 16px; border-bottom: 1.5px solid var(--border); flex-shrink: 0; }
.kanban-col-titulo {
  display: flex; align-items: center; gap: 8px; font-weight: 800;
  font-size: 16.5px; color: var(--text-main); letter-spacing: -.2px;
}
.kanban-col-count {
  font-size: 13.5px; background: var(--surface); padding: 2px 11px;
  border-radius: 999px; color: var(--text-muted); font-weight: 700; margin-left: auto;
}
.kanban-col-total { font-size: 14px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }
.kanban-col-body {
  flex: 1; overflow-y: auto; padding: 10px; display: flex;
  flex-direction: column; gap: 8px; min-height: 60px;
}
.kanban-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-left: 4px solid var(--cc, var(--accent)); border-radius: var(--radius-md);
  padding: 12px 14px; cursor: pointer; transition: all .15s; box-shadow: var(--shadow-sm);
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kanban-card-nombre {
  font-weight: 700; font-size: 15.5px; color: var(--text-main);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-card-cliente {
  font-size: 13.5px; color: var(--text-muted); margin-bottom: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-card-retraso { font-size: 12px; font-weight: 700; color: #EF4444; }
.kanban-empty { text-align: center; padding: 30px 10px; color: var(--text-muted); font-size: 13.5px; }

@media (max-width: 768px) {
  .proyectos-vista-tabs { display: none; } /* En móvil ya se ve como lista de cards apiladas */
  .kanban-col { flex: 0 0 260px; max-height: 65vh; }

  /* ── Filtros de Proyectos: grilla 2 columnas en vez de lista vertical ── */
  #view-proyectos .toolbar {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; align-items: start;
  }
  #view-proyectos .search-box,
  #view-proyectos #proyectos-fecha-personalizada-wrap,
  #view-proyectos .btn-limpiar-filtros-movil {
    grid-column: 1 / -1;
  }
  #view-proyectos #proyectos-filter-estado-wrap    { order: 1; }
  #view-proyectos #proyectos-filter-prioridad-wrap { order: 2; }
  #view-proyectos #proyectos-filter-pago-wrap      { order: 3; }
  #view-proyectos #proyectos-filter-fecha     { order: 4; }
  #view-proyectos #proyectos-fecha-personalizada-wrap { order: 5; }
  #view-proyectos .proyectos-fecha-personalizada input { min-width: 0; flex: 1; }
  #view-proyectos .search-box                 { order: 6; }
  #view-proyectos .btn-limpiar-filtros-movil {
    order: 7; display: block; width: 100%; text-align: center;
    min-height: 44px; margin-top: 2px;
  }
}

/* ============================================================
   MÓDULO PROYECTOS — separador de grupo por estado dentro de la tabla
   ============================================================ */
table.data-table tr.grupo-estado-row td {
  background: var(--surface-2) !important;
  border-bottom: 1.5px solid var(--border-strong);
  border-top: 2px solid var(--border-strong);
  /* Fija verticalmente TODA la fila justo debajo del encabezado de
     columnas mientras se hace scroll hacia abajo dentro de esa fase. */
  position: sticky;
  top: 52px;
  z-index: 2;
}
table.data-table tr.grupo-estado-row:first-child td { border-top: none; }

/* La celda de la etiqueta reutiliza sticky-col (ya trae left:0 para
   quedar fija horizontalmente) — antes esto era un solo <td colspan>
   gigante, y la combinación colspan + sticky es poco confiable entre
   navegadores; por eso no se quedaba quieta al hacer scroll lateral. */
table.data-table tr.grupo-estado-row td.grupo-estado-label {
  font-weight: 800; font-size: 15.5px; color: var(--text-main);
  padding: 11px 18px;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.grupo-estado-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 9px; vertical-align: middle;
}
.grupo-estado-count {
  margin-left: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-muted);
  background: var(--surface); padding: 2px 11px; border-radius: 999px;
  text-transform: none; letter-spacing: normal;
}