/* ==========================================================================
   Calculadora de Nómina Mensual PWA - Modern Responsive CSS
   ========================================================================== */

:root {
  /* Paleta cromática principal */
  --bg-primary: #0f172a;        /* Slate 900 */
  --bg-secondary: #1e293b;      /* Slate 800 */
  --bg-card: #1e293b;
  --bg-card-hover: #243248;
  --bg-input: #0f172a;
  --border-color: #334155;      /* Slate 700 */
  --border-focus: #10b981;      /* Emerald 500 */

  /* Colores de acento y semánticos */
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --rose-500: #f43f5e;
  --rose-400: #fb7185;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --cyan-500: #06b6d4;
  --amber-500: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --indigo-500: #6366f1;

  /* Tipografía */
  --text-main: #f8fafc;         /* Slate 50 */
  --text-muted: #94a3b8;        /* Slate 400 */
  --text-dim: #64748b;          /* Slate 500 */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Sombras y elevaciones */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);

  /* Bordes */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transiciones */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reseteo y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Enlaces y botones base */
a {
  color: var(--emerald-400);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   Layout Principal
   ========================================================================== */

.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem;
  width: 100%;
  flex: 1;
}

/* Cabecera */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--emerald-500), var(--cyan-500));
  color: #0f172a;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Indicadores de estado */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-pill.online {
  background: var(--emerald-bg);
  color: var(--emerald-400);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-pill.online .status-dot {
  background: var(--emerald-400);
  box-shadow: 0 0 8px var(--emerald-400);
}

