/* ============================================================
   Estudio Berlo ERP — App styles (app.css)
   ============================================================ */
@import url('variables.css');
@import url('base.css');
@import url('components.css');
@import url('publicaciones.css');

/* ── Login / Auth Split Layout (Berlo Flow Zero-Scroll 100vh) ──────── */
.auth-layout {
  margin: 0;
  padding: 0;
  height: 100vh;
  max-height: 100vh;
  width: 100vw;
  overflow: hidden !important;
  background-color: #070c18;
  color: #fff;
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
}

.auth-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden !important;
  position: relative;
}

.auth-visual-side {
  position: relative;
  flex: 1.15;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 4.5rem;
  overflow: hidden;
  z-index: 2;
}

@media (max-width: 992px) {
  .auth-visual-side {
    display: none;
  }
}

.auth-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: opacity 0.8s ease-in-out, transform 30s ease;
  filter: brightness(0.48) contrast(1.1);
  animation: zoomBg 40s infinite alternate;
  z-index: 0;
}

@keyframes zoomBg {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

.auth-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 80% 20%, rgba(6, 79, 211, 0.25) 0%, transparent 50%),
              linear-gradient(135deg, rgba(6, 12, 24, 0.72) 0%, rgba(8, 15, 29, 0.88) 100%);
  z-index: 1;
}

.animated-shapes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.grid-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  stroke: none !important;
}

.moving-line {
  stroke-dasharray: 200;
  animation: moveLine 8s linear infinite;
}
.line-1 {
  animation-duration: 12s;
}
.line-2 {
  animation-duration: 16s;
  animation-delay: -3s;
}

@keyframes moveLine {
  0% { stroke-dashoffset: 400; }
  100% { stroke-dashoffset: -400; }
}

.shape {
  position: absolute;
  opacity: 0.2;
  filter: blur(1px);
  animation: floatShape 20s ease-in-out infinite;
}

.shape-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent, #05f2d4) 0%, transparent 70%);
  top: 12%;
  left: 15%;
  animation-duration: 25s;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-left: 45px solid transparent;
  border-right: 45px solid transparent;
  border-bottom: 78px solid var(--color-accent, #05f2d4);
  top: 65%;
  left: 8%;
  opacity: 0.12;
  animation-duration: 28s;
}

.shape-pentagon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.04);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  top: 18%;
  right: 20%;
  animation-duration: 22s;
  animation-delay: -8s;
}

.shape-torus {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 16px solid rgba(5, 242, 212, 0.08);
  top: 72%;
  right: 28%;
  animation-duration: 32s;
}

@keyframes floatShape {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

.visual-badge {
  position: relative;
  z-index: 10;
  max-width: 520px;
  color: #fff;
  animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.motto-tag-wrapper {
  margin-bottom: 1.25rem;
}

.motto-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(6, 79, 211, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(5, 242, 212, 0.3);
  border-radius: 9999px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-accent, #05f2d4);
  box-shadow: 0 0 20px rgba(5, 242, 212, 0.15);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent, #05f2d4);
  box-shadow: 0 0 8px var(--color-accent, #05f2d4);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.visual-badge h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2rem, 1.8rem + 1.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: #ffffff;
}

.visual-badge p {
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem);
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.auth-features-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
}

.feature-chip svg {
  color: var(--color-accent, #05f2d4);
}

/* Form Container - Zero Scroll Full Viewport */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 2.5rem;
  z-index: 2;
  position: relative;
  height: 100vh;
  max-height: 100vh;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(11, 19, 36, 0.68);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(5, 242, 212, 0.35);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55),
              0 0 40px rgba(6, 79, 211, 0.15);
  padding: 2.25rem 2.25rem 1.85rem;
  position: relative;
  z-index: 5;
  animation: slideInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Brand Header inside Login Card */
.login-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-wrapper {
  display: flex;
  align-items: center;
}

/* Brand Logo (_b terminal prompt evolution from berlo.dev) */
.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 800;
  font-size: 2rem;
  font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif);
  color: #ffffff;
  letter-spacing: -0.04em;
  padding: 0;
  line-height: 1;
  user-select: none;
}

