/* ==========================================================================
   AITANA SUITE — BUDGET CREATOR PREMIUM DESIGN SYSTEM
   Aligns 100% with Devoteam Corporate Light Design & Component Library
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET & ROOT VARIABLES
   -------------------------------------------------------------------------- */
:root {
  --bg-dark: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --border-subtle: #e2e8f0;
  --border-focus: rgba(248, 72, 94, 0.4);
  --border-gold: rgba(248, 72, 94, 0.35);
  --text-main: #1e293b;
  --text-muted: #475569;
  --text-dim: #64748b;
  --coral-primary: #f8485e;
  --coral-hover: #e0364c;
  --coral-glow: rgba(248, 72, 94, 0.15);
  --gold-primary: #f8485e;
  --gold-glow: rgba(248, 72, 94, 0.15);
  --indigo-primary: #6366f1;
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.15);
  --rose-primary: #f8485e;
  --sky-primary: #0284c7;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  background-color: var(--bg-dark) !important;
  color: var(--text-main) !important;
  font-family: var(--font-body) !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh !important;
  overflow-x: hidden !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   2. AMBIENT GLOW EFFECTS (HIDDEN IN LIGHT CORPORATE THEME)
   -------------------------------------------------------------------------- */
.bg-ambient-glow {
  display: none !important;
}

/* --------------------------------------------------------------------------
   3. APP CONTAINER & GENERAL LAYOUT
   -------------------------------------------------------------------------- */
.budget-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 1.25rem 2rem 3rem 2rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   4. APP HEADER & BRANDING
   -------------------------------------------------------------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-glow-devoteam,
.logo-glow-gold {
  width: 38px;
  height: 38px;
  background: #fff1f3 !important;
  border: 1px solid rgba(248, 72, 94, 0.3) !important;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f8485e !important;
  box-shadow: 0 2px 8px rgba(248, 72, 94, 0.12);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}

.logo-glow-devoteam:hover,
.logo-glow-gold:hover {
  background: #ffe4e8 !important;
  border-color: rgba(248, 72, 94, 0.5) !important;
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.22);
  transform: rotate(5deg) scale(1.05);
}

.logo-glow-devoteam .logo-icon,
.logo-glow-devoteam svg,
.logo-glow-devoteam i,
.logo-glow-gold .logo-icon,
.logo-glow-gold svg,
.logo-glow-gold i {
  width: 20px !important;
  height: 20px !important;
  color: #f8485e !important;
  stroke: #f8485e !important;
  display: block;
}

.brand-text h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: #1e293b;
  display: flex;
  align-items: baseline;
}

.brand-text > span {
  font-size: 0.7rem;
  color: #56555a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  display: block;
  margin-top: 1px;
}

/* Botón Circular de Ayuda */
.btn-help-circle {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: #56555a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  transition: all 0.2s ease-in-out;
  height: 38px;
  width: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-help-circle:hover {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.35);
  color: #f8485e;
  transform: scale(1.04);
}

.btn-help-circle i, .btn-help-circle svg {
  width: 18px;
  height: 18px;
}

/* Active Unit Badge (Matching Project Budget) */
.badge-unit-active {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  padding: 0.5rem 0.85rem !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  border-radius: 8px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #047857 !important;
  font-family: 'Outfit', sans-serif !important;
  height: 38px !important;
  box-sizing: border-box !important;
}

.badge-unit-active i, .badge-unit-active svg {
  width: 14px !important;
  height: 14px !important;
  color: #047857 !important;
  flex-shrink: 0 !important;
}

.badge-unit-active span {
  white-space: nowrap !important;
  color: #047857 !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  font-family: 'Outfit', sans-serif !important;
}

.badge-unit-active select,
#header-unit-switcher {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #047857 !important;
  font-family: 'Outfit', sans-serif !important;
  cursor: pointer !important;
  outline: none !important;
  padding: 0 4px !important;
  margin: 0 !important;
  box-shadow: none !important;
  height: auto !important;
  width: auto !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
}

.badge-unit-active select option,
#header-unit-switcher option {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 500 !important;
  padding: 6px 12px !important;
}

.badge-beta-header {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.25rem 0.65rem !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  border-radius: 6px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  color: #d97706 !important;
  text-transform: uppercase !important;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif !important;
  line-height: 1 !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.08) !important;
}

/* Portal Back Button (Devoteam Corporate Theme) */
.btn-portal-back-premium {
  position: relative !important;
  z-index: 1000 !important;
  background: #fff1f3 !important;
  border: 1px solid rgba(248, 72, 94, 0.25) !important;
  color: #f8485e !important;
  text-decoration: none !important;
  padding: 0 16px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  font-family: 'Inter', sans-serif !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(248, 72, 94, 0.08) !important;
  box-sizing: border-box !important;
  height: 38px !important;
  width: 165px !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  margin: 0 !important;
}

