/**
 * Estilos específicos para la Calculadora de derramas y mayorías de la LPH
 * Fijate Tools - Finanzas y Vivienda
 */

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

  /* Paleta base modo oscuro (predeterminado) */
  --bg-primary: #0a0e17;
  --bg-secondary: #101623;
  --bg-card: #151d30;
  --bg-card-sub: #1b253d;
  --bg-card-hover: #1f2a45;
  --border-color: #24304f;
  --border-light: #2e3d63;

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

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

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

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

  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.12);
  --accent-danger-border: rgba(239, 68, 68, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-sub: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;

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

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.18);

  --accent-success: #059669;
  --accent-success-bg: rgba(5, 150, 105, 0.08);
  --accent-success-border: rgba(5, 150, 105, 0.3);

  --accent-warning: #d97706;
  --accent-warning-bg: rgba(217, 119, 6, 0.08);
  --accent-warning-border: rgba(217, 119, 6, 0.3);

  --accent-danger: #dc2626;
  --accent-danger-bg: rgba(220, 38, 38, 0.08);
  --accent-danger-border: rgba(220, 38, 38, 0.3);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  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,
.brand-title,
.section-title,
.card-subtitle,
.veredicto-title,
.faq-section-title {
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
  font-weight: 700;
}

.mono {
  font-family: var(--font-mono);
}

/* Layout y contenedor principal */
.main-wrapper.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

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

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tarjeta principal contenedora */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
}

/* Pestañas de navegación de los 3 módulos */
.lph-nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.75rem;
  padding-bottom: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.lph-nav-tabs::-webkit-scrollbar {
  display: none;
}

.lph-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  position: relative;
}

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

.lph-tab-btn.active {
  color: var(--accent-primary);
  background: var(--bg-card-sub);
}

.lph-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 10px var(--accent-glow);
}

.badge-tab {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--text-dim);
}

.lph-tab-btn.active .badge-tab {
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--accent-primary);
}

/* Paneles de pestañas */
.lph-tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

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

.panel-header-desc {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.4rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Estructura en 2 columnas */
.lph-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.lph-form-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.card-subtitle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 1.15rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
}

.card-subtitle svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* Formularios, inputs y selects */
.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.hint-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.hint-badge.badge-warning {
  background: var(--accent-warning-bg);
  border-color: var(--accent-warning-border);
  color: var(--accent-warning);
}

.input-with-suffix {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.input-with-suffix:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-with-suffix .form-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  height: 40px;
}

.input-with-suffix .form-input:focus {
  outline: none;
}

.input-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.85rem;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  height: 40px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input-sm {
  height: 36px;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
}

/* Regla canónica para <select> */
.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 40px;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 40px 0.5rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' 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 14px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option,
.form-select optgroup {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 0.5rem;
}

.form-select-lg {
  height: 44px;
  font-size: 0.98rem;
  font-weight: 500;
}

.input-caption {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Tarjetas KPI de resumen */
.lph-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.kpi-card.highlight {
  background: linear-gradient(135deg, var(--bg-card-sub) 0%, rgba(59, 130, 246, 0.12) 100%);
  border-color: rgba(59, 130, 246, 0.35);
}

.kpi-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.kpi-card.highlight .kpi-value {
  color: var(--accent-primary);
}

.kpi-detail {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Editor de fincas */
.lph-fincas-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.fincas-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.fincas-title {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.fincas-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.fincas-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Dropdown de plantillas */
.dropdown-presets {
  position: relative;
}

.presets-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  min-width: 250px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preset-option {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.preset-option:hover {
  background: var(--bg-secondary);
  color: var(--accent-primary);
}

/* Indicador de validación de coeficientes */
.coeficientes-validator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  gap: 0.75rem;
}

.coeficientes-validator.valid {
  background: var(--accent-success-bg);
  border-color: var(--accent-success-border);
}

.coeficientes-validator.valid .validator-icon {
  color: var(--accent-success);
}

.coeficientes-validator.invalid {
  background: var(--accent-danger-bg);
  border-color: var(--accent-danger-border);
}

.coeficientes-validator.invalid .validator-icon {
  color: var(--accent-danger);
}

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

.validator-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.validator-text {
  font-size: 0.9rem;
  color: var(--text-main);
}

.validator-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-link-action {
  background: transparent;
  border: 1px solid var(--accent-danger-border);
  color: var(--accent-danger);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-link-action:hover {
  background: var(--accent-danger);
  color: #ffffff;
}

/* Tabla de reparto */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 1rem;
}

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

.lph-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.lph-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.lph-table tbody tr.row-exenta td {
  opacity: 0.7;
}

.table-input-text {
  width: 100%;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  color: var(--text-main);
  font-size: 0.86rem;
  font-family: var(--font-main);
}

.table-input-number {
  width: 100%;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  color: var(--text-main);
  font-size: 0.86rem;
  font-family: var(--font-mono);
  text-align: right;
}

.table-input-text:focus,
.table-input-number:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.table-select-tipo {
  width: 100%;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  color: var(--text-main);
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.btn-del-row:hover {
  color: var(--accent-danger);
  background: var(--accent-danger-bg);
}

.table-total-row {
  background: var(--bg-secondary);
  font-weight: 700;
}

.table-total-row td {
  border-top: 2px solid var(--border-color);
  border-bottom: none;
}

.fincas-export-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Botones estándar */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.2s ease, transform 0.1s ease;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 38px;
  transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(59, 130, 246, 0.1);
}

.btn-sm {
  min-height: 34px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

/* Radio pills y checkboxes */
.radio-pill-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-main);
  transition: border-color 0.2s, background 0.2s;
}

.radio-pill:hover {
  background: var(--bg-card-hover);
}

.radio-pill input[type="radio"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.custom-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-main);
  cursor: pointer;
  line-height: 1.4;
}

.custom-checkbox input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Veredicto de accesibilidad (Módulo 2) */
.veredicto-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1rem;
}

