/* margen-cambio — estilos específicos */

.rate-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 520px) {
    .rate-inputs-grid {
        grid-template-columns: 1fr;
    }
}

.rate-card {
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    background: var(--bg-alt, #f8fafc);
    transition: border-color 0.18s;
}

.rate-card.rate-real {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.04);
}

.rate-card.rate-ofrecido {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.04);
}

.rate-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rate-card.rate-real .rate-card-label {
    color: #16a34a;
}

.rate-card.rate-ofrecido .rate-card-label {
    color: #2563eb;
}

.rate-card input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-family: 'Ubuntu', monospace, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.rate-card input[type="number"]:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rate-card .rate-hint {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    font-family: 'Montserrat', sans-serif;
    margin-top: 0.35rem;
}

/* par de divisas */
.pair-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.pair-selector select {
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s;
}

.pair-selector select:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
}

.pair-arrow {
    font-size: 1.1rem;
    color: var(--text-muted, #94a3b8);
}

/* cantidad */
.amount-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.amount-wrap label {
    font-size: 0.84rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: var(--text, #1e293b);
    white-space: nowrap;
}

.amount-wrap input[type="number"] {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    padding: 0.55rem 0.8rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-family: 'Ubuntu', monospace, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.amount-wrap input[type="number"]:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.amount-currency {
    font-size: 0.88rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-muted, #64748b);
}

/* gauge de margen */
.margin-gauge-wrap {
    margin: 1.1rem 0 0.5rem;
}

.gauge-bar-bg {
    height: 14px;
    border-radius: 99px;
    background: var(--border, #e2e8f0);
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.gauge-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
    min-width: 4px;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.67rem;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-muted, #94a3b8);
    font-weight: 600;
}

/* dashboard resultados */
.results-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 540px) {
    .results-dashboard {
        grid-template-columns: 1fr 1fr;
    }
}

.dash-card {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border, #e2e8f0);
    background: #fff;
    text-align: center;
}

.dash-card.dash-primary {
    border-color: var(--primary, #2563eb);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(99, 102, 241, 0.05));
}

.dash-card.dash-danger {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.dash-card.dash-good {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.05);
}

.dash-card .dash-icon {
    font-size: 1.3rem;
    margin-bottom: 0.35rem;
}

.dash-card.dash-primary .dash-icon {
    color: var(--primary, #2563eb);
}

.dash-card.dash-danger .dash-icon {
    color: #dc2626;
}

.dash-card.dash-good .dash-icon {
    color: #16a34a;
}

.dash-card .dash-val {
    font-size: 1.45rem;
    font-weight: 700;
    font-family: 'Ubuntu', monospace, sans-serif;
    color: var(--text, #1e293b);
    line-height: 1.1;
}

.dash-card.dash-primary .dash-val {
    font-size: 1.7rem;
    color: var(--primary, #2563eb);
}

.dash-card.dash-danger .dash-val {
    color: #dc2626;
}

.dash-card.dash-good .dash-val {
    color: #16a34a;
}

.dash-card .dash-label {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.2rem;
}

.dash-card .dash-sub {
    font-size: 0.74rem;
    color: var(--text-muted, #94a3b8);
    font-family: 'Montserrat', sans-serif;
    margin-top: 0.2rem;
}

/* desglose */
.cost-breakdown {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.cost-breakdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.1rem;
    background: var(--primary, #2563eb);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.84rem;
}

.cost-row:last-child {
    border-bottom: none;
}

.cost-row:nth-child(even) {
    background: var(--bg-alt, #f8fafc);
}

.cost-row .cr-label {
    color: var(--text-muted, #64748b);
    font-weight: 600;
}

.cost-row .cr-val {
    font-family: 'Ubuntu', monospace, sans-serif;
    font-weight: 700;
    color: var(--text, #1e293b);
}

.cost-row.cr-total {
    background: rgba(37, 99, 235, 0.06);
    font-size: 0.9rem;
}

.cost-row.cr-total .cr-label {
    color: var(--primary, #2563eb);
    font-weight: 700;
}

.cost-row.cr-total .cr-val {
    color: var(--primary, #2563eb);
    font-size: 1rem;
}

.cost-row.cr-loss .cr-label {
    color: #dc2626;
    font-weight: 700;
}

.cost-row.cr-loss .cr-val {
    color: #dc2626;
    font-size: 1rem;
}

/* badge de valoración del margen */
.margin-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    margin-top: 0.6rem;
}

.rating-excellent {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}

.rating-good {
    background: rgba(101, 163, 13, 0.12);
    color: #65a30d;
}

.rating-fair {
    background: rgba(234, 179, 8, 0.12);
    color: #ca8a04;
}

.rating-high {
    background: rgba(249, 115, 22, 0.12);
    color: #ea580c;
}

.rating-very-high {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

/* tabla comparativa */
.compare-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border, #e2e8f0);
    margin-bottom: 1.25rem;
}

.compare-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
}

.compare-table-wrap th {
    background: var(--bg-alt, #f1f5f9);
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    border-bottom: 1px solid var(--border, #e2e8f0);
    white-space: nowrap;
}

.compare-table-wrap td {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    color: var(--text, #1e293b);
    vertical-align: middle;
}

.compare-table-wrap tr:last-child td {
    border-bottom: none;
}

.compare-table-wrap tr:nth-child(even) td {
    background: var(--bg-alt, #f8fafc);
}

.provider-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.cheapest-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    margin-left: 0.35rem;
}

/* quick chips */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin: 0.6rem 0 1.1rem;
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

.qchip {
    padding: 0.25rem 0.75rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 99px;
    background: #fff;
    color: var(--text, #1e293b);
    font-size: 0.78rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.qchip:hover {
    border-color: var(--primary, #2563eb);
    color: var(--primary, #2563eb);
    background: rgba(37, 99, 235, 0.05);
}

.parse-error {
    display: none;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #dc2626;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.84rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.formula-box {
    background: var(--bg-alt, #f1f5f9);
    border-left: 4px solid var(--primary, #2563eb);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-family: 'Ubuntu', monospace, sans-serif;
    font-size: 0.88rem;
    color: var(--text, #1e293b);
}

.formula-legend {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1rem;
}

.formula-legend li {
    padding: 0.3rem 0 0.3rem 1.4rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text, #1e293b);
}

.formula-legend li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary, #2563eb);
    font-size: 0.75rem;
    top: 0.38rem;
}