.logo-char {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo-cursor {
  color: var(--color-accent, #05f2d4);
  margin-left: 1px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(5, 242, 212, 0.8);
  animation: pulseCursor 1.2s infinite ease-in-out;
}

@keyframes pulseCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.brand-badge-version {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-accent, #05f2d4);
  background: rgba(5, 242, 212, 0.08);
  border: 1px solid rgba(5, 242, 212, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
}

.login-title {
  text-align: left;
  margin-bottom: 0.25rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.login-subtitle {
  text-align: left;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 1.4rem;
  line-height: 1.4;
}

/* Custom Form Elements - Berlo Flow */
.login-card .form-group {
  margin-bottom: 1.15rem;
}

.login-card .label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.login-card .form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.45rem;
  letter-spacing: 0.01em;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.95rem;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  transition: color 0.2s ease;
  z-index: 2;
}

.flow-input {
  width: 100%;
  height: 48px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  padding: 0.65rem 1rem 0.65rem 2.65rem !important;
  font-family: inherit;
  font-size: 0.9375rem !important;
  color: #ffffff !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box;
}

.flow-input::placeholder {
  color: rgba(255, 255, 255, 0.32) !important;
  font-size: 0.875rem;
}

.flow-input:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--color-primary, #064fd3) !important;
  box-shadow: 0 0 0 3px rgba(6, 79, 211, 0.35), 0 0 16px rgba(5, 242, 212, 0.15) !important;
  outline: none !important;
}

.input-with-icon:focus-within .input-icon {
  color: var(--color-accent, #05f2d4);
}

.toggle-password-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  z-index: 3;
}

.toggle-password-btn:hover {
  color: var(--color-accent, #05f2d4);
  background: rgba(255, 255, 255, 0.06);
}

.btn-flow-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #064fd3 0%, #053eb0 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  font-family: inherit;
  font-size: 0.9375rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(6, 79, 211, 0.38),
              inset 0 1px 1px rgba(255, 255, 255, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  margin-top: 0.5rem;
}

.btn-flow-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(6, 79, 211, 0.55),
              0 0 20px rgba(5, 242, 212, 0.25);
  background: linear-gradient(135deg, #0756e6 0%, #0645c4 100%) !important;
}

.btn-flow-submit:active {
  transform: translateY(0);
}

.btn-flow-submit svg {
  transition: transform 0.2s ease;
}

.btn-flow-submit:hover svg {
  transform: translateX(3px);
}

.auth-card-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.security-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  text-align: center;
}

.security-indicator svg {
  color: var(--color-accent, #05f2d4);
  flex-shrink: 0;
}

.auth-error-box {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-height: 700px) {
  .login-card {
    padding: 1.5rem 1.75rem 1.25rem;
  }
  .login-brand-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
  }
  .login-title {
    font-size: 1.35rem;
  }
  .login-subtitle {
    margin-bottom: 1rem;
    font-size: 0.8125rem;
  }
  .flow-input {
    height: 42px;
  }
  .btn-flow-submit {
    height: 42px;
  }
  .auth-card-footer {
    margin-top: 0.85rem;
    padding-top: 0.65rem;
  }
}

/* ── Dashboard ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  transition: background var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-surface-2); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.activity-text { color: var(--text-secondary); flex: 1; }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }

.quick-actions { display: flex; flex-direction: column; gap: 0.875rem; }
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  text-decoration: none;
}
.quick-action:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px) translateX(2px);
  box-shadow: var(--shadow-md);
}
.quick-action svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Cliente - Perfil ─────────────────────────────────────── */
.client-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.client-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.client-info h1 { font-size: 1.5rem; }

.info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row svg { width: 15px; height: 15px; flex-shrink: 0; }
.info-row strong { color: var(--text-secondary); min-width: 120px; font-weight: 600; }

/* ── Presupuesto PDF ─────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header-actions, .btn, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white !important; color: black !important; }
  .pdf-page { box-shadow: none !important; border: none !important; }
}

.pdf-page {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-md);
}
.pdf-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2.5rem; }
.pdf-logo { height: 36px; }
.pdf-numero { font-size: 0.875rem; color: var(--text-muted); text-align: right; }
.pdf-numero strong { display: block; font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.pdf-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--text-muted); margin-bottom: 0.5rem; }
.pdf-divider { height: 2px; background: linear-gradient(to right, var(--primary), var(--secondary)); border-radius: 2px; margin: 1.5rem 0; }

/* ── Filtros / Search bar ────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
}
.search-input-wrap > svg,
.search-input-wrap .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}
.search-input-wrap .form-control { 
  padding-left: 2.35rem !important; 
  padding-right: 2.35rem !important;
  width: 100%;
}

/* ── Proyectos card ──────────────────────────────────────── */
.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition);
  text-decoration: none;
  display: block;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.5rem; }
