/* ============================================
   CALCULADORAS-ES.ES — Hoja de estilos principal
   ============================================ */

/* ============================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   ============================================ */

:root {
  /* Variables modo claro (por defecto) */
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --secondary: #059669;
  --accent: #f59e0b;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(30,64,175,0.15), 0 8px 24px rgba(30,64,175,0.1);
  --transition: 0.2s ease;
  --max-width: 1100px;
  --focus-ring: 0 0 0 3px rgba(59,130,246,0.5);
  --card-bg: #ffffff;
  --header-bg: #1e3a8a;
  --footer-bg: #1e3a8a;
  --hero-gradient: linear-gradient(135deg, #1e3a8a 0%, #1e40af 60%, #2563eb 100%);
  
  /* Variables específicas para iconos y badges */
  --icon-fiscal: #1e40af;
  --icon-laboral: #059669;
  --badge-fiscal-bg: #eff6ff;
  --badge-laboral-bg: #ecfdf5;
}

/* Modo oscuro (por botón o preferencia del sistema) */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --primary-dark: #2563eb;
  --secondary: #10b981;
  --accent: #fbbf24;
  --danger: #ef4444;
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-hover: 0 4px 12px rgba(59,130,246,0.3), 0 8px 24px rgba(59,130,246,0.2);
  --card-bg: #1e293b;
  --header-bg: #0f172a;
  --footer-bg: #0f172a;
  --hero-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #2563eb 100%);
  
  /* Variables específicas modo oscuro */
  --icon-fiscal: #60a5fa;
  --icon-laboral: #10b981;
  --badge-fiscal-bg: #2d3a4f;
  --badge-laboral-bg: #2d3a4f;
}

/* Preferencia del sistema (si no hay data-theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --accent: #fbbf24;
    --danger: #ef4444;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.4);
    --shadow-hover: 0 4px 12px rgba(59,130,246,0.3), 0 8px 24px rgba(59,130,246,0.2);
    --card-bg: #1e293b;
    --header-bg: #0f172a;
    --footer-bg: #0f172a;
    --hero-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #2563eb 100%);
    
    --icon-fiscal: #60a5fa;
    --icon-laboral: #10b981;
    --badge-fiscal-bg: #2d3a4f;
    --badge-laboral-bg: #2d3a4f;
  }
}

/* --- Reset y estilos base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }
a  { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
main { flex: 1; }

/* --- Header / Nav --- */
header {
  background: var(--header-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  position: sticky; top: 0; z-index: 100;
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; max-width: var(--max-width); margin: 0 auto;
}

.logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.25rem; font-weight: 700; color: #fff; text-decoration: none;
}
.logo svg { width: 32px; height: 32px; flex-shrink: 0; }
.logo span { color: var(--accent); }

nav { display: flex; align-items: center; gap: 0.25rem; }
nav a {
  color: #cbd5e1; font-size: 0.9rem; font-weight: 500;
  padding: 0.45rem 0.85rem; border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
nav a:hover, nav a.active { background: rgba(255,255,255,0.12); color: #fff; }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer; padding: 0.4rem;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: #fff; margin: 5px 0;
  transition: var(--transition);
}

/* --- Header Controls y Botón Modo Oscuro --- */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all var(--transition);
  padding: 0;
  margin-right: 0.5rem;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.theme-toggle:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.5s ease;
}

.theme-toggle:active svg {
  transform: rotate(360deg);
}

/* --- Hero --- */
.hero {
  background: var(--hero-gradient);
  color: #fff; padding: 4rem 1.25rem 3.5rem; text-align: center;
}
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.8rem); font-weight: 800; margin-bottom: 1rem; line-height: 1.2; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.1rem; color: #bfdbfe; max-width: 620px; margin: 0 auto 2rem; }
.hero-badges { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.badge {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 500;
}

/* --- Section Titles --- */
.section-title {
  font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 0.4rem;
}
.section-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 2rem; }
.section-header { margin-bottom: 2rem; }
.section-header .tag {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.25rem 0.75rem; border-radius: 999px; margin-bottom: 0.6rem;
}

/* --- Cards Grid --- */
.tools-section { padding: 3rem 0; }
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.25rem;
}
.tool-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.75rem;
}
.tool-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-hover); text-decoration: none;
}
.tool-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #eff6ff; flex-shrink: 0;
}
.tool-card-icon svg { width: 26px; height: 26px; }
.tool-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.tool-card p  { font-size: 0.875rem; color: var(--text-muted); flex: 1; }
.tool-card-arrow {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 600; color: var(--primary-light); margin-top: 0.25rem;
}

