/* ============================================
   VINCULO WEB - Sistema de Gestión
   Colores: Azul marino #1B3A7A + Verde #2DBE6C
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --primary: #1B3A7A;
  --primary-dark: #122860;
  --primary-light: #2A52A8;
  --accent: #2DBE6C;
  --accent-dark: #22A058;
  --accent-light: #3DD97D;
  
  --bg: #0F1623;
  --bg-card: #161E2E;
  --bg-hover: #1C2640;
  --sidebar-bg: #0D1420;
  
  --text: #E8EDF5;
  --text-muted: #8896B0;
  --text-dim: #4A5568;
  
  --border: #1E2D45;
  --border-light: #253450;
  
  --status-open: #3B82F6;
  --status-progress: #F59E0B;
  --status-wait: #8B5CF6;
  --status-review: #EC4899;
  --status-done: #2DBE6C;
  --status-cancel: #6B7280;
  
  --prio-low: #6B7280;
  --prio-mid: #3B82F6;
  --prio-high: #F59E0B;
  --prio-urgent: #EF4444;
  
  --sidebar-width: 260px;
  --header-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  /* No overflow-x:hidden aquí — corta el scroll del kanban */
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ============================================
   LAYOUT
   ============================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: relative;
  z-index: 10;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

.sidebar-logo-text span {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
}