.project-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.project-client { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.875rem; }
.project-progress { margin-bottom: 0.75rem; }
.progress-bar-wrap { height: 4px; background: var(--bg-base); border-radius: 2px; overflow: hidden; margin-top: 0.25rem; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 2px; transition: width 0.5s ease; }
.project-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   SEMÁFORO DE CARGA DE TRABAJO
   ═══════════════════════════════════════════════════════════ */

/* ── Indicador en el topbar ─────────────────────────────── */
.carga-topbar-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--bg-hover, var(--bg-surface-2));
  border: 1px solid var(--border-glass, var(--border));
  cursor: pointer;
  position: relative;
  transition: all var(--trans-fast, var(--transition));
}

.carga-topbar-indicator:hover {
  background: var(--bg-active, var(--bg-base));
  border-color: var(--border-card-hover, var(--border-strong));
  transform: translateY(-1px);
}

.carga-topbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.carga-topbar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* Tooltip CSS puro */
.carga-topbar-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateX(-50%) translateY(-4px);
  z-index: 1000;
}

.carga-topbar-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--border-strong);
}

.carga-topbar-indicator:hover .carga-topbar-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Pulso animado para carga elevada/crítica */
@keyframes cargaPulso {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.35); opacity: 0.7; }
}
.carga-dot-pulse {
  animation: cargaPulso 1.8s ease-in-out infinite;
}

/* ── Card de Carga del Equipo (dashboard) ───────────────── */
.carga-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.carga-row:hover { background: var(--bg-surface-2); }

.carga-row-me {
  background: var(--primary-light);
  border: 1px solid var(--border);
}
.carga-row-me:hover { background: var(--primary-light); filter: brightness(0.97); }

.carga-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.carga-semaforo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.carga-bar-wrap {
  height: 5px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
}

.carga-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  min-width: 2px;
}

@media (max-width: 900px) {
  .carga-topbar-label { display: none; }
}

/* ── Tags de avisos de vencimiento en Topbar ─────────────── */
.vencimiento-topbar-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

/* Tags para VENCIDOS (Rojo/Danger) */
.tag-vencidos-danger, .tag-facturas-danger, .tag-presupuestos-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.tag-vencidos-danger:hover, .tag-facturas-danger:hover, .tag-presupuestos-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--danger);
  transform: translateY(-1px);
}

/* Tags para POR VENCER (Amarillo/Naranja/Warning) */
.tag-vencer-warning, .tag-facturas-warning, .tag-presupuestos-warning {
  background: rgba(234, 179, 8, 0.12);
  color: #d97706;
  border: 1px solid rgba(234, 179, 8, 0.3);
}
.tag-vencer-warning:hover, .tag-facturas-warning:hover, .tag-presupuestos-warning:hover {
  background: rgba(234, 179, 8, 0.22);
  border-color: #d97706;
  transform: translateY(-1px);
}

.tag-tareas-generales-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.tag-tareas-generales-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--danger);
  transform: translateY(-1px);
}

.tag-tareas-generales-warning {
  background: rgba(249, 115, 22, 0.14);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.35);
}
.tag-tareas-generales-warning:hover {
  background: rgba(249, 115, 22, 0.24);
  border-color: #f97316;
  transform: translateY(-1px);
}

/* Tags de Publicaciones */
.tag-publicaciones-warning {
  background: rgba(139, 92, 246, 0.14);
  color: #a855f7;
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.tag-publicaciones-warning:hover {
  background: rgba(139, 92, 246, 0.24);
  border-color: #a855f7;
  transform: translateY(-1px);
}

.tag-publicaciones-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.tag-publicaciones-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--danger);
  transform: translateY(-1px);
}

.vencimiento-count-badge {
  background: currentColor;
  color: #ffffff !important;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  line-height: 1.4;
  margin-left: 2px;
  display: inline-block;
  min-width: 18px;
  text-align: center;
}

