/**
 * Estilos de la herramienta Diagnóstico pericial de ruidos de vecinos
 * Fijate Tools - Responsive, accesible, modo oscuro/claro y vista de impresión
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta en tema oscuro (por defecto) */
  --bg-page: #0b0f17;
  --bg-card: #131a26;
  --bg-card-subtle: #1a2332;
  --bg-input: #101622;
  --border-color: #243046;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-teal: #06b6d4;

  --color-ok: #10b981;
  --color-ok-bg: rgba(16, 185, 129, 0.12);
  --color-ok-border: rgba(16, 185, 129, 0.35);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: rgba(245, 158, 11, 0.35);

  --color-danger: #f97316;
  --color-danger-bg: rgba(249, 115, 22, 0.12);
  --color-danger-border: rgba(249, 115, 22, 0.35);

  --color-critical: #ef4444;
  --color-critical-bg: rgba(239, 68, 68, 0.14);
  --color-critical-border: rgba(239, 68, 68, 0.4);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

/* Base de layout */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin-top: 0;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Tipografía mono */
.text-mono {
  font-family: var(--font-mono);
}

/* Contención principal según generales.md */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Hero descriptivo */
.tool-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-subtle) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.tool-hero::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.tool-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  margin-bottom: 0.85rem;
}

.tool-badge-pill.pill-live {
  background-color: var(--color-ok-bg);
  color: var(--color-ok);
  border-color: var(--color-ok-border);
  animation: pulse-live 2s infinite;
}

.tool-badge-pill.pill-paused {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.tool-badge-pill.pill-manual {
  background-color: rgba(147, 51, 234, 0.12);
  color: #c084fc;
  border-color: rgba(147, 51, 234, 0.3);
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.tool-hero h2 {
  font-size: 1.625rem;
  line-height: 1.25;
  margin-bottom: 0.65rem;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 0;
  max-width: 860px;
}

/* Pestañas de navegación */
.tabs-navigation-wrapper {
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
}

.tabs-navigation {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.tab-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  min-height: 40px;
}

.tab-nav-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
}

.tab-nav-btn.active {
  color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.12);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Tarjetas modulares */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

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

.card-header-flex h3 {
  margin: 0;
  font-size: 1.25rem;
}

/* =================================================== */
/* SONÓMETRO: DIAL, INDICADORES Y VU-METER            */
/* =================================================== */
.sonometer-console {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: center;
  background: linear-gradient(180deg, var(--bg-card-subtle) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 840px) {
  .sonometer-console {
    grid-template-columns: 1fr;
  }
}

/* Dial analógico */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gauge-svg-box {
  width: 100%;
  max-width: 320px;
  position: relative;
}

.gauge-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.gauge-needle-el {
  transform-origin: 150px 150px;
  transition: transform 0.08s cubic-bezier(0.1, 0.8, 0.3, 1);
}

/* Indicador digital central */
.digital-readout-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: -1.5rem;
}

.main-dba-value {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--text-main);
}

.main-dba-unit {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-top: 0.25rem;
  letter-spacing: 0.05em;
}

/* VU-Meter de barra horizontal */
.vu-meter-container {
  width: 100%;
  margin-top: 1rem;
}

.vu-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 0.35rem;
}

.vu-meter-track {
  width: 100%;
  height: 12px;
  background-color: var(--bg-input);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
}

.vu-meter-bar {
  height: 100%;
  width: 25%;
  background-color: var(--color-ok);
  border-radius: 9999px;
  transition: width 0.08s ease, background-color 0.15s ease;
}

/* Panel de controles y métricas del sonómetro */
.sonometer-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.button-actions-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background-color: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  flex: 1;
}

.btn-primary-action:hover {
  background-color: var(--accent-primary-hover);
}

.btn-primary-action.listening {
  background-color: var(--color-critical);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--transition-fast);
}