.veredicto-badge-container {
  margin-bottom: 0.85rem;
}

.veredicto-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 30px;
  border: 1px solid transparent;
}

.badge-obligatoria {
  background: var(--accent-success-bg);
  border-color: var(--accent-success-border);
  color: var(--accent-success);
}

.badge-no-obligatoria {
  background: var(--accent-warning-bg);
  border-color: var(--accent-warning-border);
  color: var(--accent-warning);
}

.veredicto-title {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.veredicto-explicacion {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.desglose-legal-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.desglose-item {
  display: flex;
  flex-direction: column;
}

.desglose-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.desglose-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.desglose-item.highlight .desglose-val {
  color: var(--accent-primary);
}

.jurisprudencia-callout {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.15rem;
}

.callout-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.callout-heading svg {
  color: var(--accent-primary);
}

.jurisprudencia-callout p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Ficha y simulador de mayorías (Módulo 3) */
.lph-acuerdo-selector-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

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

.ficha-mayoria-header {
  margin-bottom: 0.5rem;
}

.mayoria-badge-container {
  margin-bottom: 0.5rem;
}

.mayoria-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.badge-unanimidad {
  background: var(--accent-danger-bg);
  border-color: var(--accent-danger-border);
  color: var(--accent-danger);
}

.badge-tres-quintos {
  background: var(--accent-warning-bg);
  border-color: var(--accent-warning-border);
  color: var(--accent-warning);
}

.badge-mayoria-simple {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--accent-primary);
}

.badge-un-tercio {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #a855f7;
}

.badge-sin-junta {
  background: var(--accent-success-bg);
  border-color: var(--accent-success-border);
  color: var(--accent-success);
}

.ficha-mayoria-title {
  font-size: 1.25rem;
  color: var(--text-main);
}

.ficha-mayoria-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.15rem;
}

.ficha-mayoria-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.mayoria-rule-item {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  align-items: center;
}

.rule-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.rule-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.rule-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Simulador de escrutinio en junta */
.lph-escrutinio-container {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
}

.escrutinio-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.escrutinio-subcard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
}

.subcard-title {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.censo-remanente-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.censo-remanente-box strong {
  color: var(--text-main);
}

.votos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.voto-input-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

.voto-favor {
  border-left: 3px solid var(--accent-success);
}

.voto-contra {
  border-left: 3px solid var(--accent-danger);
}

.voto-abstencion {
  border-left: 3px solid var(--text-dim);
}

.voto-ausente {
  border-left: 3px solid var(--accent-warning);
}

.checkbox-ausente-box {
  background: var(--bg-secondary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
}

.escrutinio-resultado-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

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

.resultado-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.45rem 1rem;
  border-radius: 30px;
}

.pill-aprobado {
  background: var(--accent-success-bg);
  border: 1px solid var(--accent-success-border);
  color: var(--accent-success);
}

.pill-rechazado {
  background: var(--accent-danger-bg);
  border: 1px solid var(--accent-danger-border);
  color: var(--accent-danger);
}

.resultado-tipo-convocatoria {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.resultado-summary-title {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.resultado-summary-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.15rem;
}

.barras-mayoria-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.barra-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.barra-labels strong {
  font-family: var(--font-mono);
}

.barra-track {
  width: 100%;
  height: 14px;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.barra-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.3s ease;
}

.fill-success {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.fill-danger {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.barra-target-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  z-index: 2;
}

.acta-admon-tips {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.acta-admon-tips strong {
  color: var(--text-main);
}

/* Sección de Preguntas Frecuentes FAQ */
.lph-faq-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-color);
}

.faq-section-title {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 1.15rem;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.faq-item[open] {
  border-color: var(--border-light);
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  gap: 1rem;
}

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

.faq-chevron {
  color: var(--text-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

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

.faq-answer strong {
  color: var(--text-main);
}

/* Modal Canónico */
.lph-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lph-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.1rem;
  color: var(--text-main);
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.btn-modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-sub);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Media queries y responsividad */
@media (max-width: 992px) {
  .lph-grid-2col {
    grid-template-columns: 1fr;
  }
  .lph-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .desglose-legal-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ficha-mayoria-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.15rem;
  }
  .lph-kpi-grid {
    grid-template-columns: 1fr;
  }
  .desglose-legal-card {
    grid-template-columns: 1fr;
  }
  .votos-grid {
    grid-template-columns: 1fr;
  }
  .fincas-header {
    flex-direction: column;
    align-items: stretch;
  }
  .fincas-actions {
    width: 100%;
  }
  .fincas-actions .btn-sm {
    flex: 1 1 0%;
  }
  .btn-primary,
  .btn-outline,
  .btn-secondary {
    width: 100%;
  }
  .fincas-export-bar {
    flex-direction: column;
  }
  .resultado-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
