.mvc-viscosity-calculator {
    --mvc-accent: #b62b3d;
    --mvc-accent-soft: color-mix(in srgb, var(--mvc-accent) 10%, white);
    --mvc-border: #d8dee9;
    --mvc-muted: #64748b;
    --mvc-bg: #ffffff;
    --mvc-soft: #f8fafc;
    --mvc-text: #1f2937;
    --mvc-danger: #b42318;
    --mvc-radius: 1rem;
    color: var(--mvc-text);
    container-type: inline-size;
}

.mvc-viscosity-calculator * { box-sizing: border-box; }

.mvc-card {
    overflow: hidden;
    background: var(--mvc-bg);
    border: 1px solid var(--mvc-border);
    border-radius: var(--mvc-radius);
    box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.08);
}

.mvc-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: clamp(1rem, 3vw, 1.75rem);
    background: linear-gradient(135deg, var(--mvc-accent-soft), #fff 62%);
    border-bottom: 1px solid var(--mvc-border);
}

.mvc-logo {
    flex: 0 0 auto;
    display: block;
    max-width: min(180px, 42vw);
    max-height: 76px;
    object-fit: contain;
}

.mvc-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.mvc-subtitle {
    max-width: 68ch;
    margin: .4rem 0 0;
    color: var(--mvc-muted);
}

.mvc-form,
.mvc-note,
.mvc-results {
    margin: clamp(1rem, 3vw, 1.75rem);
}

.mvc-fieldset { border: 0; margin: 0; padding: 0; }

.mvc-section-title {
    display: block;
    width: 100%;
    margin: 0 0 .75rem;
    font-size: 1rem;
    font-weight: 800;
}

.mvc-input-panel {
    border: 1px solid var(--mvc-border);
    border-radius: .875rem;
    padding: 1rem;
    background: #fff;
}

.mvc-input-panel + .mvc-input-panel { margin-top: .875rem; }

.mvc-panel-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .85rem;
    font-weight: 800;
}

.mvc-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    background: var(--mvc-accent);
    color: #fff;
    font-size: .85rem;
    line-height: 1;
}

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

.mvc-field label {
    display: block;
    margin-bottom: .4rem;
    font-size: .93rem;
    font-weight: 700;
}

.mvc-field input,
.mvc-field select {
    width: 100%;
    min-height: 2.85rem;
    border: 1px solid var(--mvc-border);
    border-radius: .625rem;
    padding: .55rem .75rem;
    background-color: #fff;
    color: var(--mvc-text);
    font: inherit;
}

.mvc-field input:hover,
.mvc-field select:hover { border-color: color-mix(in srgb, var(--mvc-accent) 45%, var(--mvc-border)); }

.mvc-field input:focus,
.mvc-field select:focus,
.mvc-btn:focus,
.mvc-use-unit:focus {
    border-color: var(--mvc-accent);
    outline: 0;
    box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--mvc-accent) 18%, transparent);
}

.mvc-actions {
    position: sticky;
    bottom: .5rem;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
    margin-top: 1rem;
    padding: .75rem;
    border: 1px solid var(--mvc-border);
    border-radius: .875rem;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
}

.mvc-btn {
    appearance: none;
    border: 1px solid var(--mvc-border);
    border-radius: .625rem;
    padding: .625rem 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.mvc-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 .5rem 1.25rem rgba(15, 23, 42, 0.09);
}

.mvc-btn:disabled { cursor: not-allowed; opacity: .55; }
.mvc-btn-primary { border-color: var(--mvc-accent); background: var(--mvc-accent); color: #fff; }
.mvc-btn-secondary { background: #fff; color: var(--mvc-text); }

.mvc-error {
    min-height: 1.4em;
    margin: .75rem 0 0;
    color: var(--mvc-danger);
    font-weight: 700;
}

.mvc-note {
    padding: .875rem 1rem;
    border-left: .25rem solid var(--mvc-accent);
    border-radius: .75rem;
    background: var(--mvc-soft);
    color: var(--mvc-muted);
}

.mvc-results { margin-top: 1.5rem; }

.mvc-results-header {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.mvc-results h3 { margin: 0; font-size: 1.18rem; }

.mvc-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .35rem .7rem;
    background: var(--mvc-accent-soft);
    color: var(--mvc-text);
    font-size: .9rem;
    font-weight: 700;
}

.mvc-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--mvc-border);
    border-radius: .875rem;
    background: #fff;
}

.mvc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 720px;
}

.mvc-table th,
.mvc-table td {
    padding: .72rem .85rem;
    border-bottom: 1px solid var(--mvc-border);
    text-align: left;
    vertical-align: middle;
}

.mvc-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--mvc-soft);
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.mvc-table td:nth-child(3),
.mvc-table th:nth-child(3) { text-align: right; }

