:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --border: #e5e7eb;
    --accent: #0f766e;
    --warning-bg: #fff7ed;
    --warning-border: #fdba74;
    --error-bg: #fef2f2;
    --error-border: #fca5a5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    width: min(1200px, 92vw);
    margin: 0 auto;
}

.topbar {
    background: #fff;
    color: var(--text);
    padding: .85rem 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 0 var(--border);
    border-bottom: 3px solid var(--primary);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.brand-avatar-wrap {
    flex-shrink: 0;
    display: block;
}

.brand-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-soft);
    display: block;
}

.brand-text {
    min-width: 0;
}

.brand-eyebrow {
    margin: 0;
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}

.brand-title {
    margin: 0;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    letter-spacing: -.02em;
    line-height: 1.2;
    font-weight: 800;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.topbar-product {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .12rem;
    color: var(--primary-dark);
    background: transparent;
    border: 2px solid var(--primary);
    padding: .5rem 1rem;
    border-radius: 12px;
    line-height: 1.2;
}

.topbar-product-title {
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: -.01em;
}

.topbar-product-sub {
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
}

.search-status {
    font-size: .85rem;
    color: var(--muted);
    font-weight: 600;
}

.plans-results-body.is-loading {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}

.search-panel, .results-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.field label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.field input, .field select {
    width: 100%;
    padding: .65rem .75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: .95rem;
}

.field-check {
    display: flex;
    align-items: flex-end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 600;
    padding: .65rem 0;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.autocomplete-wrap { position: relative; }

.suggestions {
    list-style: none;
    margin: .25rem 0 0;
    padding: 0;
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.suggestions.show { display: block; }

.suggestions-companies {
    max-height: 320px;
}

.suggestions li {
    padding: .55rem .75rem;
    cursor: pointer;
}

.suggestions li:hover, .suggestions li.active {
    background: #eff6ff;
}

.actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: .65rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-sm {
    padding: .45rem .75rem;
    font-size: .84rem;
}

.btn-more {
    background: var(--accent);
    color: #fff;
    min-width: 84px;
}

.btn-summary {
    background: #2563eb;
    color: #fff;
    min-width: 80px;
}

.btn-summary.open {
    background: #1d4ed8;
}

.btn-extra {
    background: #0d9488;
    color: #fff;
    min-width: 72px;
}

.btn-extra.open {
    background: #0f766e;
}

.btn-rx {
    background: #7c3aed;
    color: #fff;
    min-width: 64px;
}

.btn-rx.open {
    background: #5b21b6;
}

.btn-sob {
    background: #0f766e;
    color: #fff;
    min-width: 64px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sob:hover {
    background: #0d9488;
    color: #fff;
}

.btn-sob-carrier {
    background: #b45309;
}

.btn-sob-carrier:hover {
    background: #d97706;
    color: #fff;
}

.plan-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    justify-content: flex-end;
}

.plan-rx-panel {
    background: #faf5ff;
    border-top-color: #e9d5ff;
}

.plan-summary-panel {
    background: #eff6ff;
    border-top-color: #bfdbfe;
}

.plan-extra-panel {
    background: #f0fdfa;
    border-top-color: #99f6e4;
}

.extra-sections {
    display: grid;
    gap: 1rem;
}

.extra-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .85rem 1rem;
    background: #fff;
}

.extra-block.extra-offered {
    border-left: 4px solid #0d9488;
}

.extra-block.extra-not-offered {
    border-left: 4px solid #d1d5db;
    opacity: .85;
}

.extra-block h4 {
    margin: 0 0 .65rem;
    font-size: .95rem;
    color: #134e4a;
}

.extra-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .45rem;
}

.extra-item-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .88rem;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: .35rem;
}

.extra-item-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.extra-item-list span {
    color: var(--muted);
}

.extra-note {
    margin: .65rem 0 0;
    font-size: .8rem;
    color: var(--muted);
    font-style: italic;
}

.summary-sections {
    display: grid;
    gap: 1rem;
}

.summary-subtitle {
    margin: 0 0 .5rem;
    font-weight: 600;
    color: #1e40af;
}

.summary-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .85rem 1rem;
    background: #fff;
    border-left: 4px solid #2563eb;
}

.summary-block h4 {
    margin: 0 0 .65rem;
    font-size: .95rem;
    color: #1e3a8a;
}

.summary-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .45rem;
}

.summary-item-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .88rem;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: .35rem;
    align-items: flex-start;
}

.summary-item-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.summary-item-list span {
    color: var(--muted);
    flex: 1;
    min-width: 0;
}