.btn-portal-back-premium:hover {
  transform: translateY(-2px) !important;
  background: #ffe4e8 !important;
  border-color: rgba(248, 72, 94, 0.4) !important;
  box-shadow: 0 4px 12px rgba(248, 72, 94, 0.16) !important;
  color: #e0364c !important;
}

.btn-portal-back-premium:active {
  transform: translateY(0) !important;
}

.btn-portal-back-premium i,
.btn-portal-back-premium svg {
  color: #f8485e !important;
  width: 14px !important;
  height: 14px !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-portal-back-premium:hover i,
.btn-portal-back-premium:hover svg {
  color: #e0364c !important;
  transform: translateX(-4px) !important;
}

/* --------------------------------------------------------------------------
   5. NAVIGATION TABS (MODULE NAV BAR)
   -------------------------------------------------------------------------- */
.module-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.module-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-nav-new-budget {
  background: linear-gradient(135deg, #f8485e 0%, #e0364c 100%);
  border: 1px solid rgba(248, 72, 94, 0.4);
  color: #ffffff !important;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(248, 72, 94, 0.25);
  flex-shrink: 0;
  margin-right: 4px;
}

.btn-nav-new-budget:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.35);
  background: #e0364c;
}

.btn-nav-new-budget:active {
  transform: translateY(0) scale(0.98);
}

.btn-nav-new-budget i,
.btn-nav-new-budget svg {
  width: 18px !important;
  height: 18px !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
  stroke-width: 2.8;
}

.module-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.module-nav-btn:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.module-nav-btn.active {
  color: #f8485e;
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.25);
  box-shadow: 0 2px 8px rgba(248, 72, 94, 0.1);
}

.module-nav-btn.active i, .module-nav-btn.active svg {
  color: #f8485e !important;
  transform: scale(1.05);
}

.module-nav-btn i, .module-nav-btn svg {
  width: 16px;
  height: 16px;
  transition: all 0.2s ease;
}

.module-nav-btn:disabled,
.module-nav-btn.disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.8);
}