.tag-vencidos-danger .vencimiento-count-badge,
.tag-facturas-danger .vencimiento-count-badge,
.tag-presupuestos-danger .vencimiento-count-badge,
.tag-tareas-generales-danger .vencimiento-count-badge,
.tag-publicaciones-danger .vencimiento-count-badge {
  background: var(--danger);
  color: #ffffff !important;
}
.tag-vencer-warning .vencimiento-count-badge,
.tag-facturas-warning .vencimiento-count-badge,
.tag-presupuestos-warning .vencimiento-count-badge {
  background: #d97706;
  color: #ffffff !important;
}
.tag-tareas-generales-warning .vencimiento-count-badge {
  background: #f97316;
  color: #ffffff !important;
}
.tag-publicaciones-warning .vencimiento-count-badge {
  background: #9333ea;
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .vencimiento-topbar-tag span:not(.vencimiento-count-badge) {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   MODAL DE AVISOS Y VENCIMIENTOS (Aesthetic & Glassmorphism)
   ═══════════════════════════════════════════════════════════ */
.venc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.venc-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.venc-modal-box {
  background: #0e1628;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
}
.venc-modal-overlay.active .venc-modal-box {
  transform: scale(1) translateY(0);
}

[data-theme="light"] .venc-modal-box {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

.venc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.4rem 1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
[data-theme="light"] .venc-modal-header {
  border-bottom-color: #f1f5f9;
}

.venc-modal-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.venc-modal-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.venc-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.venc-modal-btn-viewall {
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}
.venc-modal-btn-viewall:hover {
  color: #f8fafc;
  text-decoration: underline;
}
[data-theme="light"] .venc-modal-btn-viewall {
  color: #64748b;
}
[data-theme="light"] .venc-modal-btn-viewall:hover {
  color: #0f172a;
}

.venc-modal-btn-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.venc-modal-btn-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .venc-modal-btn-close {
  color: #64748b;
}
[data-theme="light"] .venc-modal-btn-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.venc-modal-body {
  padding: 1.25rem 1.4rem;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Card interna de cada item */
.venc-item-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  cursor: pointer;
}
.venc-item-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
[data-theme="light"] .venc-item-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .venc-item-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.venc-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  flex: 1;
  min-width: 0;
}

.venc-item-code {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .venc-item-code {
  color: #0f172a;
}

.venc-item-client {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .venc-item-client {
  color: #64748b;
}

.venc-item-date {
  font-size: 0.77rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

.venc-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Badge de estado tipo píldora */
.venc-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.22rem 0.75rem;
  border-radius: 999px;
  line-height: 1.2;
}

.venc-item-amount {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  font-feature-settings: "tnum";
}
[data-theme="light"] .venc-item-amount {
  color: #0f172a;
}

/* ── Temas cromáticos según el tipo de aviso ── */
/* 1. Presupuestos por vencer (Ámbar / Naranja) */
.venc-theme-presupuestos-warning .venc-modal-title {
  color: #f59e0b;
}
.venc-theme-presupuestos-warning .venc-item-date {
  color: #38bdf8;
}
.venc-theme-presupuestos-warning .venc-item-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* 2. Presupuestos vencidos (Rojo / Danger) */
.venc-theme-presupuestos-danger .venc-modal-title {
  color: #ef4444;
}
.venc-theme-presupuestos-danger .venc-item-date {
  color: #ef4444;
}
.venc-theme-presupuestos-danger .venc-item-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* 3. Facturas por vencer (Ámbar / Warning) */
.venc-theme-facturas-warning .venc-modal-title {
  color: #f59e0b;
}
.venc-theme-facturas-warning .venc-item-date {
  color: #38bdf8;
}
.venc-theme-facturas-warning .venc-item-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* 4. Facturas vencidas (Rojo / Danger) */
.venc-theme-facturas-danger .venc-modal-title {
  color: #ef4444;
}
.venc-theme-facturas-danger .venc-item-date {
  color: #ef4444;
}
.venc-theme-facturas-danger .venc-item-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* 5. Tareas por vencer (Naranja vibrante) */
.venc-theme-tareas-warning .venc-modal-title {
  color: #f97316;
}
.venc-theme-tareas-warning .venc-item-date {
  color: #38bdf8;
}
.venc-theme-tareas-warning .venc-item-badge {
  background: rgba(249, 115, 22, 0.18);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

/* 6. Publicaciones por vencer / salir (Púrpura / Violeta creativo) */
.venc-theme-publicaciones-warning .venc-modal-title {
  color: #a855f7;
}
.venc-theme-publicaciones-warning .venc-item-date {
  color: #a855f7;
}
.venc-theme-publicaciones-warning .venc-item-badge {
  background: rgba(168, 85, 247, 0.18);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* 7. Publicaciones atrasadas (Rojo / Danger) */
.venc-theme-publicaciones-danger .venc-modal-title {
  color: #ef4444;
}
.venc-theme-publicaciones-danger .venc-item-date {
  color: #ef4444;
}
.venc-theme-publicaciones-danger .venc-item-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ═══════════════════════════════════════════════════════════
   BOTÓN DE AYUDA CON IA & CHAT DRAWER (GEMINI)
   ═══════════════════════════════════════════════════════════ */

/* Botón de Ayuda IA en el Topbar */
.btn-ayuda-ia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  color: var(--primary);
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn-ayuda-ia:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.ayuda-ia-sparkle-svg {
  display: inline-block;
  animation: sparkleBounce 2.5s infinite ease-in-out;
}

.chat-ia-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@keyframes sparkleBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(12deg); }
}

/* Backdrop Overlay */
.chat-ia-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1060;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.chat-ia-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Chat Drawer Panel */
.chat-ia-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--border);
  z-index: 1070;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-ia-drawer.open {
  right: 0;
}

/* Header */
.chat-ia-header {
  padding: 1.1rem 1.25rem;
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.chat-ia-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-ia-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.chat-ia-avatar svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff !important;
  fill: none !important;
  display: block;
}

.chat-ia-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.chat-ia-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Messages Body */
.chat-ia-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-base);
}

.chat-ia-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.chat-ia-msg.user {
  align-self: flex-end;
}

.chat-ia-msg.bot {
  align-self: flex-start;
}

.chat-ia-msg-bubble {
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.chat-ia-msg.user .chat-ia-msg-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-ia-msg.bot .chat-ia-msg-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Code & inline code inside chat */
.chat-ia-code {
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  overflow-x: auto;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
}
.chat-ia-inline-code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Chips / Sugerencias (Listado vertical ordenado) */
.chat-ia-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.chat-ia-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.chat-ia-chip svg {
  flex-shrink: 0;
  color: var(--primary);
}

.chat-ia-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

/* Typing Indicator Animation */
.chat-ia-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 1rem !important;
}

.chat-ia-typing span {
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--primary);
  animation: typingDot 1.4s infinite ease-in-out;
}