/* --- Category Page Cards --- */
.cat-fiscal .tool-card-icon { 
  background: var(--badge-fiscal-bg, #eff6ff); 
}
.cat-fiscal .tool-card-icon svg { 
  color: var(--icon-fiscal, var(--primary)); 
  stroke: var(--icon-fiscal, var(--primary));
}
.cat-laboral .tool-card-icon { 
  background: var(--badge-laboral-bg, #ecfdf5); 
}
.cat-laboral .tool-card-icon svg { 
  color: var(--icon-laboral, var(--secondary)); 
  stroke: var(--icon-laboral, var(--secondary));
}

/* --- Breadcrumb --- */
.breadcrumb {
  padding: 0.9rem 0; font-size: 0.85rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary-light); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); }

/* --- Calculator Page Layout --- */
.calc-header {
  background: var(--hero-gradient);
  color: #fff; padding: 2.5rem 1.25rem 2rem;
}
.calc-header h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; margin-bottom: 0.5rem; }
.calc-header p  { color: #bfdbfe; font-size: 0.95rem; max-width: 600px; }

.calc-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  padding: 2rem 0; align-items: start;
}
@media (max-width: 768px) { .calc-layout { grid-template-columns: 1fr; } }

/* --- Card base --- */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden;
}
.card-header {
  background: #f8fafc; border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem; font-weight: 700; font-size: 0.95rem; color: var(--text);
  display: flex; align-items: center; gap: 0.5rem;
}
.card-header svg { width: 18px; height: 18px; color: var(--primary-light); flex-shrink:0; }
.card-body { padding: 1.25rem; }

/* --- Form --- */
.form-group { margin-bottom: 1.15rem; }
.form-group label {
  display: block; font-size: 0.875rem; font-weight: 600;
  color: var(--text); margin-bottom: 0.4rem;
}
.form-group label .tooltip-icon {
  display: inline-block; width: 16px; height: 16px; background: var(--border);
  border-radius: 50%; font-size: 0.7rem; text-align: center; line-height: 16px;
  cursor: help; color: var(--text-muted); margin-left: 0.3rem;
}
.form-control {
  width: 100%; padding: 0.65rem 0.9rem; font-size: 0.95rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-control:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
select.form-control { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.input-group { position: relative; }
.input-group .form-control { padding-right: 3rem; }
.input-group-suffix {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.85rem; font-weight: 600; pointer-events: none;
}

/* --- Button --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: var(--radius); font-size: 0.95rem;
  font-weight: 700; cursor: pointer; border: none; font-family: inherit;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary {
  background: var(--primary); color: #fff; width: 100%; margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,64,175,0.3); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn svg { width: 18px; height: 18px; }

/* --- Results --- */
.results-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); gap: 0.75rem;
}
.results-empty svg { width: 48px; height: 48px; opacity: 0.3; }
.results-empty p { font-size: 0.9rem; }

.result-highlight {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; text-align: center;
  border: 1px solid #bfdbfe;
}
.result-highlight .label { font-size: 0.8rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; }
.result-highlight .value { font-size: 2rem; font-weight: 800; color: var(--primary-dark); line-height: 1.1; margin: 0.25rem 0; }
.result-highlight .sub   { font-size: 0.85rem; color: var(--text-muted); }