.summary-item-list strong {
    text-align: right;
    flex: 1;
    min-width: 0;
    white-space: pre-line;
}

.rx-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.rx-summary-item {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    padding: .65rem .75rem;
}

.rx-summary-item .label {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: .2rem;
}

.rx-summary-item strong {
    font-size: 1rem;
    color: #5b21b6;
}

.rx-tier-table th {
    background: #f5f3ff;
    width: auto;
}

.rx-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: .25rem;
}

.rx-tier-table {
    width: 100%;
    min-width: 420px;
    table-layout: auto;
}

.rx-tier-table thead th {
    width: auto;
    min-width: 4.5rem;
    white-space: nowrap;
    text-align: center;
    font-size: .78rem;
}

.rx-tier-table tbody th {
    width: auto;
}

.rx-tier-table td {
    text-align: center;
    white-space: nowrap;
}

.rx-tier-table td:first-child,
.rx-tier-table th:first-child {
    text-align: left;
    min-width: 8rem;
    white-space: normal;
}

.rx-tier-table td:nth-child(2),
.rx-tier-table th:nth-child(2) {
    text-align: left;
    min-width: 5rem;
}

.rx-note {
    margin: .5rem 0 0;
    font-size: .82rem;
    color: var(--muted);
}

.rx-phase {
    margin-bottom: 1.1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid #e9d5ff;
}

.rx-phase:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.rx-phase h5 {
    margin: 0 0 .45rem;
    font-size: .92rem;
    color: #5b21b6;
}

.rx-phase-text {
    margin: 0 0 .5rem;
    font-size: .84rem;
    line-height: 1.55;
    color: var(--text);
}

.rx-highlight {
    margin: .35rem 0;
    padding: .5rem .65rem;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    font-size: .82rem;
    line-height: 1.45;
}

.rx-tier-block {
    margin: .65rem 0 .35rem;
    padding: .65rem .75rem;
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
}

.rx-tier-block h6 {
    margin: 0 0 .35rem;
    font-size: .86rem;
    color: #1e1b4b;
}

.rx-tier-type {
    display: inline-block;
    margin-bottom: .35rem;
    font-size: .75rem;
    font-weight: 600;
    color: #6d28d9;
    background: #f5f3ff;
    padding: .1rem .45rem;
    border-radius: 999px;
}

.rx-cost-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rx-cost-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .3rem 0;
    font-size: .82rem;
    border-top: 1px solid #f3e8ff;
}

.rx-cost-list li:first-child {
    border-top: none;
}

.rx-cost-list li span {
    color: var(--muted);
    flex: 1;
}

.rx-cost-list li strong {
    color: #5b21b6;
    white-space: nowrap;
}

.rx-cost-list-compact li {
    padding: .25rem 0;
}

.btn-more.open {
    background: #115e59;
}

.results-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.results-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.badge {
    background: #dbeafe;
    color: #1d4ed8;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
}

.plan-list {
    display: grid;
    gap: .9rem;
}

.plan-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
}

.plan-table-sticky-sentinel {
    height: 1px;
    margin: 0;
}

.plan-table {
    width: max-content;
    max-width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.plan-table thead th {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border);
    padding: 0;
    text-align: center;
    white-space: nowrap;
    transition: box-shadow .2s ease;
}

.plan-table thead.is-stuck th {
    box-shadow: 0 4px 14px rgba(15, 23, 42, .14);
}

.plan-table .sort-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: auto;
    border: none;
    background: transparent;
    padding: .75rem .65rem;
    font: inherit;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #475569;
    cursor: pointer;
    text-align: inherit;
}

.plan-table .col-plan .sort-btn {
    justify-content: center;
    padding-left: .65rem;
    padding-right: .65rem;
}

.plan-table .col-money .sort-btn {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
    min-width: 5.25rem;
}

.plan-table .col-benefit .sort-btn {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
    min-width: 4.75rem;
}

.plan-table .sort-btn:hover,
.plan-table .sort-btn:focus-visible {
    background: #e2e8f0;
    outline: none;
}

.plan-table .sort-btn[aria-sort="ascending"],
.plan-table .sort-btn[aria-sort="descending"] {
    color: #1d4ed8;
}

.plan-table .sort-icon::after {
    content: '↕';
    font-size: .75rem;
    opacity: .45;
}

.plan-table .sort-btn[aria-sort="ascending"] .sort-icon::after {
    content: '↑';
    opacity: 1;
}

.plan-table .sort-btn[aria-sort="descending"] .sort-icon::after {
    content: '↓';
    opacity: 1;
}