.chat-ia-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-ia-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

/* Input Footer */
.chat-ia-footer {
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.chat-ia-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 6px 12px;
  transition: border-color var(--transition);
}

.chat-ia-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 79, 211, 0.15);
}

.chat-ia-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  resize: none;
  max-height: 100px;
  padding: 6px 0;
  font-family: inherit;
}

.chat-ia-send-btn {
  background: var(--primary);
  color: #ffffff !important;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 2px;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

.chat-ia-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff !important;
  fill: none !important;
  display: block;
}

.chat-ia-send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.06);
  box-shadow: var(--shadow-md);
}

.chat-ia-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════
   VISTA DE PRESUPUESTOS (Gestión-Agencia Style)
   ═══════════════════════════════════════════════════════════ */
.pre-page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem 2.5rem 0.75rem;
}

/* Header */
.pre-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.pre-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.pre-page-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
}
.pre-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(6, 79, 211, 0.16);
  color: #38bdf8;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.25);
}
[data-theme="light"] .pre-count-pill {
  background: rgba(6, 79, 211, 0.08);
  color: #064fd3;
  border-color: rgba(6, 79, 211, 0.22);
}
.pre-page-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0.4rem 0 0 0;
}
.pre-btn-new {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-primary);
  color: #ffffff !important;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 16px var(--color-primary-glow);
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  cursor: pointer;
}
.pre-btn-new:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--color-primary-glow);
}