.btn-secondary-action:hover, .btn-secondary-action.active {
  background-color: var(--bg-card-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Tarjeta de controles manuales */
.manual-controls-box {
  background-color: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.manual-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.manual-slider-header label {
  font-size: 0.875rem;
  font-weight: 600;
}

.manual-value-badge {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.slider-input {
  width: 100%;
  accent-color: var(--accent-primary);
  height: 6px;
  cursor: pointer;
}

/* Grid de KPIs acústicos */
.kpi-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .kpi-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.kpi-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Balística temporal y opciones */
.options-row-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.segmented-control {
  display: inline-flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.seg-btn.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Calibrador de micrófono */
.calibration-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
}

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

.calibration-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-preset {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preset:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Espectrograma de 8 bandas */
.spectrum-box {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.spectrum-bars-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 120px;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.spectrum-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.spectrum-bar-track {
  width: 100%;
  height: 100%;
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.spectrum-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-teal) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.08s ease;
}

.spectrum-col-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 0.4rem;
  text-align: center;
}

/* =================================================== */
/* COMPARADOR LEGAL Y SEMÁFORO DE INFRACCIÓN           */
/* =================================================== */
.form-grid-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .form-grid-three {
    grid-template-columns: 1fr;
  }
}

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

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-select, .form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 0.85rem;
  box-sizing: border-box;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: var(--font-main);
  transition: border-color var(--transition-fast);
}

.form-select {
  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.85rem center;
  background-size: 16px;
  padding-right: 2.25rem;
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.reg-desc-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.25rem;
}

/* Tarjeta pericial del veredicto */
.legal-verdict-card {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  transition: all var(--transition-normal);
}

.legal-verdict-card.verdict-ok {
  border-color: var(--color-ok-border);
  background-color: var(--color-ok-bg);
}

.legal-verdict-card.verdict-warning {
  border-color: var(--color-warning-border);
  background-color: var(--color-warning-bg);
}

.legal-verdict-card.verdict-danger {
  border-color: var(--color-danger-border);
  background-color: var(--color-danger-bg);
}

.legal-verdict-card.verdict-critical {
  border-color: var(--color-critical-border);
  background-color: var(--color-critical-bg);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
}

.verdict-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.verdict-score-box {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.verdict-diff-val {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
}

.verdict-threshold-legend {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.verdict-threshold-legend strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}

.badge-verdict {
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-verdict.badge-ok {
  background-color: var(--color-ok);
  color: #ffffff;
}

.badge-verdict.badge-warning {
  background-color: var(--color-warning);
  color: #1a1a1a;
}

.badge-verdict.badge-danger {
  background-color: var(--color-danger);
  color: #ffffff;
}

.badge-verdict.badge-critical {
  background-color: var(--color-critical);
  color: #ffffff;
  animation: pulse-live 1.5s infinite;
}

.legal-verdict-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.legal-verdict-text {
  font-size: 0.9375rem;
  color: var(--text-main);
  margin-bottom: 0;
  line-height: 1.55;
}

/* =================================================== */
/* TRIAJE DE RUIDOS (AÉREO VS IMPACTO VS INSTALACIONES)*/
/* =================================================== */
.triaje-result-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.25rem;
}

.triaje-result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.triaje-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.triaje-result-header h4 {
  margin: 0;
  font-size: 1.25rem;
}

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

.triaje-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .triaje-body-grid {
    grid-template-columns: 1fr;
  }
}

.triaje-info-block {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.triaje-info-block strong {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--accent-primary);
}

.triaje-info-block p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.triaje-freq-pill {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background-color: var(--bg-input);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}

.triaje-info-block ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.triaje-info-block li {
  margin-bottom: 0.4rem;
}

/* =================================================== */
/* DIARIO DE MOLESTIAS Y PRUEBAS                       */
/* =================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.diary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.diary-table th, .diary-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.diary-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.diary-table tbody tr:hover {
  background-color: var(--bg-card-subtle);
}

.badge-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.text-danger { color: var(--color-danger); font-weight: 700; }
.text-warning { color: var(--color-warning); font-weight: 700; }
.text-success { color: var(--color-ok); font-weight: 700; }

.btn-table-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-table-delete:hover {
  color: var(--color-critical);
  background-color: rgba(239, 68, 68, 0.15);
}

.empty-state-card {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state-card svg {
  margin-bottom: 0.75rem;
  color: var(--text-dim);
}

/* =================================================== */
/* GENERADOR DE CARTAS Y ESCRITOS                      */
/* =================================================== */
.letter-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .letter-layout-grid {
    grid-template-columns: 1fr;
  }
}

.letter-form-column {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.letter-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.letter-preview-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

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

.letter-preview-content {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-main);
  flex: 1;
  max-height: 500px;
  overflow-y: auto;
}

.letter-actions-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* =================================================== */
/* GUÍA DE AISLAMIENTO EXPRÉS                          */
/* =================================================== */
.isolation-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .isolation-cards-grid {
    grid-template-columns: 1fr;
  }
}

.isolation-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.isolation-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.isolation-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.isolation-card h4 {
  margin: 0;
  font-size: 1.05rem;
}

.isolation-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  flex: 1;
}

.isolation-rating {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-ok);
  background-color: var(--color-ok-bg);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  align-self: flex-start;
}

/* Acordeón de FAQ SEO */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--accent-primary);
  font-weight: 400;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Modal accesible */
.app-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.app-modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 10001;
}

.modal-title {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.modal-body {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

/* Estilos de impresión */
@media print {
  .app-header, .fijate-footer, .tools-ad-banner-section, .tool-ad-sidebar,
  .tabs-navigation-wrapper, .button-actions-group, .calibration-card,
  .btn-table-delete, .letter-form-column, .letter-actions-row, .btn-secondary-action,
  .affiliate-showcase-container {
    display: none !important;
  }

  body, .tool-layout, .tool-with-sidebar, .tool-main-content {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }

  .tool-card, .letter-preview-card, .table-responsive {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  .letter-preview-content {
    color: #000000 !important;
    background: #ffffff !important;
    border: none !important;
    font-size: 11pt !important;
    max-height: none !important;
  }
}
