body.tariff-modal-open { overflow: hidden; }

.tariff-trigger {
    margin-top: .65rem;
    width: 100%;
    justify-content: center;
    gap: .45rem;
}

.tariff-trigger span { color: #ff334b; }

.tariff-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.tariff-modal[hidden] { display: none; }

.tariff-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 9, 14, .78);
    backdrop-filter: blur(8px);
}

.tariff-modal__panel {
    position: absolute;
    inset: 3vh 3vw;
    display: flex;
    flex-direction: column;
    max-width: 1500px;
    margin: auto;
    overflow: hidden;
    border: 1px solid #253b47;
    border-radius: 20px;
    background: #081720;
    box-shadow: 0 32px 90px rgba(0, 0, 0, .55);
}

.tariff-modal__header,
.tariff-modal__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.3rem 1.5rem;
    border-bottom: 1px solid #1f3440;
    background: #0a1b25;
}

.tariff-modal__header h2 { margin: .1rem 0 .25rem; }
.tariff-modal__header p:last-child { margin: 0; color: #87a4b5; }
.tariff-modal__actions {
    justify-content: flex-end;
    border-top: 1px solid #1f3440;
    border-bottom: 0;
}

.tariff-modal__body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
}

.tariff-loading {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #dce9ef;
}

.tariff-loading[hidden] { display: none; }
.tariff-loading small { display: block; margin-top: .25rem; color: #7898a9; }
.tariff-loading__pulse {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff334b;
    box-shadow: 0 0 0 0 rgba(255, 51, 75, .48);
    animation: tariff-pulse 1.25s infinite;
}

@keyframes tariff-pulse {
    70% { box-shadow: 0 0 0 16px rgba(255, 51, 75, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 51, 75, 0); }
}

.tariff-summary,
.tariff-grid,
.tariff-cost-grid,
.tariff-evaluation {
    display: grid;
    gap: 1rem;
}

.tariff-summary { grid-template-columns: 1.45fr .8fr; margin-bottom: 1rem; }
.tariff-grid { grid-template-columns: 1.35fr .8fr; }

.tariff-hero-card,
.tariff-classification,
.tariff-panel,
.tariff-final,
.tariff-evaluation {
    border: 1px solid #213944;
    border-radius: 16px;
    background: #0b1c26;
}

.tariff-hero-card,
.tariff-classification { padding: 1.25rem 1.4rem; }
.tariff-hero-card span,
.tariff-classification span,
.tariff-panel__heading span,
.tariff-final > div:first-child > span {
    display: block;
    margin-bottom: .28rem;
    color: #7fa2b3;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tariff-hero-card strong {
    display: block;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.7rem);
    line-height: 1;
}

.tariff-hero-card small { display: block; margin-top: .65rem; color: #8ca9b8; }
.tariff-classification { border-left: 4px solid #637b88; }
.tariff-classification strong { display: block; font-size: 1.55rem; color: #fff; }
.tariff-classification small { color: #839eac; }
.tariff-classification--inviable { border-left-color: #ff334b; }
.tariff-classification--no-conveniente { border-left-color: #e67e3a; }
.tariff-classification--aceptable { border-left-color: #d8b43d; }
.tariff-classification--bueno { border-left-color: #63b87a; }
.tariff-classification--optimo { border-left-color: #36c790; }

.tariff-warning {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid #725d28;
    border-radius: 12px;
    background: rgba(178, 135, 29, .09);
    color: #d8c787;
}
.tariff-warning[hidden] { display: none; }
.tariff-warning strong { color: #f1d878; }
.tariff-warning p { margin: .3rem 0 0; }

.tariff-panel { padding: 1.2rem; }
.tariff-panel__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.tariff-panel__heading h3,
.tariff-final h3 { margin: 0; }
.tariff-panel__heading > strong { font-size: 1.35rem; color: #fff; }
.tariff-configuration { display: block; margin-bottom: .25rem; font-size: 1.25rem; color: #fff; }
.tariff-panel > p { margin: 0 0 1rem; color: #8ba5b3; }

.tariff-map {
    min-height: 300px;
    overflow: hidden;
    border: 1px solid #263d48;
    border-radius: 12px;
    background: #07131a;
}
.tariff-map__fallback {
    min-height: 300px;
    display: grid;
    place-items: center;
    padding: 2rem;
    text-align: center;
    color: #829eac;
}
.tariff-map__note { margin: .6rem 0 .9rem !important; font-size: .78rem; color: #698998 !important; }

.tariff-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
    margin: 0;
}
.tariff-metrics div,
.tariff-cost-grid > div,
.tariff-evaluation > div {
    padding: .8rem;
    border: 1px solid #1e3540;
    border-radius: 10px;
    background: #091821;
}
.tariff-metrics dt,
.tariff-cost-grid span,
.tariff-evaluation span { color: #7897a7; font-size: .76rem; }
.tariff-metrics dd { margin: .22rem 0 0; color: #eef6f9; font-weight: 700; }

.tariff-cargo { display: grid; gap: .45rem; margin-top: 1rem; }
.tariff-cargo div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid #1c303a;
    color: #a9c0cb;
}
.tariff-cargo strong { color: #fff; }

.tariff-panel--economics { margin-top: 1rem; }
.tariff-cost-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tariff-cost-grid strong,
.tariff-evaluation strong { display: block; margin-top: .25rem; color: #fff; font-size: 1rem; }

.tariff-final {
    display: grid;
    grid-template-columns: 1fr minmax(300px, .7fr);
    gap: 1.25rem;
    align-items: end;
    margin-top: 1rem;
    padding: 1.2rem;
    border-color: #47313a;
    background: linear-gradient(135deg, rgba(255, 51, 75, .07), #0b1c26 45%);
}
.tariff-final p { margin: .35rem 0 0; color: #829eac; }
.tariff-final__control { display: grid; grid-template-columns: 1fr auto; gap: .55rem; align-items: end; }
.tariff-final__control label { grid-column: 1 / -1; color: #b7cad3; font-size: .8rem; font-weight: 700; }
.tariff-final__control input {
    min-width: 0;
    padding: .75rem .85rem;
    border: 1px solid #314b57;
    border-radius: 9px;
    background: #07151d;
    color: #fff;
    font-size: 1.12rem;
    font-weight: 700;
}
.tariff-final__control input:focus { outline: none; border-color: #ff334b; }

.tariff-evaluation {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 1rem;
    padding: .9rem;
}

.tariff-modal__error { margin-bottom: 1rem; }

@media (max-width: 900px) {
    .tariff-modal__panel { inset: 1vh 1vw; }
    .tariff-summary,
    .tariff-grid,
    .tariff-final { grid-template-columns: 1fr; }
    .tariff-cost-grid,
    .tariff-evaluation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tariff-metrics { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .tariff-modal__body { padding: 1rem; }
    .tariff-modal__header,
    .tariff-modal__actions { padding: 1rem; }
    .tariff-cost-grid,
    .tariff-evaluation { grid-template-columns: 1fr; }
    .tariff-final__control { grid-template-columns: 1fr; }
}