.plan-table .col-actions {
    padding: .75rem .65rem;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #475569;
    text-align: center;
    white-space: nowrap;
}

.plan-group .plan-row {
    background: #fafafa;
}

.plan-group + .plan-group .plan-row {
    border-top: 1px solid var(--border);
}

.plan-group .plan-row:hover {
    background: #f8fafc;
}

.plan-table td {
    padding: .75rem .5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.plan-cell-info {
    min-width: 220px;
    max-width: 34rem;
    padding-left: .75rem;
    padding-right: .75rem;
}

.plan-table .plan-info {
    text-align: center;
}

.plan-table .benefit-maxes,
.plan-table .type-line,
.plan-table .plan-mobile-stats {
    justify-content: center;
}

.plan-cell-money {
    text-align: center;
    white-space: nowrap;
    width: 1%;
}

.plan-cell-money strong {
    font-size: .95rem;
}

.plan-cell-benefit {
    text-align: center;
    white-space: nowrap;
    width: 1%;
}

.plan-cell-benefit strong {
    font-size: .88rem;
}

.plan-cell-benefit .benefit-yes {
    color: #1e40af;
}

.plan-cell-benefit .benefit-no {
    color: var(--muted);
    font-weight: 600;
}

.plan-cell-actions {
    width: 1%;
    white-space: nowrap;
    padding-left: .35rem;
    padding-right: .65rem;
}

.plan-table .plan-card-actions {
    flex-wrap: nowrap;
    gap: .35rem;
    justify-content: center;
}

.plan-table .plan-card-actions .btn {
    padding: .45rem .55rem;
    font-size: .82rem;
    min-width: 0;
}

.plan-details-row td {
    padding: 0;
    border-bottom: none;
    background: #fff;
}

.plan-details-row:has(.plan-details:not([hidden])) td {
    border-bottom: 1px solid var(--border);
}

.plan-details-cell .plan-details {
    border-top: none;
}

.plan-details-cell .plan-details:not([hidden]) + .plan-details:not([hidden]) {
    border-top: 1px solid var(--border);
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.plan-card-main {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #fafafa;
}

.plan-card h3 {
    margin: 0 0 .35rem;
    font-size: 1rem;
}

.plan-id-inline {
    margin-left: .45rem;
    font-size: .82rem;
    font-weight: 600;
    color: #5b21b6;
    background: #f5f3ff;
    padding: .1rem .45rem;
    border-radius: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.meta {
    margin: .15rem 0;
    color: var(--muted);
    font-size: .9rem;
}

.benefit-maxes {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .9rem;
    margin: .35rem 0 .15rem;
    font-size: .82rem;
}

.benefit-maxes span {
    color: var(--text);
}

.benefit-maxes em {
    font-style: normal;
    font-weight: 600;
    color: var(--muted);
    margin-right: .25rem;
}

.type-line {
    margin: .15rem 0;
    color: var(--muted);
    font-size: .9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.giveback-flag {
    display: inline-flex;
    align-items: center;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.giveback-flag.yes {
    background: #d1fae5;
    color: #065f46;
}

.giveback-flag.no {
    background: #f3f4f6;
    color: #6b7280;
}

.commission-flag {
    display: inline-flex;
    align-items: center;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.commission-flag.blocked {
    background: #fee2e2;
    color: #991b1b;
}

.otc-flag {
    display: inline-flex;
    align-items: center;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.otc-flag.yes {
    background: #dbeafe;
    color: #1e40af;
}

.otc-flag.no {
    background: #f3f4f6;
    color: #6b7280;
}

.tag {
    display: inline-block;
    background: #eef2ff;
    color: #3730a3;
    padding: .1rem .45rem;
    border-radius: 6px;
    font-size: .78rem;
    margin-right: .4rem;
}

.plan-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    gap: .75rem;
    text-align: center;
}

.plan-stats .label {
    display: block;
    font-size: .75rem;
    color: var(--muted);
}

.plan-stats strong {
    font-size: 1rem;
}

.giveback { color: var(--accent); }

.plan-details {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid var(--border);
}

.plan-details .loading {
    color: var(--muted);
    font-style: italic;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section h4 {
    margin: 0 0 .5rem;
    font-size: .95rem;
    color: #1e40af;
    border-bottom: 1px solid #dbeafe;
    padding-bottom: .25rem;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

.detail-table th, .detail-table td {
    border: 1px solid var(--border);
    padding: .35rem .5rem;
    vertical-align: top;
    word-break: break-word;
}

.detail-table th {
    background: #f8fafc;
    width: 38%;
    text-align: left;
}

.alert {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 2rem 0;
}

.scroll-top-btn {
    position: fixed;
    right: 1.35rem;
    bottom: 1.35rem;
    width: 3.75rem;
    height: 3.75rem;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    color: #fff;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 32px rgba(37, 99, 235, .38);
    opacity: 0;
    visibility: hidden;
    transform: translateY(1.25rem) scale(.92);
    transition: opacity .28s ease, transform .28s ease, visibility .28s ease, box-shadow .2s ease;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-top-btn:hover {
    box-shadow: 0 18px 36px rgba(37, 99, 235, .48);
    transform: translateY(-3px) scale(1.04);
}

.scroll-top-btn:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.scroll-top-icon {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
    margin-top: -.15rem;
}

.plan-mobile-stats {
    display: none;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: .45rem 0 0;
    font-size: .85rem;
}

.plan-mobile-stats em {
    font-style: normal;
    font-weight: 600;
    color: var(--muted);
    margin-right: .2rem;
}

@media (max-width: 860px) {
    .plan-table {
        width: 100%;
    }

    .results-panel {
        overflow-x: auto;
    }

    .plan-table .col-money,
    .plan-cell-money,
    .plan-table .col-benefit,
    .plan-cell-benefit {
        display: none;
    }

    .plan-mobile-stats {
        display: flex;
    }

    .plan-cell-info {
        max-width: none;
        padding-right: .65rem;
    }

    .plan-table thead .col-actions {
        text-align: center;
    }

    .plan-table .plan-card-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Results toolbar & alternate views */
#planListView[hidden],
#planCardsView[hidden],
#planTableView[hidden] {
    display: none !important;
}

.plan-result-item.is-hidden-by-filter,
tbody.plan-result-item.is-hidden-by-filter {
    display: none !important;
}

.results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.results-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .85rem;
    flex: 1 1 auto;
}

.results-sort-group {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.results-sort-label {
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
}

.results-sort,
.plan-search-input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .45rem .55rem;
    font-size: .85rem;
    background: #fff;
}

.plan-search-label {
    margin-left: auto;
}

.plan-search-input {
    min-width: 200px;
    flex: 1 1 180px;
    max-width: 280px;
}

.sort-dir-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.sort-dir-btn {
    border: none;
    background: #fff;
    padding: .42rem .55rem;
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.sort-dir-btn.is-active {
    background: #eff6ff;
    color: var(--primary-dark);
}

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.view-toggle-btn {
    border: none;
    background: #fff;
    padding: .45rem .75rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.view-toggle-btn.is-active {
    background: #eff6ff;
    color: var(--primary-dark);
}

.results-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: 1.1rem;
}

.page-btn {
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 .45rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 700;
    font-size: .92rem;
    cursor: pointer;
    color: var(--text);
}

.page-btn.is-active {
    background: var(--primary);
    color: #fff;
}

.page-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--muted);
    font-weight: 700;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.plan-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.plan-list-item:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.plan-list-badges,
.plan-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .4rem;
    align-items: center;
}

.plan-list-title,
.plan-card-title {
    margin: 0 0 .2rem;
    font-size: 1.05rem;
    line-height: 1.35;
}

.plan-list-carrier,
.plan-card-carrier {
    margin: 0 0 .55rem;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
}

.plan-list-id,
.plan-card-id {
    margin: .45rem 0 0;
    font-family: Consolas, monospace;
    font-size: .72rem;
    color: var(--muted);
}

.plan-list-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .65rem;
    min-width: 200px;
}

.plan-list-price {
    text-align: right;
}

.plan-list-price-label,
.plan-card-price-label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
}

.plan-list-price-value,
.plan-card-price-value {
    display: block;
    font-size: 1.75rem;
    line-height: 1.1;
    color: var(--primary-dark);
}

.plan-list-price-period,
.plan-card-price-period {
    font-size: .82rem;
    color: var(--muted);
    font-weight: 700;
}

.plan-list-actions-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .55rem;
}

.plan-list-actions {
    justify-content: flex-end;
}

.plan-list-details,
.plan-card-details {
    grid-column: 1 / -1;
    margin-top: .25rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.plan-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    transition: box-shadow .15s ease, transform .15s ease;
}

.plan-card:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
    transform: translateY(-2px);
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
}

.plan-card-price {
    text-align: right;
}

.plan-card-footer {
    margin-top: auto;
    padding-top: .65rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    flex-wrap: wrap;
}

.plan-preview-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem 1rem;
    padding: .7rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: .15rem 0 0;
}

.plan-preview-col {
    display: grid;
    gap: .4rem;
}

.plan-preview-stat {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .45rem;
    font-size: .78rem;
    line-height: 1.35;
}

.plan-preview-stat span {
    color: var(--muted);
    flex: 1 1 auto;
}

.plan-preview-stat strong {
    color: var(--text);
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
    max-width: 52%;
}

.plan-preview-stat strong.benefit-highlight {
    color: var(--accent);
}

.plan-type-tag {
    display: inline-block;
    font-size: .72rem;
    font-weight: 800;
    color: #475569;
    background: #f1f5f9;
    padding: .12rem .45rem;
    border-radius: 999px;
}

.plan-list-side .plan-compare-toggle,
.plan-card-footer .plan-compare-toggle {
    margin-top: 0;
}

.plan-list-item .plan-card-actions,
.plan-card .plan-card-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

@media (max-width: 860px) {
    .plan-list-item {
        grid-template-columns: 1fr;
    }

    .plan-list-side {
        align-items: flex-start;
    }

    .plan-list-price,
    .plan-list-actions-wrap {
        align-items: flex-start;
        text-align: left;
    }

    .plan-list-price {
        text-align: left;
    }

    .plan-card-header {
        flex-direction: column;
    }

    .plan-card-price {
        text-align: left;
    }

    .results-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .plan-search-label {
        margin-left: 0;
    }
}

/* Plan compare */
.plan-compare-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .86rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.plan-compare-toggle input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.plan-compare-toggle input:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.plan-table-compare {
    white-space: nowrap;
    text-align: center;
}

.compare-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    background: #fff;
    border-top: 2px solid var(--primary);
    box-shadow: 0 -8px 28px rgba(15, 23, 42, .12);
}

.compare-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .85rem 1rem;
    flex-wrap: wrap;
}