/* Metric Cards Bento Grid */
.pre-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1024px) {
  .pre-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .pre-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.pre-metric-card {
  background: rgba(14, 22, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  position: relative;
  transition: all var(--transition);
}
[data-theme="light"] .pre-metric-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.pre-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.pre-metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pre-metric-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  line-height: 1.2;
}
.pre-metric-tag.tag-global {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.pre-metric-tag.tag-ganados {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.pre-metric-tag.tag-pendientes {
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.pre-metric-tag.tag-edicion {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Light mode tags para alto contraste WCAG */
[data-theme="light"] .pre-metric-tag.tag-global,
[data-theme="light"] .pre-metric-tag.tag-ganados {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
[data-theme="light"] .pre-metric-tag.tag-pendientes {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
[data-theme="light"] .pre-metric-tag.tag-edicion {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

.pre-metric-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.pre-val-white { color: var(--text-main); }
.pre-val-green { color: #10b981; }
.pre-val-amber { color: #f59e0b; }
.pre-val-cyan  { color: #38bdf8; }

[data-theme="light"] .pre-val-green { color: #059669; }
[data-theme="light"] .pre-val-amber { color: #d97706; }
[data-theme="light"] .pre-val-cyan  { color: #0284c7; }

/* Filter Bar */
.pre-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  margin-bottom: 1.25rem;
}
.pre-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(10, 16, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  min-width: 260px;
  flex: 1 1 auto;
  max-width: none;
  transition: border-color var(--transition);
}
[data-theme="light"] .pre-search-box {
  background: #ffffff;
  border-color: #cbd5e1;
}
.pre-search-box:focus-within {
  border-color: var(--color-primary);
}
.pre-search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.pre-search-input {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  width: 100%;
}
.pre-search-input::placeholder {
  color: var(--text-muted);
}
.pre-search-mic-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color var(--transition);
}
.pre-search-mic-btn:hover {
  color: var(--color-accent);
}

.pre-filter-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(10, 16, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
[data-theme="light"] .pre-filter-item {
  background: #ffffff;
  border-color: #cbd5e1;
}
.pre-filter-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  padding-right: 0.35rem;
}
.pre-filter-select option {
  background: #0d1424;
  color: #ffffff;
}
[data-theme="light"] .pre-filter-select option {
  background: #ffffff;
  color: #0f172a;
}

.pre-btn-clear {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.42rem 1.05rem;
  border-radius: 999px;
  text-decoration: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.pre-btn-clear:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}
[data-theme="light"] .pre-btn-clear {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
[data-theme="light"] .pre-btn-clear:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Table Container & Table */
.pre-table-card {
  background: rgba(14, 22, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .pre-table-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.pre-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.pre-table th {
  text-align: left;
  padding: 1.1rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
[data-theme="light"] .pre-table th {
  border-bottom-color: #e2e8f0;
}

.pre-table td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}
[data-theme="light"] .pre-table td {
  border-bottom-color: #f1f5f9;
}

.pre-table tbody tr {
  transition: background var(--trans-fast), opacity 0.2s ease, filter 0.2s ease;
}
.pre-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}
[data-theme="light"] .pre-table tbody tr:hover {
  background: #f8fafc;
}

/* Filas apagadas para presupuestos aprobados o rechazados */
.pre-row-apagada {
  opacity: 0.45;
  filter: grayscale(0.25);
}
.pre-row-apagada:hover {
  opacity: 1;
  filter: none;
}
[data-theme="light"] .pre-row-apagada {
  opacity: 0.52;
  filter: grayscale(0.3);
  background: rgba(241, 245, 249, 0.4);
}
[data-theme="light"] .pre-row-apagada:hover {
  opacity: 1;
  filter: none;
  background: #f8fafc;
}

/* Filas apagadas para facturas pagadas o anuladas */
.fac-row-apagada {
  opacity: 0.45;
  filter: grayscale(0.25);
}
.fac-row-apagada:hover {
  opacity: 1;
  filter: none;
}
[data-theme="light"] .fac-row-apagada {
  opacity: 0.52;
  filter: grayscale(0.3);
  background: rgba(241, 245, 249, 0.4);
}
[data-theme="light"] .fac-row-apagada:hover {
  opacity: 1;
  filter: none;
  background: #f8fafc;
}

.pre-table tbody tr:last-child td {
  border-bottom: none;
}

/* Unified Bento Table Styles (Compartidos con Tareas Generales, Finanzas y Presupuestos) */
.tg-table-container {
  background: #0d1424;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow-x: auto;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .tg-table-container {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 20px -4px rgba(15, 23, 42, 0.06);
}

.tg-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.tg-table thead tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .tg-table thead tr {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.tg-table th {
  padding: 1.1rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme="light"] .tg-table th {
  color: #475569;
}

.tg-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}
[data-theme="light"] .tg-row {
  border-bottom: 1px solid #f1f5f9;
}
.tg-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .tg-row:hover {
  background: #f8fafc;
}
.tg-row:last-child {
  border-bottom: none;
}

.tg-table td {
  padding: 1.15rem 1.25rem;
  vertical-align: middle;
}

.tg-actions-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tg-action-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s ease;
}
.tg-action-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .tg-action-btn {
  color: #64748b;
}
[data-theme="light"] .tg-action-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.tg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  overflow: hidden;
  position: relative;
}
[data-theme="light"] .tg-avatar {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.tg-avatar-initials {
  background: linear-gradient(135deg, #064fd3 0%, #0284c7 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tg-assigned-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.tg-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Columna N° Presupuesto con Badge Cyan y Link Ver Propuesta */
.pre-code-cell {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.pre-code-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(5, 242, 212, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(5, 242, 212, 0.28);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
[data-theme="light"] .pre-code-pill {
  background: #f0fdfa;
  color: #0d9488;
  border-color: #99f6e4;
}
.pre-code-pill-link {
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}
.pre-code-pill-link:hover {
  background: rgba(5, 242, 212, 0.22);
  border-color: rgba(5, 242, 212, 0.55);
  box-shadow: 0 0 12px rgba(5, 242, 212, 0.2);
  transform: translateY(-1px);
}
[data-theme="light"] .pre-code-pill-link:hover {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #5eead4;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}

/* Columna Cliente */
.pre-client-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}
.pre-client-name {
  word-break: break-word;
}
.pre-client-cell svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Columna Validez */
.pre-validez-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Columna Total */
.pre-total-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pre-total-amount {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.pre-currency-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
[data-theme="light"] .pre-currency-badge {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}

/* Badges de Estado */
.pre-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}
.pre-status-enviado {
  background: rgba(245, 158, 11, 0.16);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.pre-status-aprobado {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.pre-status-borrador {
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.pre-status-rechazado {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Light Mode Badges de Estado para WCAG 2.2 AA */
[data-theme="light"] .pre-status-enviado {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
[data-theme="light"] .pre-status-aprobado {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
[data-theme="light"] .pre-status-borrador {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}
[data-theme="light"] .pre-status-rechazado {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Columna Acciones con Iconos */
.pre-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}
.pre-action-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all var(--transition);
}
.pre-action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .pre-action-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.pre-action-btn-danger:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* ═══════════════════════════════════════════════════════════
   FORMULARIO Y EDICIÓN DE PRESUPUESTOS (Berlo Modus Design)
   ═══════════════════════════════════════════════════════════ */
.pre-form-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 1080px) {
  .pre-form-layout {
    grid-template-columns: 1fr;
  }
}

.pre-form-card {
  background: rgba(14, 22, 40, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
  transition: border-color var(--trans-fast);
}
[data-theme="light"] .pre-form-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.pre-form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .pre-form-card-header {
  border-bottom-color: #f1f5f9;
}

.pre-form-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pre-form-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0 0;
}

/* Items Table */
.items-table-head {
  display: grid;
  grid-template-columns: 1fr 90px 140px 120px 42px;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
[data-theme="light"] .items-table-head {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 90px 140px 120px 42px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--trans-fast);
}
[data-theme="light"] .item-row {
  border-bottom-color: #f1f5f9;
}

.item-subtotal {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  padding-right: 0.5rem;
}

.item-remove-btn {
  color: #94a3b8;
  padding: 6px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
}
.item-remove-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Sidebar Totales Box */
.totals-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}
[data-theme="light"] .totals-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.total-row strong, .total-row span:last-child {
  color: var(--text-main);
  font-weight: 600;
}
.total-row.grand {
  padding-top: 0.75rem;
  margin-top: 0.35rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 1.05rem;
}
[data-theme="light"] .total-row.grand {
  border-top-color: #cbd5e1;
}
.total-row.grand strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-accent);
  letter-spacing: -0.02em;
}
[data-theme="light"] .total-row.grand strong {
  color: var(--color-primary);
}

/* Plantilla Card Item */
.pre-plantilla-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  cursor: pointer;
  transition: all var(--trans-fast);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}
.pre-plantilla-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(5, 242, 212, 0.4);
  transform: translateY(-1px);
}
[data-theme="light"] .pre-plantilla-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .pre-plantilla-card:hover {
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(6, 79, 211, 0.1);
}