.status-pill.offline {
  background: var(--amber-bg);
  color: var(--amber-500);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.status-pill.offline .status-dot {
  background: var(--amber-500);
  box-shadow: 0 0 8px var(--amber-500);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.save-pill {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: var(--transition);
}
.save-pill.saved-active {
  color: var(--emerald-400);
}

/* Botones genéricos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500), #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-install {
  background: linear-gradient(135deg, var(--indigo-500), #4f46e5);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  animation: bounce-subtle 3s infinite;
}
.btn-install:hover {
  filter: brightness(1.15);
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.76rem;
}

.btn-danger-outline {
  color: var(--rose-400);
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.btn-danger-outline:hover {
  background: var(--rose-bg);
  border-color: var(--rose-500);
}

/* ==========================================================================
   Banner de Actualizaciones y Toasts
   ========================================================================== */

.update-banner {
  background: linear-gradient(90deg, #1e1b4b, #312e81);
  color: #e0e7ff;
  border-bottom: 1px solid #4338ca;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 400px;
}
.toast-success {
  background: #064e3b;
  color: #a7f3d0;
  border: 1px solid #059669;
}
.toast-warning {
  background: #78350f;
  color: #fde68a;
  border: 1px solid #d97706;
}
.toast-info {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid var(--border-color);
}
.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Grid Principal & Columnas
   ========================================================================== */

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }

  .sticky-sidebar {
    position: sticky;
    top: 5rem;
  }
}

/* Pestañas para navegación en móvil */
.mobile-tabs {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

@media (min-width: 1024px) {
  .mobile-tabs {
    display: none; /* En desktop ambas columnas se ven completas */
  }
}

.mobile-tab-btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.mobile-tab-btn.active {
  background: var(--emerald-500);
  color: #0f172a;
  border-color: var(--emerald-400);
}

@media (max-width: 1023px) {
  .hidden-mobile {
    display: none !important;
  }
}

/* ==========================================================================
   Tarjetas (Cards) y Contenedores
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(148, 163, 184, 0.25);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-title-icon {
  font-size: 1.25rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Formularios e Inputs
   ========================================================================== */

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label small {
  color: var(--text-dim);
  font-weight: normal;
}

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

.input-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
}

.input-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.input-control.has-suffix {
  padding-right: 2.2rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

.input-suffix {
  position: absolute;
  right: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.85rem;
  pointer-events: none;
}

select.input-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* Destacado para el campo IRPF */
.irpf-highlight-box {
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 0.5rem;
}

.irpf-highlight-box .form-label {
  color: var(--rose-400);
}

.irpf-highlight-box .input-control:focus {
  border-color: var(--rose-400);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

/* ==========================================================================
   Registro de Horas Extras
   ========================================================================== */

.he-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.he-tariffs-row {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.he-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.he-table th {
  text-align: left;
  padding: 0.65rem 0.6rem;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.he-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  vertical-align: middle;
}

.he-row:hover {
  background: var(--bg-card-hover);
}

.row-saturday {
  background: rgba(245, 158, 11, 0.06);
}

.row-sunday {
  background: rgba(100, 116, 139, 0.08);
}

.dia-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dia-num {
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
}

.dia-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
}

.badge-sat {
  background: var(--amber-bg);
  color: var(--amber-500);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-sun {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.badge-weekday {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-dim);
}

.input-with-suffix {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 82px;
}

.input-table-he {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.35rem 1.4rem 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: right;
}

.input-table-he:focus {
  outline: none;
  border-color: var(--border-focus);
}

.input-highlight-sat:focus {
  border-color: var(--amber-500);
}

.input-with-suffix .suffix {
  position: absolute;
  right: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  pointer-events: none;
}

.input-notas {
  width: 100%;
  min-width: 120px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
}

.input-notas:focus {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: #fff;
  outline: none;
}

.subtotal-col {
  color: var(--emerald-400);
}

.btn-icon-delete {
  color: var(--text-dim);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.btn-icon-delete:hover {
  color: var(--rose-400);
  background: var(--rose-bg);
}

/* Resumen pie de horas extras */
.he-summary-badges {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.he-badge-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
}

.he-badge-item span {
  color: var(--text-muted);
}
.he-badge-item strong {
  color: #fff;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Panel de Resumen Principal y KPIs
   ========================================================================== */

.hero-neto-card {
  background: linear-gradient(135deg, #064e3b 0%, #0f172a 70%, #1e1b4b 100%);
  border: 1px solid #059669;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.2);
  position: relative;
  overflow: hidden;
}

.hero-neto-card::before {
  content: "€";
  position: absolute;
  right: -0.5rem;
  bottom: -2.5rem;
  font-size: 11rem;
  font-weight: 900;
  color: rgba(16, 185, 129, 0.05);
  pointer-events: none;
  line-height: 1;
}

.hero-neto-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emerald-400);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-neto-amount {
  font-size: 2.45rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-neto-secondary {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #cbd5e1;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-neto-secondary strong {
  color: #fff;
  font-family: var(--font-mono);
}

/* Switch toggle de modo de cálculo */
.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.switch-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}
.switch-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: var(--transition);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--emerald-500);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-card-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

.kpi-highlight-positive {
  color: var(--emerald-400);
}

.kpi-highlight-negative {
  color: var(--rose-400);
}

/* Caja de Fórmula Explicativa */
.formula-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.formula-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.formula-expression {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.f-term {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}
.f-term small {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-muted);
  display: block;
}

.f-bruto { color: #38bdf8; }
.f-extra { color: #a7f3d0; }
.f-irpf { color: var(--rose-400); }
.f-op { color: var(--text-dim); font-size: 1.1rem; }
.f-result {
  color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald-500);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.formula-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Tablas de Desglose
   ========================================================================== */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.6rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.data-table tfoot td {
  padding: 0.75rem 0.6rem;
  border-top: 1px solid var(--border-color);
}

.concept-name {
  font-weight: 500;
  color: var(--text-main);
}
.concept-badge {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.type-pill {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  font-weight: 600;
}
.type-fijo { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.type-variable { background: var(--amber-bg); color: var(--amber-500); }
.type-prorrata { background: var(--emerald-bg); color: var(--emerald-400); }

.row-subtotal {
  background: rgba(15, 23, 42, 0.5);
  font-weight: 600;
}
.row-total {
  background: rgba(15, 23, 42, 0.8);
  font-size: 0.95rem;
}

.row-irpf-highlight {
  background: rgba(244, 63, 94, 0.05);
}

/* ==========================================================================
   Modales
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ==========================================================================
   Utilidades y Tipografía
   ========================================================================== */

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-emerald { color: var(--emerald-400); }
.text-rose { color: var(--rose-400); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.block { display: block; }
.hidden { display: none !important; }

/* Pie de página */
.app-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Estilos de Impresión (@media print)
   ========================================================================== */

@media print {
  /* Ocultar elementos de navegación y control interactivo */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .app-header,
  .mobile-tabs,
  .btn,
  .btn-icon-delete,
  .he-toolbar,
  .switch-wrapper,
  .modal-backdrop,
  .toast,
  .update-banner,
  .save-pill,
  .app-footer,
  .action-col,
  input[type="file"],
  #fileImportInput {
    display: none !important;
  }

  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .main-grid {
    display: block !important;
  }

  .card {
    border: 1px solid #ccc !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    margin-bottom: 1rem !important;
    page-break-inside: avoid;
  }

  .card-title {
    color: #000000 !important;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.35rem;
  }

  .hero-neto-card {
    background: #f8fafc !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
  }

  .hero-neto-card::before { display: none; }
  .hero-neto-label { color: #333333 !important; }
  .hero-neto-amount { color: #000000 !important; }

  .data-table th, .he-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border-bottom: 1px solid #000 !important;
  }

  .data-table td, .he-table td {
    color: #000000 !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .input-control, .input-table-he, .input-notas {
    background: transparent !important;
    border: none !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  .print-header-sheet {
    display: block !important;
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }

  .print-header-title {
    font-size: 18pt;
    font-weight: bold;
    text-transform: uppercase;
  }
}

.print-header-sheet {
  display: none;
}