.compare-bar-text {
    margin: 0;
    font-size: .88rem;
    color: var(--muted);
    white-space: nowrap;
}

.compare-bar-text strong {
    color: var(--primary-dark);
    font-size: 1rem;
}

.compare-bar-slots {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    flex: 1 1 220px;
    min-width: 0;
}

.compare-bar-slot {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .35rem .45rem .35rem .7rem;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-size: .78rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.compare-bar-slot-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14rem;
}

.compare-bar-slot-remove {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .15rem;
}

.compare-bar-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-left: auto;
}

body.compare-bar-open {
    padding-bottom: 5.5rem;
}

.compare-limit-note {
    position: fixed;
    left: 50%;
    bottom: 5.75rem;
    transform: translateX(-50%);
    z-index: 121;
    margin: 0;
    padding: .55rem .85rem;
    border-radius: 10px;
    background: #1e293b;
    color: #fff;
    font-size: .84rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
}

.compare-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.compare-modal[hidden] {
    display: none !important;
}

.compare-modal-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: rgba(15, 23, 42, .55);
    cursor: pointer;
}

.compare-modal-panel {
    position: relative;
    width: min(1100px, 100%);
    max-height: min(88vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
    padding: 1rem 1.1rem 1.15rem;
}

.compare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.compare-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.compare-modal-close {
    border: none;
    background: #f1f5f9;
    color: var(--text);
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.compare-modal-note {
    margin: .85rem 0 0;
    font-size: .78rem;
    color: var(--muted);
}

.compare-table-wrap {
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.compare-modal .compare-table,
.mc-compare-modal .compare-table {
    border-collapse: separate;
    border-spacing: 0;
}

.compare-modal .compare-table thead th,
.mc-compare-modal .compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafafa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.compare-table th,
.compare-table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
    font-size: .86rem;
}

.compare-table thead th {
    background: #fafafa;
    border-bottom: 2px solid var(--border);
}

.compare-table tbody th {
    color: var(--muted);
    font-weight: 700;
    width: 11rem;
    min-width: 9rem;
}

.compare-section-row th {
    background: #eef2f7;
    color: var(--primary-dark);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--border);
}

.compare-table .compare-highlight {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.compare-plan-head {
    min-width: 11rem;
}

.compare-plan-name {
    display: block;
    font-weight: 800;
    color: var(--text);
    line-height: 1.35;
}

.compare-plan-variant,
.compare-plan-carrier,
.compare-plan-meta {
    display: block;
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}

.compare-actions-row td,
.compare-actions-row th {
    border-bottom: none;
    padding-top: .85rem;
}

body.compare-modal-open {
    overflow: hidden;
}