.module-nav-btn:disabled:hover,
.module-nav-btn.disabled:hover {
  background: transparent !important;
  color: var(--text-muted) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.module-nav-btn:disabled i,
.module-nav-btn.disabled i,
.module-nav-btn:disabled svg,
.module-nav-btn.disabled svg {
  transform: none !important;
  color: var(--text-muted) !important;
}

.active-budget-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.active-budget-pill strong {
  color: #1e293b;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* View panels display toggling */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* --------------------------------------------------------------------------
   6. EXECUTIVE KPIS STRIP (4 COLUMNS FULL WIDTH)
   -------------------------------------------------------------------------- */
.kpis-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
}

@media (max-width: 1200px) {
  .kpis-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .kpis-strip {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.kpi-card.highlight-gold {
  border-color: rgba(248, 72, 94, 0.25);
  background: linear-gradient(135deg, #fff1f3 0%, #ffffff 100%);
}

.kpi-card.highlight-gold:hover {
  border-color: #f8485e;
}

.kpi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.kpi-icon-box i, .kpi-icon-box svg {
  width: 22px;
  height: 22px;
}

.kpi-icon-box.gold {
  background: #fff1f3;
  border: 1px solid rgba(248, 72, 94, 0.25);
  color: #f8485e;
}

.kpi-icon-box.rose {
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
}

.kpi-icon-box.green {
  background: #f0fdf4;
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #16a34a;
}

.kpi-icon-box.amber {
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #d97706;
}

.kpi-icon-box.blue {
  background: #f0f9ff;
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #0284c7;
}

.kpi-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.15;
  white-space: nowrap;
}

.kpi-subrow {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.kpi-badge-margin {
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.margin-high {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.margin-mid {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

/* Margen Bajo (< 30%): Alerta fosforita en rojo neón ultra-visible */
.margin-low,
.margin-critical {
  background: #ff0055 !important;
  color: #ffffff !important;
  border: 1px solid #d90048 !important;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.65), 0 0 20px rgba(255, 0, 85, 0.35) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  font-weight: 800 !important;
  letter-spacing: 0.02em;
  animation: pulse-neon-red 2s infinite ease-in-out;
}

@keyframes pulse-neon-red {
  0% {
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.6), 0 0 16px rgba(255, 0, 85, 0.3);
  }
  50% {
    box-shadow: 0 0 14px rgba(255, 0, 85, 0.95), 0 0 26px rgba(255, 0, 85, 0.6);
  }
  100% {
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.6), 0 0 16px rgba(255, 0, 85, 0.3);
  }
}

/* --------------------------------------------------------------------------
   7. MASTER CARD & PARAMETERS BAR
   -------------------------------------------------------------------------- */
.master-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

.meta-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.meta-identifiers {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.control-group label i, .control-group label svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}

/* Budget Code Pill (Devoteam Coral Style) */
.budget-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff1f3;
  border: 1px solid rgba(248, 72, 94, 0.25);
  color: #f8485e;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(248, 72, 94, 0.08);
}

.budget-code-pill:hover {
  background: #ffe4e8;
  border-color: #f8485e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(248, 72, 94, 0.18);
}

.budget-code-pill .copy-icon {
  width: 14px;
  height: 14px;
  opacity: 0.75;
  transition: opacity 0.2s;
}

.budget-code-pill:hover .copy-icon {
  opacity: 1;
}

.budget-version-select-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.meta-status-active {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.meta-status-frozen {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.meta-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.btn-icon-action {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: #56555a;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-icon-action i,
.btn-icon-action svg {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}

.btn-icon-action:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  color: #1e293b;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.btn-icon-action:active {
  transform: translateY(0);
}

.btn-icon-action.btn-save {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.3);
  color: #f8485e;
}

.btn-icon-action.btn-save:hover {
  background: #f8485e;
  border-color: #f8485e;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(248, 72, 94, 0.25);
}

.btn-icon-action.btn-freeze {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
}

.btn-icon-action.btn-freeze:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-icon-action.btn-duplicate {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #56555a;
}

.btn-icon-action.btn-duplicate:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.btn-icon-action.btn-excel {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

.btn-icon-action.btn-excel:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-icon-action.btn-pdf {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.3);
  color: #f8485e;
}

.btn-icon-action.btn-pdf:hover {
  background: #f8485e;
  border-color: #f8485e;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(248, 72, 94, 0.25);
}

/* --------------------------------------------------------------------------
   8. GLOBAL FORM CONTROLS (CUSTOM INPUTS & SELECTS) - DEVOTEAM LIGHT THEME
   -------------------------------------------------------------------------- */
/* Hide spin arrows in number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
}
.custom-input,
.custom-select,
.input-compact,
.select-compact,
.form-group-compact input,
.form-group-compact select,
.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="password"],
select,
textarea {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 0.45rem 0.75rem !important;
  color: #1e293b !important;
  font-size: 12.5px !important;
  font-family: var(--font-body) !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  box-sizing: border-box !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1e293b !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

.custom-select,
.select-compact,
.form-group select,
select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2356555A' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 0.75rem !important;
  padding-right: 2rem !important;
  cursor: pointer !important;
}

.custom-input:focus,
.custom-select:focus,
.input-compact:focus,
.select-compact:focus,
.form-group input:focus,
.form-group select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(248, 72, 94, 0.5) !important;
  box-shadow: 0 0 0 2px rgba(248, 72, 94, 0.15) !important;
}

select option,
.custom-select option,
.select-compact option,
.form-group select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
  padding: 8px !important;
}

.custom-input:read-only,
.custom-select:disabled,
input:read-only,
select:disabled {
  background-color: #f8fafc !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
  cursor: not-allowed;
}

/* Fields Grid */
.meta-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.85rem;
}

@media (max-width: 1100px) {
  .meta-fields-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .meta-fields-grid {
    grid-template-columns: 1fr;
  }
}

.form-group-compact {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group-compact label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-group-compact label i, .form-group-compact label svg {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   9. BUTTONS
   -------------------------------------------------------------------------- */
.btn-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #f8485e 0%, #e0364c 100%);
  border: 1px solid rgba(248, 72, 94, 0.4);
  color: #ffffff;
  padding: 0 1rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(248, 72, 94, 0.25);
  white-space: nowrap;
}

.btn-primary-action:hover:not(:disabled) {
  background: #e0364c;
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.35);
  transform: translateY(-1px);
}

.btn-primary-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary-action i, .btn-primary-action svg {
  width: 15px;
  height: 15px;
}

.btn-freeze-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  padding: 0 0.95rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.btn-freeze-action:hover:not(:disabled) {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transform: translateY(-1px);
}

.btn-freeze-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-freeze-action i, .btn-freeze-action svg {
  width: 14px;
  height: 14px;
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #56555a;
  padding: 0 0.85rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.btn-secondary-action:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.btn-secondary-action.btn-danger-hover:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-secondary-action i, .btn-secondary-action svg {
  width: 14px;
  height: 14px;
}

.btn-icon-table-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.btn-icon-table-action:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-icon-table-action i, .btn-icon-table-action svg {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   10. SCENARIOS TOOLBAR
   -------------------------------------------------------------------------- */
.scenarios-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.scenario-discount-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff1f3;
  border: 1px solid rgba(248, 72, 94, 0.25);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  margin-left: auto;
  margin-right: 0.5rem;
}

.scenario-discount-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #f8485e;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  white-space: nowrap;
}

.scenario-discount-group label i,
.scenario-discount-group label svg {
  width: 14px;
  height: 14px;
  color: #f8485e;
}

.scenario-discount-input-wrapper {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(248, 72, 94, 0.35);
  border-radius: 6px;
  padding: 2px 8px 2px 6px;
  transition: all 0.2s ease;
}

.scenario-discount-input-wrapper:focus-within {
  border-color: #f8485e;
  box-shadow: 0 0 0 2px rgba(248, 72, 94, 0.15);
  background: #ffffff;
}

.scenario-discount-input {
  width: 50px !important;
  height: 24px !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  color: #f8485e !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-align: right !important;
  padding: 0 3px 0 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.scenario-discount-input::-webkit-inner-spin-button,
.scenario-discount-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.scenario-discount-unit,
.scenario-discount-input-wrapper .unit-symbol {
  font-size: 12px;
  font-weight: 700;
  color: #f8485e;
  user-select: none;
  pointer-events: none;
  margin-left: 2px;
  position: static !important;
}

.scenarios-tabs-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.scenario-tab-btn {
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  color: #56555a;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.scenario-tab-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.scenario-tab-btn.active {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.3);
  color: #f8485e;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(248, 72, 94, 0.1);
}

.scenario-stats-pill {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.scenarios-actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   11. PHASES & ITEMS TABLE (CORE DELIVERY GRID)
   -------------------------------------------------------------------------- */
.phases-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.phase-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phase-card:hover {
  border-color: rgba(248, 72, 94, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.phase-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.phase-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.phase-title-group i, .phase-title-group svg {
  color: #f8485e;
  width: 18px;
  height: 18px;
}

.phase-name-input {
  background: transparent;
  border: 1px dashed transparent;
  color: #1e293b;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  outline: none;
  min-width: 220px;
  transition: all 0.2s;
}

.phase-name-input:hover {
  border-color: #cbd5e1;
}

.phase-name-input:focus {
  background: #ffffff;
  border-color: rgba(248, 72, 94, 0.5);
  box-shadow: 0 0 0 2px rgba(248, 72, 94, 0.15);
}

.phase-summary-pill {
  font-size: 0.78rem;
  color: #56555a;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.phase-summary-pill span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.phase-summary-pill strong {
  font-family: var(--font-mono);
  color: #1e293b;
}

.phase-actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Items Table */
.items-table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.items-table th {
  background: #f8fafc;
  color: #56555a;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.items-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.items-table tbody tr {
  transition: background 0.15s ease;
}

.items-table tbody tr:hover {
  background: #f8fafc;
}

/* Inputs Inside Table Rows */
.items-table input.item-field,
.items-table select.item-field {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  border-radius: 5px !important;
  padding: 0.35rem 0.5rem !important;
  font-size: 12px !important;
  font-family: var(--font-mono) !important;
  outline: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  text-align: right !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}

.items-table input.item-field.text-left {
  text-align: left !important;
  font-family: var(--font-body) !important;
}

.items-table input.item-field:focus,
.items-table select.item-field:focus {
  border-color: rgba(248, 72, 94, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(248, 72, 94, 0.15) !important;
  background-color: #ffffff !important;
}

.items-table input.item-field:read-only,
.items-table select.item-field:disabled {
  background: transparent !important;
  border-color: transparent !important;
  color: #1e293b !important;
  cursor: default !important;
}

.badge-calc {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #1e293b;
}

.phase-footer {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Big Add & Copy Phase Buttons */
.add-phase-wrapper {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-add-phase-large,
.btn-copy-phase-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex: 1 1 260px;
  max-width: 320px;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-phase-large {
  background: #fff1f3;
  border: 1px dashed rgba(248, 72, 94, 0.45);
  color: #f8485e;
}

.btn-add-phase-large:hover {
  background: #ffe4e8;
  border-color: #f8485e;
  color: #e0364c;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.2);
}

.btn-add-phase-large i, .btn-add-phase-large svg {
  width: 18px;
  height: 18px;
  color: #f8485e;
}

.btn-copy-phase-large {
  background: #f0f9ff;
  border: 1px dashed rgba(2, 132, 199, 0.45);
  color: #0284c7;
}

.btn-copy-phase-large:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
}

.btn-copy-phase-large i, .btn-copy-phase-large svg {
  width: 18px;
  height: 18px;
  color: #0284c7;
}

/* --------------------------------------------------------------------------
   12. VIEW 2 & 3: TABLES & CATALOG
   -------------------------------------------------------------------------- */
.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title-group h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  font-family: var(--font-heading);
}

.card-title-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1f3;
  color: #f8485e;
  border: 1px solid rgba(248, 72, 94, 0.25);
  font-weight: 600;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper i, .search-input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  width: 14px;
  height: 14px;
  color: #56555a;
  pointer-events: none;
}

.search-input-wrapper input.search-box {
  padding-left: 2.2rem !important;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.psfs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.psfs-table th {
  background: #f8fafc;
  color: #56555a;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.psfs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.psfs-table tbody tr {
  transition: background 0.15s ease;
}

.psfs-table tbody tr:hover {
  background: #f8fafc;
}

/* Catalog Filter Pills */
.catalog-filters-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cat-filter-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-filter-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.cat-filter-btn.active {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.35);
  color: #f8485e;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   13. MODALS (DEVOTEAM LIGHT DIALOGS)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  width: 100%;
  max-width: 950px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* Modal catálogo con altura fija y estable para evitar que la ventana salte al filtrar */
#modal-catalog-picker .modal-content-card {
  height: 82vh;
  max-height: 82vh;
  min-height: 560px;
}

#modal-catalog-picker .modal-body {
  display: flex;
  flex-direction: column;
  height: calc(100% - 64px);
  padding: 1.25rem 1.5rem;
  overflow: hidden;
}

#modal-catalog-picker .modal-table-scroll {
  flex: 1;
  min-height: 360px;
  max-height: calc(82vh - 180px);
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

/* Vista catálogo completa con altura mínima estable */
#view-catalog {
  min-height: 75vh;
}

#view-catalog .table-responsive {
  min-height: 520px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.modal-close-btn i, .modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: #56555a;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   14. LOADER & TOASTS
   -------------------------------------------------------------------------- */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(248, 72, 94, 0.15);
  border-radius: 50%;
  border-top-color: #f8485e;
  border-bottom-color: #f8485e;
  animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  box-shadow: 0 0 16px rgba(248, 72, 94, 0.2);
  margin-bottom: 1.5rem;
}

.loader-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  color: #56555A;
  font-weight: 500;
  animation: pulseText 2s infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseText {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: slideToast 0.25s ease-out;
}

.toast-item.success {
  border-color: #bbf7d0;
  color: #16a34a;
  background: #f0fdf4;
}

.toast-item.error {
  border-color: #fecaca;
  color: #dc2626;
  background: #fef2f2;
}

.toast-item.info {
  border-color: #bae6fd;
  color: #0284c7;
  background: #f0f9ff;
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Toast and Form compatibility aliases */
.toast, .toast-item {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: slideToast 0.25s ease-out;
}

.toast.toast-success, .toast-item.success {
  border-color: #bbf7d0;
  color: #16a34a;
  background: #f0fdf4;
}

.toast.toast-error, .toast-item.error {
  border-color: #fecaca;
  color: #dc2626;
  background: #fef2f2;
}

.toast.toast-info, .toast-item.info {
  border-color: #bae6fd;
  color: #0284c7;
  background: #f0f9ff;
}

.toast i, .toast svg, .toast-item i, .toast-item svg {
  width: 16px;
  height: 16px;
}

.btn-action-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #f8485e 0%, #e0364c 100%);
  border: 1px solid rgba(248, 72, 94, 0.4);
  color: #ffffff;
  padding: 0 1rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(248, 72, 94, 0.25);
  white-space: nowrap;
}

.btn-action-primary:hover:not(:disabled) {
  background: #e0364c;
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.35);
  transform: translateY(-1px);
}

.btn-action-freeze {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  padding: 0 0.95rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.btn-action-freeze:hover:not(:disabled) {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transform: translateY(-1px);
}

.btn-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #56555a;
  padding: 0 0.85rem;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.btn-action-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.btn-delete-item:hover i, .btn-delete-item:hover svg {
  color: #dc2626;
}

/* --------------------------------------------------------------------------
   15. HITOS DE FACTURACIÓN (BILLING MILESTONES)
   -------------------------------------------------------------------------- */
.milestones-container {
  margin-top: 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  position: relative;
}

.milestones-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff1f3;
  border: 1px solid rgba(248, 72, 94, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #f8485e;
}

.milestones-scenario-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fff1f3;
  color: #f8485e;
  border: 1px solid rgba(248, 72, 94, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.milestones-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.milestone-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.milestone-badge-pill i, .milestone-badge-pill svg {
  width: 14px;
  height: 14px;
}

.milestone-badge-pill.balance-ok {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1);
}

.milestone-badge-pill.balance-pending {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.milestone-badge-pill.balance-exceeded {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.milestones-presets-dropdown-container {
  position: relative;
}

.presets-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 0.4rem;
  z-index: 100;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.presets-menu-dropdown.hidden {
  display: none !important;
}

.preset-option-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
}

.preset-option-btn:hover {
  background: #f1f5f9;
}

.preset-option-btn .preset-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.preset-option-btn .preset-desc {
  font-size: 0.72rem;
  color: #56555a;
  margin-top: 2px;
}

.btn-add-milestone {
  background: #fff1f3;
  border-color: rgba(248, 72, 94, 0.35);
  color: #f8485e;
}

.btn-add-milestone:hover {
  background: #ffe4e8;
  border-color: #f8485e;
  color: #e0364c;
}

.milestones-table th {
  background: #f8fafc;
  color: #56555a;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.milestones-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.ms-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.milestone-input {
  width: 100%;
  padding: 0.45rem 0.6rem !important;
  font-size: 0.82rem;
  border-radius: 6px;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

.milestone-input.ms-pct,
.milestone-input.ms-amt {
  padding-right: 2.1rem !important;
  text-align: right !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.milestone-input.ms-pct::-webkit-inner-spin-button,
.milestone-input.ms-pct::-webkit-outer-spin-button,
.milestone-input.ms-amt::-webkit-inner-spin-button,
.milestone-input.ms-amt::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ms-input-wrapper .ms-unit-symbol {
  position: absolute;
  right: 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #56555a;
  pointer-events: none;
}

.milestone-input:focus {
  border-color: rgba(248, 72, 94, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(248, 72, 94, 0.15) !important;
}

.milestones-total-row td {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  padding: 0.75rem 0.6rem;
  color: #1e293b;
}

/* --------------------------------------------------------------------------
   16. MODAL PDF CLIENTE Y ESTILOS DE DOCUMENTO CORPORATIVO
   -------------------------------------------------------------------------- */
.modal-pdf-preview {
  max-width: 1050px;
  width: 95%;
  height: 92vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}

.pdf-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-download-pdf-cta {
  background: linear-gradient(135deg, #f8485e 0%, #e0364c 100%) !important;
  border-color: #f8485e !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(248, 72, 94, 0.3) !important;
}

.btn-download-pdf-cta:hover {
  background: #e0364c !important;
  box-shadow: 0 6px 18px rgba(248, 72, 94, 0.45) !important;
}

.modal-pdf-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 0 0 12px 12px;
}

.pdf-notice-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  color: #166534;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

/* Contenedor del visor nativo de PDF en modal */
.pdf-viewer-container {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 480px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.pdf-viewer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
}

.pdf-preview-spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid #cbd5e1;
  border-top-color: #f8485e;
  border-radius: 50%;
  animation: pdf-spin 0.9s linear infinite;
}

@keyframes pdf-spin {
  to { transform: rotate(360deg); }
}

.pdf-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  background: #ffffff;
}

/* DOCUMENTO IMPRESO / EXPORTADO (A4 LOOK & FEEL) */
.client-pdf-document {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.8rem;
  box-sizing: border-box;
  border-radius: 4px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 9.5pt;
  line-height: 1.45;
}

.client-pdf-document h1,
.client-pdf-document h2,
.client-pdf-document h3,
.client-pdf-document h4 {
  font-family: 'Outfit', 'Inter', sans-serif;
  color: #1e293b;
  margin: 0;
}

/* Encabezado del documento */
.pdf-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 3px solid #f8485e; /* Devoteam Coral Red */
  padding-bottom: 1.5rem;
  margin-bottom: 1.8rem;
}

.pdf-brand-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pdf-devoteam-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
  margin-bottom: 0.25rem;
}

.pdf-brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1e2229;
}

.pdf-brand-subtitle {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.1rem;
}

.pdf-meta-box {
  text-align: right;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.35;
}

.pdf-meta-code {
  font-family: monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e2229;
}

/* Ficha resumen */
.pdf-summary-grid {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pdf-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
}

.pdf-summary-col {
  flex: 1;
}

.pdf-summary-scope {
  width: 100%;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.25rem;
  margin-top: 0.1rem;
  font-size: 0.76rem;
  line-height: 1.35;
}

.pdf-info-row {
  margin-bottom: 0.15rem;
  font-size: 0.78rem;
}

.pdf-info-label {
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin-right: 0.35rem;
}

.pdf-info-val {
  color: #1e293b;
  font-weight: 600;
}

/* Tablas del documento */
.pdf-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e2229;
  border-left: 3.5px solid #f8485e; /* Devoteam Coral Red */
  padding-left: 0.5rem;
  margin: 0.65rem 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.45rem;
  font-size: 0.76rem;
}

.pdf-table th {
  background: #f1f5f9; /* Suave pizarra corporativo, no estridente */
  color: #1e293b;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.5rem;
  border-top: 2px solid #f8485e; /* Fino acento rojo corporativo */
  border-bottom: 1.5px solid #cbd5e1;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
}

.pdf-table td {
  padding: 0.3rem 0.5rem;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  line-height: 1.3;
}

.pdf-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.pdf-table tfoot td {
  background: #fff5f6;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
  border-top: 2px solid #f8485e;
  font-size: 0.78rem;
}

/* Banner de Cierre Económico (Rojo Corporativo) */
.pdf-grand-total-banner {
  background: linear-gradient(135deg, #f8485e 0%, #e02f45 100%);
  border-left: 5px solid #1e2229; /* Acento oscuro */
  color: #ffffff;
  border-radius: 6px;
  padding: 0.65rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.65rem 0 0.35rem 0;
  box-shadow: 0 3px 12px rgba(248, 72, 94, 0.2);
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pdf-grand-total-banner .total-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-grand-total-banner .total-amount {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
}

/* Estructura de Páginas A4 Estandarizada */
.pdf-page {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  width: 700px !important;
  height: 1020px !important;
  min-height: 1020px !important;
  max-height: 1020px !important;
  box-sizing: border-box !important;
  padding: 24px 28px !important;
  background: #ffffff !important;
  position: relative !important;
  overflow: hidden !important;
  margin-bottom: 24px;
}

.pdf-page-content {
  flex: 1 1 auto !important;
  width: 100% !important;
  overflow: hidden !important;
}

.pdf-page-bottom {
  margin-top: auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pdf-page-footer {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.7rem !important;
  color: #94a3b8 !important;
  border-top: 1px solid #f1f5f9 !important;
  padding-top: 0.35rem !important;
  margin-top: 0.4rem !important;
  margin-bottom: 0 !important;
}

/* Condiciones y firmas uno al lado del otro */
.pdf-signatures-grid {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  gap: 1.25rem !important;
  margin-top: 1rem !important;
  padding-top: 0.75rem !important;
  border-top: 1px solid #e2e8f0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pdf-signature-box {
  flex: 1 1 0 !important;
  width: calc(50% - 0.65rem) !important;
  border: 1px dashed #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 0.75rem 0.9rem !important;
  min-height: 100px !important;
  box-sizing: border-box !important;
}

.pdf-signature-box .sig-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

/* REGLAS DE PAGINACIÓN Y CONTROL DE CORTE PARA PDF A4 */
.html2pdf__page-break,
.pdf-page-break {
  page-break-before: always !important;
  break-before: page !important;
  display: block !important;
  clear: both !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.pdf-continuation-header {
  margin-top: 0 !important;
  margin-bottom: 0.6rem;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pdf-continuation-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f8485e; /* Devoteam coral */
  padding-bottom: 0.6rem;
}

.pdf-continuation-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pdf-continuation-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.pdf-continuation-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e2229;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-continuation-meta {
  font-size: 0.75rem;
  color: #64748b;
  text-align: right;
}

.pdf-phase-container {
  margin-bottom: 0.9rem;
  page-break-inside: avoid;
  break-inside: avoid;
}

.pdf-section-title {
  page-break-after: avoid !important;
  break-after: avoid !important;
}

.pdf-table thead {
  display: table-header-group;
}

.pdf-table tr {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pdf-table td,
.pdf-table th {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pdf-summary-grid,
.pdf-grand-total-banner,
.pdf-signatures-grid,
.pdf-signature-box,
.pdf-doc-header {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.client-pdf-offscreen-wrapper {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 700px;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* REGLAS PARA IMPRESIÓN OFICIAL (@media print) */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 210mm !important;
    height: auto !important;
    overflow: visible !important;
  }

  body * {
    visibility: hidden !important;
  }

  /* Solo el contenido del documento PDF imprimible es visible */
  #client-pdf-printable,
  #client-pdf-printable * {
    visibility: visible !important;
  }

  #modal-client-pdf,
  .modal-overlay,
  .modal-content-card,
  .modal-pdf-preview,
  .modal-body,
  .modal-pdf-scroll,
  #client-pdf-offscreen-wrapper {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  .modal-header,
  .pdf-modal-actions,
  .pdf-notice-banner,
  #pdf-viewer-container,
  .pdf-viewer-container,
  #pdf-preview-iframe,
  .toast-container,
  .app-sidebar,
  .navbar,
  .top-bar,
  header,
  footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .client-pdf-document {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    background: transparent !important;
  }

  .html2pdf__page-break,
  .pdf-page-break {
    display: none !important;
  }

  .pdf-table tr,
  .pdf-table td,
  .pdf-table th,
  .pdf-phase-container,
  .pdf-summary-grid,
  .pdf-grand-total-banner,
  .pdf-signatures-grid,
  .pdf-signature-box,
  .pdf-doc-header,
  .pdf-continuation-header {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .pdf-page {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 210mm !important;
    max-width: 210mm !important;
    height: 295mm !important;
    min-height: 295mm !important;
    max-height: 295mm !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin: 0 !important;
    padding: 10mm 14mm !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  /* Salto de página limpio ÚNICAMENTE antes de las páginas siguientes, evitando páginas en blanco al final o intermedias */
  .pdf-page + .pdf-page {
    page-break-before: always !important;
    break-before: page !important;
  }

  .pdf-page-bottom {
    margin-top: auto !important;
  }

  .pdf-signatures-grid {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
  }

  .pdf-signature-box {
    flex: 1 1 0 !important;
    width: 48% !important;
  }
}

/* ==========================================================================
   ENHANCEMENTS: SORTING, SLIDES, BUSINESS AREA & GLOBAL SCENARIOS
   ========================================================================== */

/* Neon Margin KPI Card Highlight */
.kpi-card.kpi-card-critical-margin {
  border: 2px solid #ff0055 !important;
  background: linear-gradient(135deg, #ffffff 0%, #fff1f3 100%) !important;
  box-shadow: 0 0 16px rgba(255, 0, 85, 0.4) !important;
}

.kpi-card.kpi-card-critical-margin .kpi-value {
  color: #ff0055 !important;
  font-weight: 800 !important;
  text-shadow: 0 0 10px rgba(255, 0, 85, 0.35);
}

.badge-calc.margin-critical {
  background: #ff0055 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: 1px solid #d90048 !important;
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.6) !important;
}

/* Sortable Table Headers */
th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

th.sortable-th:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.sort-icon-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 0.75rem;
  opacity: 0.4;
  vertical-align: middle;
}

th.sortable-th.sorted-asc .sort-icon-indicator,
th.sortable-th.sorted-desc .sort-icon-indicator {
  opacity: 1;
  color: #f8485e;
  font-weight: 800;
}

/* Business Area Badge */
.badge-area {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.badge-area-cloud { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.badge-area-data { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.badge-area-workspace { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.badge-area-security { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.badge-area-software { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

/* Google Slides Link Button */
.btn-slides-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-slides-link:hover {
  background: #fde68a;
  color: #92400e;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.25);
}

/* Global Scenarios Multi-Sum View */
.tab-global-sum {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.tab-global-sum.active {
  background: linear-gradient(135deg, #f8485e 0%, #e11d48 100%) !important;
  color: #ffffff !important;
  border-color: #f8485e !important;
  box-shadow: 0 2px 10px rgba(248, 72, 94, 0.4) !important;
}

.scenario-include-chk {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
}

.scenario-include-chk input[type="checkbox"] {
  cursor: pointer;
  accent-color: #f8485e;
  width: 14px;
  height: 14px;
}

.global-scenarios-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.global-scenario-item-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  background: #ffffff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.global-scenario-item-card.is-selected {
  border-color: #3b82f6;
  background: #f8faff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.global-scenario-item-card.is-unselected {
  opacity: 0.65;
  background: #f8fafc;
  border-style: dashed;
}

.global-stat-card {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.global-stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.global-stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

/* Header Unit Switcher final override against global select rules */
.badge-unit-active select,
#header-unit-switcher {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #047857 !important;
  font-family: 'Outfit', sans-serif !important;
  cursor: pointer !important;
  outline: none !important;
  padding: 0 4px !important;
  margin: 0 !important;
  box-shadow: none !important;
  height: auto !important;
  width: auto !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
}

.badge-unit-active select option,
#header-unit-switcher option {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 500 !important;
  padding: 6px 12px !important;
}