.sidebar-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-label {
  padding: 4px 16px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: linear-gradient(90deg, rgba(29,58,122,0.3) 0%, transparent 100%);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-item .icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-client {
  padding: 6px 16px 6px 36px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-client:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-client.active { color: var(--accent); }

.sidebar-client-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow-y: hidden;
  overflow-x: hidden;
  position: relative;
  z-index: 10;
}

/* page-content — scroll vertical en páginas normales */
.page-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* overflow-x intencional: auto para que scroll interno funcione */
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-breadcrumb span { color: var(--text-dim); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.topbar-user:hover { background: var(--bg-hover); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ============================================
   PAGE CONTENT
   ============================================ */

/* Kanban page — layout fijo, scroll propio */
.page-content.kanban-page {
  padding: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary:hover { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================
   BADGES / STATUS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-open    { background: rgba(59,130,246,0.15); color: var(--status-open); }
.badge-progress{ background: rgba(245,158,11,0.15); color: var(--status-progress); }
.badge-wait    { background: rgba(139,92,246,0.15); color: var(--status-wait); }
.badge-review  { background: rgba(236,72,153,0.15); color: var(--status-review); }
.badge-done    { background: rgba(45,190,108,0.15); color: var(--status-done); }
.badge-cancel  { background: rgba(107,114,128,0.15); color: var(--status-cancel); }

.badge-low    { background: rgba(107,114,128,0.15); color: var(--prio-low); }
.badge-mid    { background: rgba(59,130,246,0.15);  color: var(--prio-mid); }
.badge-high   { background: rgba(245,158,11,0.15);  color: var(--prio-high); }
.badge-urgent { background: rgba(239,68,68,0.15);   color: var(--prio-urgent); }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13.5px;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,190,108,0.1);
}

.form-control::placeholder { color: var(--text-dim); }

select.form-control option { background: var(--bg-card); }

/* ============================================
   TABLE
   ============================================ */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================
   KANBAN
   ============================================ */

/* La página kanban tiene padding normal, scroll vertical */
.page-content.kanban-page {
  padding: 16px;
  overflow-y: auto;
  display: block;
}

/* Toolbar sobre el cuadro */
.kanban-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* El cuadro contenedor — igual que .gantt-layout */
.kanban-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

/* ─── CLAVE: altura fija como el Gantt ────────────────
   Sin height explícito, overflow-x no tiene referencia
   y el scrollbar horizontal nunca aparece             */
.kanban-wrapper {
  /* Igual que .gantt-right: altura fija, overflow visible en X */
  height: calc(100vh - 260px);
  min-height: 360px;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #3B5EA6 #0d1929;
}
.kanban-wrapper::-webkit-scrollbar        { height: 10px; width: 8px; display: block; }
.kanban-wrapper::-webkit-scrollbar-track  { background: #0d1929; }
.kanban-wrapper::-webkit-scrollbar-thumb  { background: #3B5EA6; border-radius: 5px; border: 2px solid #0d1929; min-width: 60px; }
.kanban-wrapper::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.kanban-wrapper::-webkit-scrollbar-corner { background: #0d1929; }

/* Board — igual que el SVG del gantt: ancho real, altura 100% */
.kanban-board {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  width: max-content;
  min-width: 100%;
  height: 100%;
  box-sizing: border-box;
  align-items: flex-start;
}

/* Columnas — altura igual al wrapper */
.kanban-col {
  flex: 0 0 285px; width: 285px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  height: calc(100% - 2px);
  overflow: hidden;
  transition: flex .25s, width .25s, border-color .2s, opacity .2s;
}
.kanban-col.col-empty { flex: 0 0 220px; width: 220px; opacity: 0.65; }
.kanban-col.drag-over { border-color: var(--accent); background: rgba(45,190,108,0.05); }

.kanban-col-header {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
  flex-shrink: 0; user-select: none;
}
.kanban-col-header:hover { background: rgba(255,255,255,0.02); }
.kanban-col-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kanban-col-count { margin-left:auto; background:var(--border); color:var(--text-muted); font-size:11px; font-weight:700; padding:1px 7px; border-radius:10px; flex-shrink:0; }

.kanban-cards {
  padding: 8px;
  overflow-y: auto; overflow-x: hidden;
  flex: 1;
  display: flex; flex-direction: column; gap: 7px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.kanban-cards::-webkit-scrollbar       { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: var(--transition);
  border-left: 3px solid var(--accent);
  user-select: none;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
  border-style: dashed;
}

.kanban-card.drag-placeholder {
  background: rgba(45,190,108,0.06);
  border: 2px dashed var(--accent);
  min-height: 60px;
  border-radius: var(--radius-sm);
}

.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(45,190,108,0.1);
  transform: translateY(-1px);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-add-card {
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.kanban-add-card:hover { color: var(--accent); background: var(--bg-hover); }

/* ============================================
   DASHBOARD STATS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--accent); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--prio-urgent); }

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #FCA5A5; }
.alert-success { background: rgba(45,190,108,0.1); border: 1px solid rgba(45,190,108,0.3); color: var(--accent); }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93C5FD; }

/* ============================================
   LOADER
   ============================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ============================================
   MOBILE HAMBURGER
   ============================================ */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  padding: 4px;
  cursor: pointer;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  font-size: 13px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--prio-urgent); }
.toast.info    { border-left: 3px solid var(--status-open); }

/* ============================================
   RESPONSIVE — TABLET (max 1024px)
   ============================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   RESPONSIVE — MOBILE (max 768px)
   ============================================ */
@media (max-width: 768px) {

  /* Sidebar — oculto por defecto, slide-in */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }

  /* Main sin margen */
  .main-content {
    margin-left: 0;
    overflow-x: hidden;
  }

  .hamburger { display: flex !important; }

  /* Topbar compacto */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 14px; }
  .topbar-actions .btn-sm span { display: none; } /* ocultar texto, solo ícono */

  /* Page content */
  .page-content {
  position: relative;
  z-index: 1; padding: 14px; }

  /* Stats en 2 columnas */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  /* Kanban — scroll horizontal en móvil */
  .kanban-board {
    height: 100%;
    gap: 10px;
    scroll-snap-type: x mandatory;
  }
  .kanban-col {
    flex: 0 0 82vw;
    width: 82vw;
    scroll-snap-align: start;
  }

  /* Modales — bottom sheet */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Grids de formularios — una sola columna */
  .modal-body [style*="grid-template-columns:1fr 1fr"],
  .modal-body [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .modal-body [style*="grid-column:1/-1"],
  .modal-body [style*="grid-column: 1/-1"] {
    grid-column: 1 !important;
  }

  /* Cards de clientes */
  .clientes-grid { grid-template-columns: 1fr !important; }

  /* Gantt toolbar wrap */
  .gantt-toolbar { gap: 8px; }
  .gantt-layout { grid-template-columns: 200px 1fr; }
  .gantt-left { min-width: 200px; }

  /* Tabla — scroll horizontal */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* Dashboard grids */
  .dashboard-grid { grid-template-columns: 1fr !important; }

  /* Toast más pequeño */
  .toast { min-width: 220px; font-size: 12px; }
  #toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; width: 100%; }
}

/* ============================================
   RESPONSIVE — PEQUEÑO (max 480px)
   ============================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .topbar { padding: 0 12px; height: 52px; }
  .page-content {
  position: relative;
  z-index: 1; padding: 12px; }
  .kanban-col { min-width: 88vw; width: 88vw; }
  .gantt-layout { grid-template-columns: 160px 1fr; }
  .gantt-left-header,
  .gantt-row { font-size: 11px; }
}

/* ============================================
   RESPONSIVE v69 — MOBILE MEJORADO
   ============================================ */

/* ── TOPBAR ── */
@media (max-width: 768px) {
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn-primary { font-size: 12px; padding: 6px 10px; }
  #notif-panel { width: 94vw; right: -8px; }
}

/* ── DASHBOARD ── */
@media (max-width: 768px) {
  /* Grid principal 1fr 340px → columna única */
  .dash-main-grid { grid-template-columns: 1fr !important; }
  /* Hosting KPIs 4 col → 2 col */
  .dash-hosting-kpis { grid-template-columns: repeat(2,1fr) !important; }
  /* Distribución tareas 3 col → 1 col */
  .dash-dist-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2,1fr) !important; }
  .dash-hosting-kpis { grid-template-columns: repeat(2,1fr) !important; }
}

/* ── CLIENTES ── */
@media (max-width: 768px) {
  /* Filtros wrap */
  .clientes-filtros { flex-direction: column !important; gap: 10px !important; }
  .clientes-filtros-servicios { flex-wrap: wrap !important; }
  /* Cards grid ya es auto-fill, funciona bien */
  /* Botones de acción dentro de card */
  .cliente-card-actions { flex-wrap: wrap; gap: 4px; }
  /* Dashboard ejecutivo clientes: 4 stats → 2x2 */
  .clientes-stats-grid { grid-template-columns: repeat(2,1fr) !important; }
  /* Top clientes: ocultar porcentaje en móvil */
  .top-clientes-pct { display: none !important; }
}

/* ── TAREAS / LISTA ── */
@media (max-width: 768px) {
  /* Fila de tabla: ocultar columnas menos importantes */
  .tareas-col-asignado { display: none !important; }
  .tareas-col-tipo     { display: none !important; }
  /* Filtros en columna */
  .tareas-filtros { flex-direction: column !important; gap: 8px !important; }
  .tareas-filtros select,
  .tareas-filtros input { width: 100% !important; }
  /* Tabla min-width menor */
  .tareas-table { min-width: 380px !important; }
}

/* ── HOSTING ── */
@media (max-width: 768px) {
  /* Ocultar columnas menos críticas */
  .hosting-col-plan    { display: none !important; }
  .hosting-col-precio  { display: none !important; }
  /* Tabla scrollable */
  .hosting-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hosting-table { min-width: 520px; }
  /* Stats hosting 4 → 2x2 */
  .hosting-stats { grid-template-columns: repeat(2,1fr) !important; }
}

/* ── FICHA CLIENTE ── */
@media (max-width: 768px) {
  /* Tabs: scroll horizontal */
  .ficha-tabs-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; padding-bottom: 4px; }
  .ficha-tab { display: inline-block; }
  /* Credenciales: grid simplificado */
  .ficha-cred-row { grid-template-columns: 1.5em 1fr auto !important; }
  .ficha-cred-row .cred-usuario,
  .ficha-cred-row .cred-url { display: none !important; }
  /* Contactos: grid simplificado */
  .contacto-row { grid-template-columns: 1fr 1fr auto !important; }
  .contacto-row .cont-cargo,
  .contacto-row .cont-tel { display: none !important; }
  /* Documento: sidebar páginas colapsa arriba */
  .doc-layout { flex-direction: column !important; height: auto !important; }
  .doc-sidebar { width: 100% !important; flex-direction: row !important; flex-wrap: wrap; }
  .doc-toolbar { flex-wrap: wrap; }
  /* Facturación grid → 1 col */
  .fact-grid { grid-template-columns: 1fr !important; }
}

/* ── MODALES en móvil ── */
@media (max-width: 768px) {
  /* Export modal más alto */
  #modal-exportar-creds .modal { max-height: 95vh; }
  /* Share link input más pequeño */
  #share-link-url { font-size: 11px; }
}

/* ── BOTTOM NAV (móvil) ── */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 150;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: .15s;
    min-width: 48px;
  }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item .nav-icon { font-size: 20px; line-height: 1; }
  /* Page content con padding bottom para no quedar detrás del nav */
  .page-content {
  position: relative;
  z-index: 1; padding-bottom: 70px !important; }
}
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}