.mvc-table td:last-child,
.mvc-table th:last-child { text-align: left; width: 1%; white-space: nowrap; }
.mvc-table tr:last-child td { border-bottom: 0; }
.mvc-table tbody tr:hover { background: #fbfdff; }

.mvc-source-row { background: var(--mvc-accent-soft); }

.mvc-source-badge {
    display: inline-flex;
    align-items: center;
    margin-left: .5rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--mvc-accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    vertical-align: middle;
}

.mvc-result-value {
    width: 100%;
    max-width: 220px;
    min-height: 2.25rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    padding: .38rem .5rem;
    background: transparent;
    color: var(--mvc-text);
    text-align: right;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.mvc-result-value:focus {
    border-color: var(--mvc-border);
    outline: 0;
    background: #fff;
}

.mvc-use-unit {
    border: 1px solid var(--mvc-border);
    border-radius: 999px;
    padding: .45rem .7rem;
    background: #fff;
    color: var(--mvc-text);
    cursor: pointer;
    font-size: .84rem;
    font-weight: 800;
    white-space: nowrap;
}

.mvc-use-unit:hover {
    border-color: var(--mvc-accent);
    color: var(--mvc-accent);
}

@media (max-width: 768px) {
    .mvc-header { align-items: flex-start; flex-direction: column; }
    .mvc-grid { grid-template-columns: 1fr; }
    .mvc-actions { position: static; flex-direction: column; }
    .mvc-btn { width: 100%; }
}

/* Mobile result cards. Kept in a reusable selector block so both modern
   container queries and the browser-width fallback render identically. */
@container (max-width: 620px) {
    .mvc-table-wrap { overflow: hidden; }
    .mvc-table { min-width: 0; table-layout: fixed; }
    .mvc-table thead { display: none; }
    .mvc-table,
    .mvc-table tbody { display: block; width: 100%; }
    .mvc-table tr {
        display: block;
        width: auto;
        min-width: 0;
        margin: .75rem;
        border: 1px solid var(--mvc-border);
        border-radius: .75rem;
        overflow: hidden;
        background: #fff;
    }
    .mvc-table td {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
        gap: .6rem;
        align-items: center;
        padding: .68rem .75rem;
        border-bottom: 1px solid var(--mvc-border);
        overflow-wrap: anywhere;
    }
    .mvc-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: var(--mvc-muted);
        font-size: .82rem;
        font-weight: 800;
        overflow-wrap: anywhere;
    }
    .mvc-table td:nth-child(3) { text-align: left; }
    .mvc-table td:last-child {
        display: block;
        width: 100%;
        white-space: normal;
    }
    .mvc-table td:last-child::before { content: none; }
    .mvc-result-value {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        text-align: left;
    }
    .mvc-source-badge {
        display: table;
        margin: .35rem 0 0;
    }
    .mvc-use-unit { width: 100%; white-space: normal; }
}

/* Fallback for browsers/templates where CSS container queries are unavailable
   or where the module container is wider than the actual viewport. */
@media (max-width: 620px) {
    .mvc-table-wrap { overflow: hidden; }
    .mvc-table { min-width: 0; table-layout: fixed; }
    .mvc-table thead { display: none; }
    .mvc-table,
    .mvc-table tbody { display: block; width: 100%; }
    .mvc-table tr {
        display: block;
        width: auto;
        min-width: 0;
        margin: .625rem;
        border: 1px solid var(--mvc-border);
        border-radius: .75rem;
        overflow: hidden;
        background: #fff;
    }
    .mvc-table td {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
        gap: .6rem;
        align-items: center;
        padding: .65rem .7rem;
        border-bottom: 1px solid var(--mvc-border);
        overflow-wrap: anywhere;
    }
    .mvc-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: var(--mvc-muted);
        font-size: .82rem;
        font-weight: 800;
        overflow-wrap: anywhere;
    }
    .mvc-table td:nth-child(3) { text-align: left; }
    .mvc-table td:last-child {
        display: block;
        width: 100%;
        white-space: normal;
    }
    .mvc-table td:last-child::before { content: none; }
    .mvc-result-value {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        text-align: left;
    }
    .mvc-source-badge {
        display: table;
        margin: .35rem 0 0;
    }
    .mvc-use-unit { width: 100%; white-space: normal; }
}

@media (max-width: 400px) {
    .mvc-table tr { margin: .45rem; }
    .mvc-table td {
        grid-template-columns: 1fr;
        gap: .25rem;
    }
}

@media print {
    .mvc-actions,
    .mvc-use-unit { display: none !important; }
    .mvc-card { box-shadow: none; border: 0; }
    .mvc-header { background: #fff; }
}

.mvc-custom-intro {
    max-width: 72ch;
    margin-top: .65rem;
    color: var(--mvc-text);
}

.mvc-custom-intro p:last-child { margin-bottom: 0; }

.mvc-layout-compact .mvc-form,
.mvc-layout-compact .mvc-note,
.mvc-layout-compact .mvc-results {
    margin: 1rem;
}

.mvc-layout-compact .mvc-input-panel,
.mvc-layout-compact .mvc-actions,
.mvc-layout-compact .mvc-note,
.mvc-layout-compact .mvc-table th,
.mvc-layout-compact .mvc-table td {
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.mvc-layout-compact .mvc-header {
    padding: 1rem;
}


/* Informational disclaimer */
.mvc-disclaimer {
    margin-top: 1.25rem;
    padding: 1rem 1.125rem;
    border: 1px solid #d7dee8;
    border-radius: calc(var(--mvc-radius) * 0.6);
    background: var(--mvc-soft, #f8fafc);
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.55;
}

.mvc-disclaimer-title {
    display: block;
    margin-bottom: 0.35rem;
    color: #1f2937;
}

.mvc-disclaimer p {
    margin: 0;
}

@media (max-width: 575.98px) {
    .mvc-disclaimer {
        padding: 0.875rem;
        font-size: 0.8125rem;
    }
}