.result-highlight.green { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-color: #a7f3d0; }
.result-highlight.green .label { color: var(--secondary); }
.result-highlight.green .value { color: #065f46; }

.result-highlight.amber { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #fde68a; }
.result-highlight.amber .label { color: #92400e; }
.result-highlight.amber .value { color: #78350f; }

.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .key { color: var(--text-muted); }
.result-row .val { font-weight: 600; color: var(--text); }
.result-row .val.positive { color: var(--secondary); }
.result-row .val.negative { color: var(--danger); }

.result-divider { border: none; border-top: 2px solid var(--border); margin: 0.5rem 0; }

/* --- Info Alert --- */
.alert {
  border-radius: var(--radius); padding: 0.85rem 1rem; font-size: 0.85rem;
  display: flex; gap: 0.6rem; align-items: flex-start; margin-top: 1rem;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 0.1rem; }
.alert-info   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-info   svg { color: #3b82f6; }
.alert-warning{ background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-warning svg { color: #f59e0b; }

/* --- SEO Content Block --- */
.seo-content {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 2rem; margin: 2rem 0;
  box-shadow: var(--shadow);
}
.seo-content h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text); }
.seo-content h3 { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--text); }
.seo-content p  { font-size: 0.93rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.7; }
.seo-content ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.seo-content li { font-size: 0.93rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 0.3rem; }

/* --- Tabla de tramos --- */
.tramos-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
.tramos-table th {
  background: var(--primary-dark); color: #fff; text-align: left;
  padding: 0.6rem 0.9rem; font-weight: 600;
}
.tramos-table td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); }
.tramos-table tr:nth-child(even) td { background: #f8fafc; }
.tramos-table tr:hover td { background: #eff6ff; }

/* --- Related Tools --- */
.related-tools { margin: 2rem 0; }
.related-tools h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.related-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1rem; display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--text); font-size: 0.875rem; font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.related-card:hover { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(59,130,246,0.15); text-decoration: none; }
.related-card svg { width: 20px; height: 20px; color: var(--primary-light); flex-shrink: 0; }

/* --- AdSense Placeholder --- */
.ad-slot {
  background: #f8fafc; border: 2px dashed var(--border); border-radius: var(--radius);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem; margin: 1.5rem 0; text-align: center;
}
.ad-slot-large { min-height: 250px; }

/* --- Footer --- */
footer {
  background: var(--footer-bg); color: #94a3b8; margin-top: auto;
  padding: 2.5rem 1.25rem 1.5rem;
}
.footer-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem;
}
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } }
footer h4 { color: #e2e8f0; font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
footer ul { list-style: none; }
footer li { margin-bottom: 0.4rem; }
footer a  { color: #94a3b8; font-size: 0.875rem; }
footer a:hover { color: #fff; text-decoration: none; }
.footer-logo { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 0.6rem; display: block; }
.footer-logo span { color: var(--accent); }
.footer-desc { font-size: 0.85rem; line-height: 1.6; }
.footer-bottom {
  max-width: var(--max-width); margin: 0 auto;
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.25rem;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.8rem;
}
.footer-disclaimer {
  background: rgba(0,0,0,0.2); border-radius: 6px; padding: 0.75rem 1rem;
  font-size: 0.78rem; line-height: 1.5; max-width: var(--max-width); margin: 0 auto 1.25rem;
  color: #64748b;
}

/* --- Stats Bar --- */
.stats-bar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
}
.stats-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap;
}
.stat-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.stat-item strong { color: var(--primary); font-weight: 700; }
.stat-item span   { color: var(--text-muted); }
.stat-item svg    { width: 18px; height: 18px; color: var(--primary-light); }

/* --- Range Input --- */
input[type="range"] {
  width: 100%; margin-top: 0.5rem; accent-color: var(--primary);
}
.range-labels { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* --- Tabs --- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  background: none; border: none; padding: 0.6rem 1.1rem; cursor: pointer; font-family: inherit;
  font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover  { color: var(--primary-light); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Amortization Table --- */
.amort-table-wrapper { max-height: 320px; overflow-y: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.amort-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.amort-table th {
  background: var(--primary); color: #fff; padding: 0.5rem 0.75rem;
  text-align: right; position: sticky; top: 0; font-weight: 600;
}
.amort-table th:first-child { text-align: center; }
.amort-table td { padding: 0.45rem 0.75rem; text-align: right; border-bottom: 1px solid var(--border); }
.amort-table td:first-child { text-align: center; font-weight: 600; color: var(--text-muted); }
.amort-table tr:hover td { background: #eff6ff; }

/* --- Chart Bar --- */
.chart-bar-container { margin: 1rem 0; }
.chart-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.3rem; }
.chart-bar-track { height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
.chart-bar-fill  { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.bar-blue   { background: linear-gradient(90deg, var(--primary-dark), var(--primary-light)); }
.bar-green  { background: linear-gradient(90deg, #065f46, var(--secondary)); }
.bar-amber  { background: linear-gradient(90deg, #92400e, var(--accent)); }
.bar-red    { background: linear-gradient(90deg, #991b1b, var(--danger)); }

/* --- Estilos específicos modo oscuro adicionales --- */
[data-theme="dark"] .card-header {
  background: #2d3a4f;
  color: var(--text);
}

[data-theme="dark"] .result-highlight {
  background: linear-gradient(135deg, #2d3a4f, #1e293b);
  border-color: var(--primary-light);
}

[data-theme="dark"] .result-highlight .value {
  color: var(--primary-light);
}

[data-theme="dark"] .ad-slot {
  background: #2d3a4f;
  border-color: var(--primary-light);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control {
  background: #2d3a4f;
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] .form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

[data-theme="dark"] footer a:hover {
  color: var(--primary-light);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .hero { padding: 2.5rem 1.25rem 2rem; }
}

@media (max-width: 768px) {
  nav { 
    display: none; 
    position: absolute; 
    top: 60px; 
    left: 0; 
    right: 0;
    background: var(--header-bg); 
    flex-direction: column; 
    padding: 1rem; 
    gap: 0.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  nav.open { display: flex; }
  nav a { width: 100%; padding: 0.65rem 1rem; }
  .nav-toggle { display: block; }
  .header-inner { position: relative; }
  .calc-layout { grid-template-columns: 1fr; }
  
  .header-controls {
    gap: 0.25rem;
  }
  
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .stats-inner { flex-direction: column; gap: 0.75rem; align-items: center; }
}

/* --- Utilidades --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   MEJORAS DE CONTRASTE EN RESULTADOS - MODO OSCURO
   ============================================ */

/* Resultados principales (cuota IRPF, pensión, etc.) */
[data-theme="dark"] .result-highlight .value {
  color: #60a5fa !important; /* Azul más claro y luminoso */
  text-shadow: 0 0 2px rgba(96, 165, 250, 0.3);
}

/* Resultados verdes (salario neto, capital final, etc.) */
[data-theme="dark"] .result-highlight.green .value {
  color: #4ade80 !important; /* Verde más luminoso */
  text-shadow: 0 0 2px rgba(74, 222, 128, 0.3);
}

/* Resultados ámbar (intereses, etc.) */
[data-theme="dark"] .result-highlight.amber .value {
  color: #fbbf24 !important; /* Ámbar más luminoso */
  text-shadow: 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Valores positivos (ganancias, ahorros) */
[data-theme="dark"] .result-row .val.positive {
  color: #4ade80 !important;
  font-weight: 700;
}

/* Valores negativos (gastos, impuestos) */
[data-theme="dark"] .result-row .val.negative {
  color: #f87171 !important; /* Rojo más luminoso */
  font-weight: 700;
}

/* Valores neutros */
[data-theme="dark"] .result-row .val {
  color: #f1f5f9; /* Blanco ligeramente cálido */
  font-weight: 600;
}

/* Títulos de sección en resultados */
[data-theme="dark"] .result-row .key {
  color: #94a3b8; /* Gris claro */
}

/* Totales finales (negrita) */
[data-theme="dark"] .result-row[style*="font-weight:700"] .val {
  color: #facc15 !important; /* Amarillo dorado para destacar */
  font-size: 1.1rem;
  text-shadow: 0 0 4px rgba(250, 204, 21, 0.2);
}

/* ============================================
   MEJORAS ESPECÍFICAS POR CALCULADORA
   ============================================ */

/* Calculadora IRPF - Cuota vs Neto */
[data-theme="dark"] #resultadosBody .result-highlight .value {
  color: #60a5fa; /* Azul para cuota */
}
[data-theme="dark"] #resultadosBody .result-highlight.green .value {
  color: #4ade80; /* Verde para neto */
}

/* Calculadora Hipoteca - Cuota mensual */
[data-theme="dark"] #resHipoteca .result-highlight .value {
  color: #60a5fa;
}
[data-theme="dark"] #resHipoteca .result-highlight.amber .value {
  color: #fbbf24; /* Intereses */
}

/* Calculadora Interés Compuesto - Capital final */
[data-theme="dark"] #resCompuesto .result-highlight.green .value {
  color: #4ade80;
}
[data-theme="dark"] #resCompuesto .result-highlight.amber .value {
  color: #fbbf24; /* Intereses generados */
}

/* Calculadora Finiquito - Total */
[data-theme="dark"] #resFiniquito .result-highlight.green .value {
  color: #4ade80;
}

/* Calculadora Vacaciones - Días pendientes */
[data-theme="dark"] #resVacaciones .result-highlight.green .value {
  color: #4ade80;
}
[data-theme="dark"] #resVacaciones .result-highlight .value {
  color: #60a5fa; /* Días generados */
}

/* Calculadora Pensión - Pensión mensual */
[data-theme="dark"] #resPension .result-highlight.green .value {
  color: #4ade80;
}
[data-theme="dark"] #resPension .result-highlight .value {
  color: #60a5fa; /* Pensión anual */
}

/* ============================================
   MEJORAS EN TABLAS MODO OSCURO
   ============================================ */

[data-theme="dark"] .tramos-table td {
  color: #f1f5f9;
  border-bottom-color: #334155;
}

[data-theme="dark"] .tramos-table tr:hover td {
  background: #2d3a4f;
}

/* ============================================
   MEJORAS EN ENCABEZADOS DE TARJETAS
   ============================================ */

[data-theme="dark"] .card-header {
  background: #2d3a4f;
  color: #f1f5f9;
}

[data-theme="dark"] .card-header svg {
  color: #60a5fa;
}