/* Tabs de módulo */
.modo-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.4rem;
    flex-wrap: wrap;
}

.modo-tab {
    flex: 1;
    min-width: 110px;
    padding: 0.6rem 0.7rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    line-height: 1.3;
}

.modo-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.modo-tab i {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

/* Selector de país */
.pais-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.pais-selector-wrap label {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.tipos-badge {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

.badge-gen {
    background: #2563eb;
}

.badge-red {
    background: #059669;
}

.badge-sup {
    background: #d97706;
}

.badge-esp {
    background: #7c3aed;
}

/* Indicador IVA */
.iva-indicator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-soft);
    margin-top: 1rem;
    grid-column: 1 / -1;
}

.iva-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.iva-icon.normal {
    background: #dbeafe;
    color: #2563eb;
}

.iva-icon.reducido {
    background: #d1fae5;
    color: #059669;
}

.iva-icon.alto {
    background: #fef3c7;
    color: #d97706;
}

.iva-icon.positivo {
    background: #d1fae5;
    color: #059669;
}

.iva-icon.negativo {
    background: #fee2e2;
    color: #dc2626;
}

.iva-verdict {
    font-family: var(--font-primary);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
}

.iva-verdict span {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Tabla tipos por país */
.tabla-paises {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: var(--font-primary);
}

.tabla-paises th {
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.8rem;
    text-align: right;
    border-bottom: 2px solid var(--border-color);
}

.tabla-paises th:first-child {
    text-align: left;
}

.tabla-paises td {
    padding: 0.45rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.tabla-paises td:first-child {
    text-align: left;
    font-weight: 600;
}

.tabla-paises tr.destacado td {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 700;
}

.tabla-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Desglose nómina-style */
.iva-breakdown {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-top: 0.5rem;
}

.iva-breakdown h3 {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.iva-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-primary);
    font-size: 0.85rem;
}

.iva-row:last-child {
    border-bottom: none;
}

.iva-row.total-row {
    font-weight: 700;
    font-size: 0.95rem;
    padding-top: 0.8rem;
    border-top: 2px solid var(--border-color);
    border-bottom: none;
}

.iva-row.total-row .iva-val {
    color: var(--secondary-color);
}

.iva-row-label {
    color: var(--text-muted);
}

.iva-val {
    font-weight: 600;
    color: var(--text-color);
}

.iva-val.positivo {
    color: #059669;
}

.iva-val.negativo {
    color: #dc2626;
}

/* Modelo 303 trimestres */
.trimestres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.trim-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

.trim-card h4 {
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.8rem;
}

.trim-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.trim-field label {
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Comparativa barras */
.comp-bar-item {
    margin-bottom: 0.9rem;
}

.comp-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.3rem;
}

.comp-bar-label {
    font-size: 0.8rem;
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--text-color);
}

.comp-bar-val {
    font-size: 0.8rem;
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--primary-color);
}

.comp-bar-track {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.comp-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: var(--primary-color);
    transition: width 0.5s ease;
}

.comp-bar-fill.activo {
    background: var(--secondary-color);
}

/* Selector tipo manual */
.tipo-custom-wrap {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.tipo-btn {
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.tipo-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}