:root {
    --ama-pdf-width: 50vw;
}

/* Main page viewport scrollbar — blue thumb on a dark track (#252525). 25px wide to match PDF panel. */
html {
    scrollbar-color: #1E90FF #252525;
    scrollbar-width: auto;
}

html::-webkit-scrollbar {
    width: 25px;
    height: 25px;
}

html::-webkit-scrollbar-track {
    background: #252525;
}

html::-webkit-scrollbar-thumb {
    background-color: #1E90FF;
    border-radius: 10px;
    border: 2px solid #252525;
    min-height: 40px;
}

html::-webkit-scrollbar-corner {
    background: #252525;
}

html::-webkit-scrollbar-thumb:hover {
    background-color: #1873CC;
}

/* Larger arrow buttons (Windows-style scrollbars in Chrome/Edge) */
html::-webkit-scrollbar-button:single-button:vertical:decrement,
html::-webkit-scrollbar-button:single-button:vertical:increment {
    display: block;
    width: 25px;
    height: 25px;
    background-color: #1E90FF;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 8px;
}

html::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M5%200%20L10%206%20L0%206z'/%3E%3C/svg%3E");
}

html::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0%200%20L10%200%20L5%206z'/%3E%3C/svg%3E");
}

html::-webkit-scrollbar-button:single-button:vertical:decrement:hover,
html::-webkit-scrollbar-button:single-button:vertical:increment:hover {
    background-color: #1873CC;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
}

/* First-paint FOUC: all main sections start .hidden, so .container would briefly show as an empty white
   strip on grey before init reveals auth / landing / Ch.16 (notably after PD → IME full navigation). */
body.ime-app-shell-pending .container {
    visibility: hidden;
}

/* PD → IME Go Back: same boot overlay styling as PD Studio (pd-calculator/css/styles.css). */
.pd-boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 25px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #f1f5f9;
    color: #64748b;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.pd-boot-overlay__text {
    margin: 0;
}

body.ime-shell--booting .pd-boot-overlay {
    display: flex;
}

html:has(body.ime-shell--booting) {
    overflow-y: scroll;
}

body.ime-shell--booting .container {
    visibility: hidden;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 1200px;
    width: min(1200px, calc(100vw - 40px));
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    padding: 20px;
    box-sizing: border-box;
}

/* Landing only: shorten card bottom ~15px without changing inner layout (Ch. 16 keeps full padding). */
.container:has(#chapterLandingPage:not(.hidden)) {
    padding-bottom: 6px;
}

/* AMA Guides side-by-side PDF viewer */
.ama-pdf-viewer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--ama-pdf-width);
    min-width: 420px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
    border-left: 1px solid #d0d7e2;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.ama-pdf-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e6f0;
    background: linear-gradient(90deg, #f4f8ff 0%, #ffffff 60%);
}

.ama-pdf-title {
    flex: 0 0 178px;
    width: 178px;
    min-width: 178px;
    font-weight: 600;
    color: #1E3A8A;
    font-size: 14px;
    line-height: 1.15;
}

.ama-pdf-subtitle {
    display: block;
    margin-left: 0;
    margin-top: 2px;
    font-weight: 400;
    font-size: 11px;
    color: #4b5563;
}

.ama-pdf-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.ama-pdf-toggle-button {
    position: relative;
    left: -16px;
    margin-left: 6px;
    flex-shrink: 0;
    padding: 5px 8px;
    min-width: 64px;
    font-size: 11px;
    border-radius: 999px;
    background-color: #04B583;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.ama-pdf-toggle-button:hover {
    background-color: #039b70;
    box-shadow: 0 0 0 1px rgba(4, 181, 131, 0.2);
}

.ama-pdf-search-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #111827;
    background-color: #eef3ff;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid #c4d2ff;
}

.ama-pdf-search-label input[type="text"] {
    border: none;
    outline: none;
    font-size: 11px;
    padding: 3px 4px;
    min-width: 128px;
    background: transparent;
}

.ama-pdf-search-button {
    padding: 5px 8px;
    min-width: 64px;
    font-size: 11px;
    border-radius: 999px;
    background-color: #1E90FF;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.ama-pdf-search-button:hover {
    background-color: #1873CC;
    box-shadow: 0 0 0 1px rgba(24, 115, 204, 0.15);
}

.ama-pdf-close-btn {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #111827;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.ama-pdf-close-btn:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2);
}

body.ama-pdf-open .container {
    width: calc(100vw - var(--ama-pdf-width) - 40px);
    max-width: calc(100vw - var(--ama-pdf-width) - 40px);
    margin-left: 20px;
    margin-right: auto;
}

.ama-pdf-body {
    flex: 1;
    background-color: #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ama-pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #d7dde8;
    background-color: #f8fafc;
}

.ama-pdf-page-controls,
.ama-pdf-zoom-controls,
.ama-pdf-search-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ama-pdf-page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.ama-pdf-page-indicator,
.ama-pdf-search-status {
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
}

.ama-pdf-page-jump input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
    width: 56px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background-color: #ffffff;
    color: #111827;
    font-size: 12px;
    text-align: center;
    outline: none;
    box-sizing: border-box;
}

.ama-pdf-page-jump input[type="number"]:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}

.ama-pdf-page-jump input[type="number"]::-webkit-outer-spin-button,
.ama-pdf-page-jump input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ama-pdf-search-status {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ama-pdf-mini-button,
.ama-pdf-search-button,
.ama-pdf-toggle-button,
.ama-pdf-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
}

.ama-pdf-mini-button {
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #111827;
    cursor: pointer;
}

.ama-pdf-mini-button:hover {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

.ama-pdf-mini-button:disabled {
    opacity: 0.5;
    cursor: default;
    background-color: #f8fafc;
    border-color: #dbe3ee;
}

.ama-pdf-scroll-container {
    flex: 1;
    overflow: auto;
    padding: 14px;
    background-color: #dbe2ea;
    scrollbar-color: #94a3b8 #cdd5df;
    scrollbar-width: auto;
}

.ama-pdf-scroll-container::-webkit-scrollbar {
    width: 25px;
    height: 25px;
}

.ama-pdf-scroll-container::-webkit-scrollbar-track {
    background: #cdd5df;
}

.ama-pdf-scroll-container::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    border-radius: 10px;
    border: 2px solid #cdd5df;
}

.ama-pdf-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: #7c8494;
}

.ama-pdf-page-container {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    background-color: #ffffff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18);
}

.ama-pdf-canvas {
    display: block;
    max-width: 100%;
}

.ama-pdf-text-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.ama-pdf-text-layer span {
    position: absolute;
    transform-origin: 0 0;
    white-space: pre;
    color: transparent;
    -webkit-text-fill-color: transparent;
    pointer-events: auto;
    line-height: 1;
}

.ama-pdf-text-layer span::selection {
    background: rgba(59, 130, 246, 0.32);
}

.ama-pdf-text-layer span.ama-pdf-match {
    background: rgba(250, 204, 21, 0.45);
    border-radius: 2px;
}

.ama-pdf-text-layer span.ama-pdf-match-active {
    background: rgba(249, 115, 22, 0.55);
}

.ama-pdf-link {
    color: #1E40AF;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.ama-pdf-link:hover {
    color: #1D4ED8;
}

h1, h2, h3 {
    color: #333;
    text-align: center;
}

.landing-page {
    padding-top: 6px;
}

.landing-header-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
    padding: 6px 16px;
    border: 1px solid #d9e2ec;
    border-top: 3px solid #2596ff;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.landing-header-card::before {
    content: "";
    position: absolute;
    inset: 5px 320px 4px 210px;
    background-image: url("../assets/landing-header-wave.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0.58;
    pointer-events: none;
    z-index: 0;
}

.landing-header-left {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.landing-header-logo {
    width: 257px;
    height: auto;
    display: block;
}

.landing-header-right {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

.landing-header-title {
    margin: -5px 0 6px;
    line-height: 0;
    text-align: right;
}

.wp-studio-logo {
    display: inline-block;
    height: 28px;
    width: auto;
    max-width: min(148px, 38vw);
    object-fit: contain;
    vertical-align: bottom;
    transform: translate(-4px, 3px);
}

.landing-header-links {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 5px;
}

.landing-header-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: calc(0.24rem + 1px) 0.62rem calc(0.24rem - 1px);
    border-radius: 999px;
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.73rem;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.landing-header-pill:hover {
    background: #dbeafe;
}

@media (max-width: 900px) {
    .landing-header-card::before {
        display: none;
    }

    .landing-header-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .landing-header-logo {
        width: 242px;
    }

    .landing-header-right {
        width: 100%;
        align-items: flex-start;
    }

    .landing-header-title {
        text-align: left;
    }

    .wp-studio-logo {
        max-width: min(140px, 52vw);
    }
}

@media (max-width: 640px) {
    .landing-header-card {
        padding: 6px 12px;
    }

    .landing-header-logo {
        width: 218px;
    }

    .wp-studio-logo {
        max-width: min(128px, 58vw);
    }

    .landing-header-links {
        flex-wrap: wrap;
        gap: 6px;
    }
}

.chapter-card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.chapter-card {
    background-color: #f9f9f9;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    padding: 13px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.2;
    box-sizing: border-box;
    min-height: 82px;
}

.chapter-card::before {
    content: "";
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.96;
}

.chapter-card .chapter-card-label {
    display: inline-block;
    line-height: 1.2;
}

.chapter-card[data-chapter="3"]::before { background-image: url("../chapter-icons/3.png?v=3"); }
.chapter-card[data-chapter="4"]::before { background-image: url("../chapter-icons/4.png?v=2"); }
.chapter-card[data-chapter="5"]::before { background-image: url("../chapter-icons/5.png?v=3"); }
.chapter-card[data-chapter="6"]::before { background-image: url("../chapter-icons/6.png?v=3"); }
.chapter-card[data-chapter="7"]::before { background-image: url("../chapter-icons/7.png?v=2"); }
.chapter-card[data-chapter="8"]::before { background-image: url("../chapter-icons/8.png?v=2"); }
.chapter-card[data-chapter="9"]::before { background-image: url("../chapter-icons/9.png?v=2"); }
.chapter-card[data-chapter="10"]::before { background-image: url("../chapter-icons/10.png?v=2"); }
.chapter-card[data-chapter="11"]::before { background-image: url("../chapter-icons/11.png?v=2"); }
.chapter-card[data-chapter="12"]::before { background-image: url("../chapter-icons/12.png?v=2"); }
.chapter-card[data-chapter="13"]::before { background-image: url("../chapter-icons/13.png?v=3"); }
.chapter-card[data-chapter="gaf"]::before { background-image: url("../chapter-icons/gaf.png?v=3"); }
.chapter-card[data-chapter="15"]::before { background-image: url("../chapter-icons/15.png?v=2"); }
.chapter-card[data-chapter="16"]::before { background-image: url("../chapter-icons/16.png?v=3"); }
.chapter-card[data-chapter="17"]::before { background-image: url("../chapter-icons/17.png?v=3"); }

.chapter-card:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    color: #0f3f75;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
    transform: translateY(-5px);
}

.chapter-card.selected {
    background-color: #1E90FF;
    color: white;
}

.chapter-card.selected::before {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.landing-page-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 25px auto 0;
    width: 100%;
}

.landing-page-actions button {
    display: inline-block;
    width: 200px;
    margin: 0;
    box-sizing: border-box;
    height: 44px;
    line-height: 1;
}

#chapterSkipCalculatePd,
#chapterLandingGoBack,
#chapterProceed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#chapterSkipCalculatePd::before,
#chapterLandingGoBack::before,
#chapterProceed::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#chapterSkipCalculatePd::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3.5' width='16' height='17' rx='2' ry='2'/%3E%3Cline x1='8' y1='8' x2='16' y2='8'/%3E%3Cline x1='8' y1='12' x2='11' y2='12'/%3E%3Cline x1='13' y1='12' x2='16' y2='12'/%3E%3Cline x1='10' y1='16' x2='14' y2='16'/%3E%3C/svg%3E");
}

#chapterLandingGoBack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

#chapterProceed::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

.chapter-selection-message {
    min-height: 24px;
    margin-top: 8px;
    text-align: center;
    color: #c62828;
    font-size: 14px;
}

/* Keep selection message aligned after lowering .landing-page-actions by 5px */
.landing-page .chapter-selection-message {
    margin-top: 3px;
}

.chapter-running-total-wrap {
    margin-top: 16px;
}

.chapter-running-total-card,
.ch16-running-totals-card {
    border: 1px solid #1e90ff;
}

.calculator-card.overall-total.chapter-running-total-card,
.calculator-card.overall-total.ch16-running-totals-card,
.calculator-card.overall-total.gaf-overall-total-card {
    border: 1px solid #1e90ff !important;
}

.chapter-running-total-card h3 {
    margin-top: 0;
}

.ch16-header-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    margin: 6px 0 14px;
    padding: 6px 16px;
    box-sizing: border-box;
    border: 1px solid #d8dee7;
    border-radius: 12px;
    border-top: 3px solid #1E90FF;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.ch16-header-card::before {
    content: "";
    position: absolute;
    inset: 5px 440px 4px 225px;
    background-image: url("../assets/ch16-header-wave.png");
    background-repeat: no-repeat;
    background-position: left center;
    background-size: cover;
    opacity: 0.58;
    pointer-events: none;
    z-index: 0;
}

.ch16-header-logo-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 0 1 320px;
}

.ch16-header-logo {
    width: 257px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* Chapter badge + divider + title row: pack to the card’s right edge (same inset as `.landing-header-card` padding). */
.ch16-header-trailing {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

.ch16-header-chapter {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 22px;
}

body.ama-pdf-open .ch16-header-chapter {
    display: none;
}

/* Right UE only: chapter badge + grey vertical bar */
.ch16-header-chapter.ch16-header-chapter--ue-right {
    transform: translateX(-3px);
}

/* Left UE only: chapter badge + grey vertical bar */
.ch16-header-chapter.ch16-header-chapter--ue-left {
    transform: translateX(-2px);
}

/* Title + pills vertical rhythm matches `.landing-header-right` + `.landing-header-links`.
   Align the block to the right edge of the card (mirrors home header right column). */
.ch16-header-center {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

/* Match `.landing-header-title` (main header "CA Impairment Rating Engine" / Impairment Rating Engine styling). */
.ch16-header-title {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    transform: translateX(-6px);
    margin: -5px 0 6px;
    color: #1f2937;
    text-align: right;
    font-family: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
    font-size: 27px;
    font-weight: 650;
    line-height: 1.05;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Right UE only: nudge title row 2px right vs left UE */
.ch16-header-trailing:has(.ch16-header-chapter--ue-right) .ch16-header-title {
    transform: translateX(-3px);
}

.ch16-header-title-text {
    display: inline-block;
    transform: translateY(5px);
}

.ch16-header-links {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 5px;
}

.ch16-header-links .auth-sidebar-toggle {
    margin-left: 2px;
    flex-shrink: 0;
}

.ch16-header-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: calc(0.24rem + 1px) 0.62rem calc(0.24rem - 1px);
    border-radius: 999px;
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.73rem;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.ch16-header-pill:hover {
    background: #dbeafe;
}

.ch16-auth-sidebar-toggle {
    width: 34px;
    height: 34px;
    margin-left: 0;
    flex-shrink: 0;
}

.ch16-header-divider {
    width: 2px;
    height: 49px;
    background: #aab2bf;
    border-radius: 999px;
}

.ch16-header-badge,
.ch16-header-badge:visited,
.ch16-header-badge:active {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    min-width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #1E90FF;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    color: #ffffff;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ch16-header-badge:hover,
.ch16-header-badge:focus-visible {
    background: #1873cc;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(30, 144, 255, 0.28);
    color: #ffffff;
}

.ch16-header-badge-label {
    font-size: 8px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.ch16-header-badge-number {
    margin-top: 2px;
    font-size: 34px;
    line-height: 0.95;
    font-weight: 800;
}

@media (max-width: 900px) {
    .ch16-header-card::before {
        display: none;
    }

    .ch16-header-card {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        min-height: 0;
        padding: 6px 16px;
    }

    .ch16-header-logo-wrap {
        flex-basis: auto;
        justify-content: center;
    }

    .ch16-header-logo {
        width: 220px;
    }

    .ch16-header-trailing {
        flex-direction: column;
        width: 100%;
        justify-content: center;
        align-items: center;
        gap: 12px;
    }

    .ch16-header-chapter {
        gap: 14px;
    }

    .ch16-header-center {
        min-width: 0;
        width: 100%;
        align-items: center;
    }

    .ch16-header-title {
        font-size: 25px;
        white-space: normal;
        text-align: center;
    }

    .ch16-header-links {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .ch16-header-card {
        padding: 6px 12px;
    }

    .ch16-header-links {
        flex-wrap: wrap;
    }

    .ch16-header-title {
        font-size: 22px;
    }
}

.app-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.app-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 32px));
    padding: 24px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    text-align: center;
    box-sizing: border-box;
}

.ch16-transition-overlay {
    position: fixed;
    inset: 0;
    background-color: #ffffff; /* fully hide background during transition */
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ch16-transition-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #333;
}

.ch16-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(30, 144, 255, 0.2);
    border-top-color: #1E90FF;
    animation: ch16-spin 0.8s linear infinite;
}

@keyframes ch16-spin {
    to {
        transform: rotate(360deg);
    }
}

.addon-modal-overlay {
    z-index: 1001;
}

/* When PDF viewer is open, overlay only covers left (main app) so PDF stays ungreyed */
body.ama-pdf-open .addon-modal-overlay,
body.ama-pdf-open .app-modal-overlay {
    left: 0;
    right: auto;
    width: calc(100vw - var(--ama-pdf-width) - 20px);
    top: 0;
    bottom: 0;
}

/* When PDF viewer is open, shift modals left so they don't block the PDF */
body.ama-pdf-open .addon-modal-overlay .app-modal,
body.ama-pdf-open .app-modal-overlay .app-modal {
    left: 8%;
    transform: translateY(-50%);
}

/* When PDF viewer is open, limit CRPS warning overlay to left panel */
body.ama-pdf-open .crps-warning {
    left: 0;
    width: calc(100vw - var(--ama-pdf-width) - 20px);
}

/* When PDF viewer is open, shift inline-styled overlays and dialogs left */
body.ama-pdf-open .app-fixed-overlay {
    left: 0 !important;
    right: auto !important;
    width: calc(100vw - var(--ama-pdf-width) - 20px) !important;
    top: 0 !important;
    bottom: 0 !important;
}

/* Dialog is a sibling of overlay (both on body); position in left half of viewport */
body.ama-pdf-open .app-fixed-dialog {
    left: 25% !important;
    transform: translate(-50%, -50%) !important;
}

/* Start Over dialog is appended as a body-level sibling, so position it in the left app pane. */
body.ama-pdf-open .start-over-modal {
    left: calc((100vw - var(--ama-pdf-width) - 20px) / 2);
    transform: translate(-50%, -50%);
}

/* Start Over: tighter vertical padding and button spacing (~half previous) */
.start-over-modal.app-modal {
    padding: 12px 24px;
}

.start-over-modal .app-modal-actions {
    margin-top: 6px;
}

.start-over-modal .app-modal-actions button {
    margin: 10px auto;
}

/* Extremity selection dialog is also body-level; keep it in the app pane when PDF is open. */
body.ama-pdf-open .app-modal--extremity-selection {
    left: calc((100vw - var(--ama-pdf-width) - 20px) / 2);
    transform: translate(-50%, -50%);
}

/* Delete body part dialog is a body-level modal; keep it within the app pane when PDF is open. */
body.ama-pdf-open .ch16-delete-bodypart-modal {
    left: calc((100vw - var(--ama-pdf-width) - 20px) / 2);
    transform: translate(-50%, -50%);
}

body.ama-pdf-open .ch16-delete-method-modal {
    left: calc((100vw - var(--ama-pdf-width) - 20px) / 2);
    transform: translate(-50%, -50%);
}

/* All Add Method dialogs share this class; keep them in left app pane when PDF is open. */
body.ama-pdf-open .ch16-add-method-modal {
    left: calc((100vw - var(--ama-pdf-width) - 20px) / 2);
}

/* Grip/pinch invalid-readings modals: when PDF is open, dim only the main panel; PDF stays clear and usable */
body.ama-pdf-open #invalidModal,
body.ama-pdf-open #pinchInvalidModal {
    background-color: transparent;
    pointer-events: none;
    /* Above PDF viewer (1000) so transparent area still passes clicks through; dialog stacks above ::before */
    z-index: 1002;
    isolation: isolate;
}

body.ama-pdf-open #invalidModal::before,
body.ama-pdf-open #pinchInvalidModal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100vw - var(--ama-pdf-width) - 20px);
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 0;
}

body.ama-pdf-open #invalidModal .modal-content,
body.ama-pdf-open #pinchInvalidModal .pinch-modal-content {
    pointer-events: auto;
    position: relative;
    z-index: 1;
    margin-top: 15vh;
    margin-bottom: 0;
    margin-left: max(20px, 4vw);
    margin-right: auto;
}

/* Invalid readings (grip/pinch): separate the call-to-action from the citation paragraph */
.invalid-readings-prompt {
    display: block;
    margin-top: 1.15em;
    padding-top: 0.4em;
    font-weight: 600;
    color: #333;
}

.addon-modal,
.addon-entry-modal {
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: left 0.25s ease, transform 0.25s ease;
}

.addon-hint,
.addon-entry-instruction {
    margin: 0 0 12px;
    font-size: 14px;
    color: #555;
}

.addon-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 12px 0;
}

.addon-option {
    background-color: #f9f9f9;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    text-align: center;
}

.addon-option:hover {
    background-color: #e9e9e9;
}

.addon-option.selected {
    background-color: #1E90FF;
    color: white;
    border-color: #1E90FF;
}

.addon-modal .addon-selection-modal-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Narrow modal (~372px inner): fixed 200px×2 wraps; share row with flex + max-width */
.addon-modal .addon-selection-modal-actions button {
    display: inline-block;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 200px;
    margin: 0;
    box-sizing: border-box;
}

.addon-modal .addon-selection-modal-actions #addonSelectionGoBack,
.addon-modal .addon-selection-modal-actions #addonSelectionNext,
.addon-entry-modal .addon-entry-modal-actions #addonEntryGoBack,
.addon-entry-modal .addon-entry-modal-actions #addonEntryNext {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.addon-modal .addon-selection-modal-actions #addonSelectionGoBack::before,
.addon-modal .addon-selection-modal-actions #addonSelectionNext::after,
.addon-entry-modal .addon-entry-modal-actions #addonEntryGoBack::before,
.addon-entry-modal .addon-entry-modal-actions #addonEntryNext::after {
    content: "";
    display: inline-block;
    width: 19px;
    height: 19px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

.addon-modal .addon-selection-modal-actions #addonSelectionGoBack::before,
.addon-entry-modal .addon-entry-modal-actions #addonEntryGoBack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

.addon-modal .addon-selection-modal-actions #addonSelectionNext::after,
.addon-entry-modal .addon-entry-modal-actions #addonEntryNext::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

.addon-entry-modal h2 {
    text-align: center;
}

.addon-entry-modal .addon-entry-instruction {
    text-align: center;
}

.addon-entry-list {
    overflow-y: auto;
    max-height: 40vh;
    margin: 12px 0;
    padding-right: 4px;
}

.addon-entry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.addon-entry-row:last-child {
    border-bottom: none;
}

.addon-entry-label {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* Match ROM table number inputs for consistent look and spinner placement */
.addon-entry-input {
    width: 60px;
    padding: 5px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    box-sizing: border-box;
}

.addon-entry-total {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.45;
    color: #000000;
    margin-top: 8px;
}

.addon-max-cap-label {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.addon-max-cap-label .addon-max-cap-cb {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    cursor: pointer;
}

/* Higher specificity so .app-modal p doesn't override: subdued but readable */
.addon-entry-modal p.addon-entry-reference {
    margin: 44px 0 0;
    font-size: 14px;
    color: #333;
}

.addon-entry-reference .ama-pdf-link {
    color: #1E90FF;
    text-decoration: underline;
}

.addon-entry-modal .app-modal-actions {
    margin-top: 16px;
    text-align: center;
}

.addon-entry-modal .addon-entry-modal-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.addon-entry-modal .addon-entry-modal-actions button {
    display: inline-block;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 200px;
    margin: 0;
    box-sizing: border-box;
}

.app-modal h2 {
    margin: 0 0 12px;
}

.app-modal p {
    margin: 0;
    font-size: 18px;
}

.ch16-delete-bodypart-message span {
    display: inline-block;
    margin-top: 4px;
}

.app-modal-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 16px;
}

.app-modal-list div {
    line-height: 1.3;
}

.app-modal-actions {
    margin-top: 12px;
}

.start-over-modal .app-modal-actions #startOverNoButton,
.start-over-modal .app-modal-actions #startOverYesButton,
.start-over-modal .app-modal-actions .ch16-delete-all-digits-no,
.start-over-modal .app-modal-actions .ch16-delete-all-digits-yes,
.start-over-modal .app-modal-actions .ch16-delete-bodypart-no,
.start-over-modal .app-modal-actions .ch16-delete-bodypart-yes,
.start-over-modal .app-modal-actions .ch16-delete-method-no,
.start-over-modal .app-modal-actions .ch16-delete-method-yes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: row-reverse;
    gap: 12px;
}

.start-over-modal .app-modal-actions #startOverNoButton .app-modal-btn-icon,
.start-over-modal .app-modal-actions #startOverYesButton .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-all-digits-no .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-all-digits-yes .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-bodypart-no .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-bodypart-yes .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-method-no .app-modal-btn-icon,
.start-over-modal .app-modal-actions .ch16-delete-method-yes .app-modal-btn-icon {
    width: 18.9px;
    height: 18.9px;
    transform: translateY(0);
}

.app-modal-extremity-hint {
    margin-bottom: 12px !important;
}

/* Injured extremity modal: room for Left/Right + Go Back | Next on one row */
.app-modal.app-modal--extremity-selection {
    width: min(440px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
}

/* Footer: Go Back left of Next, single horizontal row (avoid wrap from two×200px in narrow modal) */
.extremity-modal-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
    padding-top: 8px;
}

.extremity-modal-actions button {
    display: inline-block;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 200px;
    margin: 0;
}

.extremity-modal-actions #extremityGoBackButton,
.extremity-modal-actions #extremityProceedButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.extremity-modal-actions #extremityGoBackButton::before,
.extremity-modal-actions #extremityProceedButton::after {
    content: "";
    display: inline-block;
    width: 19px;
    height: 19px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

.extremity-modal-actions #extremityGoBackButton::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

.extremity-modal-actions #extremityProceedButton::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

.fingers-arthroplasty-assign-info-modal {
    text-align: left;
    width: min(520px, calc(100vw - 32px));
    max-height: min(85vh, 640px);
    overflow-y: auto;
}

.fingers-arthroplasty-assign-info-body {
    text-align: left;
}

.fingers-arthroplasty-assign-info-modal .fingers-arthroplasty-assign-info-body p {
    font-size: 15px;
    line-height: 1.45;
    margin: 0 0 12px;
    text-align: left;
}

.fingers-arthroplasty-assign-info-list {
    margin: 0 0 12px 1.35em;
    padding: 0;
    font-size: 15px;
    line-height: 1.45;
}

.fingers-arthroplasty-assign-info-list li {
    margin-bottom: 8px;
}

.fingers-arthroplasty-assign-info-list li:last-child {
    margin-bottom: 0;
}

.fingers-arthroplasty-assign-info-actions {
    text-align: center;
    margin-top: 18px;
}

.fingers-arthroplasty-assign-info-modal .fingers-arthroplasty-assign-info-ok {
    display: block;
    width: 200px;
    margin: 0 auto;
    padding: 10px;
    background-color: #1E90FF;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

.fingers-arthroplasty-assign-info-modal .fingers-arthroplasty-assign-info-ok:hover {
    background-color: #1873CC;
}

.extremity-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 30px 0 6px 0;
}

.extremity-option {
    background-color: #f9f9f9;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    padding: 17px 24px 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    text-align: center;
}

.extremity-option:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    color: #0f3f75;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
    transform: translateY(-2px);
}

.extremity-option.selected {
    background-color: #1E90FF;
    color: white;
    border-color: #1E90FF;
}

.contralateral-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.contralateral-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.card {
    background-color: #f9f9f9;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#calculatorApp .card-container .ch16-body-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#calculatorApp .card-container .ch16-body-card::before {
    content: "";
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.96;
}

#calculatorApp .card-container .ch16-body-card .ch16-body-card-label {
    display: inline-block;
    line-height: 1.2;
}

#calculatorApp .card-container .ch16-body-card[data-value="shoulder"]::before { background-image: url("../ch16-icons/shoulder.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="elbow"]::before { background-image: url("../ch16-icons/elbow.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="wrist"]::before { background-image: url("../ch16-icons/wrist.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="thumb"]::before { background-image: url("../ch16-icons/thumb.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="index"]::before { background-image: url("../ch16-icons/index.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="middle"]::before { background-image: url("../ch16-icons/middle.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="ring"]::before { background-image: url("../ch16-icons/ring.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="little"]::before { background-image: url("../ch16-icons/little.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="nerve"]::before { background-image: url("../ch16-icons/nerve.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="vascular"]::before { background-image: url("../ch16-icons/vascular.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="grip"]::before { background-image: url("../ch16-icons/grip.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="amputation"]::before { background-image: url("../ch16-icons/amputation.png?v=4"); }
#calculatorApp .card-container .ch16-body-card[data-value="vascular"]::before { margin-left: 20px; }
#calculatorApp .card-container .ch16-body-card[data-value="grip"]::before { margin-left: 22px; }

#calculatorApp .card-container .ch16-body-card.selected::before,
#calculatorApp .card-container .ch16-body-card.ch16-locked-selected::before {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.card:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    color: #0f3f75;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
    transform: translateY(-5px);
}

.card.selected {
    background-color: #1E90FF;
    color: white;
}

.card.ch16-locked-selected {
    background-color: #6c8fb4;
    color: #fff;
    cursor: not-allowed;
}

.card.ch16-locked-selected:hover {
    background-color: #6c8fb4;
    transform: none;
}

.card-container.ch16-body-parts-locked {
    opacity: 0.58;
    pointer-events: none;
    user-select: none;
    filter: grayscale(0.2);
}

.card-container.ch16-body-parts-locked .card {
    cursor: not-allowed;
}

/* Ch. 16: hide body-part picker during calculator entry; tuck list under title */
#calculatorApp.ch16-calculator-phase .card-container {
    display: none;
}

#calculatorApp.ch16-calculator-phase #ch16BodyPartNav {
    display: none !important;
}

#calculatorApp.ch16-calculator-phase .calculators-container {
    margin-top: 8px;
}

button {
    display: block;
    width: 200px;
    margin: 20px auto;
    padding: 10px;
    background-color: #1E90FF;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #1873CC;
}

/* Bottom action rows: uniform button height (icon ::before slots were 18–23px). */
.ch16-both-first-actions button,
#ch8BothFirstActions button,
.calculators-final-actions button,
.options-actions button,
.ch16-body-part-actions button {
    box-sizing: border-box;
    height: 44px;
    line-height: 1;
}

.ch16-both-first-actions {
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.ch16-both-first-actions button {
    display: inline-block;
    width: 200px;
    margin: 0;
}

#ch16BothFirstActions #ch16CalculatorsStartOverFirst,
#ch16BothFirstActions #ch16CalculatorsGoBackFirst,
#ch16BothFirstActions #ch16BothFirstAddOns,
#ch16BothFirstActions #ch16ProceedToRight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

#ch16BothFirstActions #ch16CalculatorsStartOverFirst::before,
#ch16BothFirstActions #ch16CalculatorsGoBackFirst::before,
#ch16BothFirstActions #ch16BothFirstAddOns::before,
#ch16BothFirstActions #ch16ProceedToRight::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#ch16BothFirstActions #ch16CalculatorsStartOverFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

#ch16BothFirstActions #ch16CalculatorsGoBackFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

#ch16BothFirstActions #ch16BothFirstAddOns::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='6' cy='12' r='2.1'/%3E%3Ccircle cx='12' cy='12' r='2.1'/%3E%3Ccircle cx='18' cy='12' r='2.1'/%3E%3C/svg%3E");
}

#ch16BothFirstActions #ch16ProceedToRight::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

.calculators-final-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.calculators-final-actions button {
    display: inline-block;
    width: 200px;
    margin: 0;
}

.calculators-final-actions #ch16CalculatorsStartOverSecond,
.calculators-final-actions #ch16CalculatorsGoBackSecond,
.calculators-final-actions #painAddOn,
.calculators-final-actions #ch16AddBodyPart,
.calculators-final-actions #rateImpairment,
.calculators-final-actions #ch8CalculatorsStartOver,
.calculators-final-actions #ch8CalculatorsGoBack,
.calculators-final-actions #ch8AddBodyPart,
.calculators-final-actions #ch8PainAddOn,
.calculators-final-actions #ch8RateImpairment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.calculators-final-actions #ch16CalculatorsStartOverSecond::before,
.calculators-final-actions #ch16CalculatorsGoBackSecond::before,
.calculators-final-actions #painAddOn::before,
.calculators-final-actions #ch16AddBodyPart::before,
.calculators-final-actions #rateImpairment::before,
.calculators-final-actions #ch8CalculatorsStartOver::before,
.calculators-final-actions #ch8CalculatorsGoBack::before,
.calculators-final-actions #ch8AddBodyPart::before,
.calculators-final-actions #ch8PainAddOn::before,
.calculators-final-actions #ch8RateImpairment::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

.calculators-final-actions #ch16CalculatorsStartOverSecond::before,
.calculators-final-actions #ch8CalculatorsStartOver::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

.calculators-final-actions #ch16CalculatorsGoBackSecond::before,
.calculators-final-actions #ch8CalculatorsGoBack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
    position: relative;
    left: -8px;
    top: 2px;
}

.calculators-final-actions #ch16CalculatorsGoBackSecond .btn-label {
    display: inline-block;
    line-height: 1.1;
    position: relative;
    top: -2.5px;
}

.calculators-final-actions #painAddOn::before,
.calculators-final-actions #ch8PainAddOn::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='6' cy='12' r='2.1'/%3E%3Ccircle cx='12' cy='12' r='2.1'/%3E%3Ccircle cx='18' cy='12' r='2.1'/%3E%3C/svg%3E");
}

.calculators-final-actions #ch16AddBodyPart::before,
.calculators-final-actions #ch8AddBodyPart::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.8' cy='8' r='3.2'/%3E%3Cpath d='M3.6 18.2c0-2.9 2.3-5.2 5.2-5.2s5.2 2.3 5.2 5.2'/%3E%3Cpath d='M19.2 11.2v7.2'/%3E%3Cpath d='M15.8 14.8h6.4'/%3E%3C/svg%3E");
    position: relative;
    left: -2px;
}

.calculators-final-actions #rateImpairment::before,
.calculators-final-actions #ch8RateImpairment::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3.5' width='16' height='17' rx='2' ry='2'/%3E%3Cline x1='8' y1='8' x2='16' y2='8'/%3E%3Cline x1='8' y1='12' x2='11' y2='12'/%3E%3Cline x1='13' y1='12' x2='16' y2='12'/%3E%3Cline x1='10' y1='16' x2='14' y2='16'/%3E%3C/svg%3E");
}

#ch16CalculatorsGoBackSecond {
    display: none;
}

/* Existing styles remain the same */

.options-container, .calculators-container {
    margin-top: 16px;
}

#optionsList,
#ch8DisorderOptionsList {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ch8-disorder-selection-wrap {
    margin-top: 16px;
}

#ch8DisorderSelectionMessage {
    margin-top: 12px;
    text-align: center;
    min-height: 20px;
}

.options-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.options-actions button {
    display: inline-block;
    width: 200px;
    margin: 0;
}

.options-actions #optionsStartOver,
.options-actions #optionsGoBack,
.options-actions #nextCard,
#ch8DisorderNav #ch8DisorderStartOver,
#ch8DisorderNav #ch8DisorderGoBack,
#ch8DisorderNav #ch8DisorderProceed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.options-actions #optionsStartOver::before,
.options-actions #optionsGoBack::before,
.options-actions #nextCard::after,
#ch8DisorderNav #ch8DisorderStartOver::before,
#ch8DisorderNav #ch8DisorderGoBack::before,
#ch8DisorderNav #ch8DisorderProceed::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

.options-actions #optionsStartOver::before,
#ch8DisorderNav #ch8DisorderStartOver::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

.options-actions #optionsGoBack::before,
#ch8DisorderNav #ch8DisorderGoBack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

.options-actions #nextCard::after,
#ch8DisorderNav #ch8DisorderProceed::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

/* Ch. 16 body-part grid: Go Back + Next (same treatment as .options-actions) */
.ch16-body-part-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.ch16-body-part-actions button {
    display: inline-block;
    width: 200px;
    margin: 0;
}

#ch16BodyPartNav #ch16BodyPartsStartOver,
#ch16BodyPartNav #ch16BodyPartsGoBack,
#ch16BodyPartNav #calculate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

#ch16BodyPartNav #ch16BodyPartsStartOver::before,
#ch16BodyPartNav #ch16BodyPartsGoBack::before,
#ch16BodyPartNav #calculate::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#ch16BodyPartNav #ch16BodyPartsStartOver::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

#ch16BodyPartNav #ch16BodyPartsGoBack::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

#ch16BodyPartNav #calculate::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

.option {
    background-color: #f0f0f0;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#optionsList .option-disabled {
    grid-column: 1 / -1;
}

.option:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    color: #0f3f75;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
}

.option-disabled {
    cursor: default;
    background-color: #f5f5f5;
    color: #777;
    border: 1px solid #ddd;
    display: block;
    text-align: left;
    /* keep same box model as normal .option so height matches */
}

.option.option-disabled:hover {
    background-color: #f5f5f5;
    border-color: #ddd;
    color: #777;
    box-shadow: none;
}

.options-go-back-btn {
    position: relative;
    float: right;
    margin-top: -1px; /* nudge up ~1px to center vertically */
    margin-left: 8px;
    padding: 4px 6px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    background-color: #1E90FF;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    width: 80px; /* make button visibly about half the previous width */
}

.options-go-back-btn:hover {
    background-color: #1873CC;
}

.option.selected {
    background-color: #1E90FF;
    color: white;
}

.option.option-locked-selected {
    background-color: #6c8fb4;
    color: #fff;
    cursor: not-allowed;
}

.option.option-locked-selected:hover {
    background-color: #6c8fb4;
}

.calculator-card {
    background-color: #f9f9f9;
    border: 1px solid #9ccaff;
    border-radius: 5px;
    /* Bottom inset below last content; nerve/vascular cards keep 20px */
    --ch16-card-pad-bottom: 16px;
    padding: 20px 20px var(--ch16-card-pad-bottom) 20px;
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: visible;
}

/* Needed for top tooltips: overflow-x:auto forces y-clipping in browsers */
.calculator-card.ch16-controls-card {
    overflow: visible;
}

.calculator-card:has(#other-nerves-total),
.calculator-card:has(#spinal-total),
.calculator-card:has(#brachial-total),
.calculator-card:has(#pv-total),
.calculator-card.overall-total {
    --ch16-card-pad-bottom: 20px;
}

/* Digit sensory calculators: no internal scrollbars needed */
.fingers-calculator-card {
    overflow-x: visible;
    overflow-y: visible;
}

.calculator-card h3 {
    margin-top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* GAF Psychiatric studio header — same shell as Ch. 16 UE header */
.gaf-psych-header-card .gaf-psych-header-badge {
    flex-direction: row;
    justify-content: center;
}

.gaf-psych-header-badge-text {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.6px;
}

body.ama-pdf-open .gaf-psych-header-card .ch16-header-chapter {
    display: none;
}

.gaf-psych-header-card .ch16-header-title {
    transform: translateX(-97px);
}

.gaf-calculator-wrap {
    margin-bottom: 20px;
}

.gaf-calculator-wrap .gaf-psych-header-card {
    margin-bottom: 14px;
}

.gaf-calculators-list {
    max-width: none;
    margin: 0 0 16px;
}

.gaf-overall-total-card.hidden {
    display: none;
}

.gaf-overall-total-card:not(.hidden) {
    margin-bottom: 20px;
}

.ch8-skin-calculator-wrap {
    margin-bottom: 20px;
}

.ch8-skin-calculator-wrap .ch8-skin-header-card {
    margin-bottom: 14px;
}

.ch8-skin-header-card .ch16-header-title {
    transform: translateX(-126px);
}

.ch8-calculators-list {
    max-width: none;
    margin: 0 0 16px;
}

.ch8-overall-total-card.hidden {
    display: none;
}

.ch8-overall-total-card:not(.hidden) {
    margin-bottom: 20px;
}

.gaf-psych-card .gaf-psych-instructions {
    margin: 12px 0 17px;
    font-weight: normal;
}

.gaf-psych-score-table {
    max-width: 420px;
}

#gafPsychCard .gaf-psych-score-table thead th,
#gafPsychCard .gaf-psych-score-table thead th:first-child {
    text-align: center !important;
}

#gafPsychCard .gaf-psych-score-table tbody td {
    text-align: center;
}

#gafPsychCard .gaf-psych-score-table input[type="number"] {
    width: 48%;
    min-width: 0;
    padding: 5px;
    box-sizing: border-box;
    text-align: center;
}

.gaf-description-box {
    margin-top: 21px;
    min-height: 88px;
    padding: 12px 14px;
    border: 1px solid #111;
    border-radius: 4px;
    background: #f3f3f3;
    line-height: 1.45;
    white-space: pre-wrap;
}

.gaf-psych-card.is-minimized .gaf-psych-instructions,
.gaf-psych-card.is-minimized .gaf-psych-score-table,
.gaf-psych-card.is-minimized .gaf-description-box,
.gaf-psych-card.is-minimized .gaf-psych-reference,
.gaf-psych-card.is-minimized .gaf-psych-total {
    display: none;
}

.gaf-psych-card h3.ch16-card-header {
    transform: translateY(-3px);
}

.gaf-psych-reference {
    margin: 19px 0 8px;
    font-size: 0.95rem;
}

.gaf-psych-reference a.ama-pdf-link {
    color: #2563eb;
    text-decoration: underline;
}

.gaf-psych-total {
    margin: 0;
}

/* GAF psyche nav — same button styling/icons as Ch.16 UE calculator rows */
#gafBothFirstActions {
    display: none;
}

#gafBothFirstActions #gafCalculatorsStartOverFirst,
#gafBothFirstActions #gafCalculatorsGoBackFirst,
#gafBothFirstActions #gafBothFirstAddBodyPart,
#gafBothFirstActions #gafBothFirstAddOns,
#gafBothFirstActions #gafProceedToRight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

#gafBothFirstActions #gafCalculatorsStartOverFirst::before,
#gafBothFirstActions #gafCalculatorsGoBackFirst::before,
#gafBothFirstActions #gafBothFirstAddBodyPart::before,
#gafBothFirstActions #gafBothFirstAddOns::before,
#gafBothFirstActions #gafProceedToRight::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#gafBothFirstActions #gafCalculatorsStartOverFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

#gafBothFirstActions #gafCalculatorsGoBackFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

#gafBothFirstActions #gafBothFirstAddBodyPart::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.8' cy='8' r='3.2'/%3E%3Cpath d='M3.6 18.2c0-2.9 2.3-5.2 5.2-5.2s5.2 2.3 5.2 5.2'/%3E%3Cpath d='M19.2 11.2v7.2'/%3E%3Cpath d='M15.8 14.8h6.4'/%3E%3C/svg%3E");
    position: relative;
    left: -2px;
}

#gafBothFirstActions #gafBothFirstAddOns::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='6' cy='12' r='2.1'/%3E%3Ccircle cx='12' cy='12' r='2.1'/%3E%3Ccircle cx='18' cy='12' r='2.1'/%3E%3C/svg%3E");
}

#gafBothFirstActions #gafProceedToRight::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

/* Ch. 8 skin nav — Next when psyche and/or UE follow (same pattern as GAF → UE) */
#ch8BothFirstActions {
    display: none;
}

#ch8BothFirstActions #ch8CalculatorsStartOverFirst,
#ch8BothFirstActions #ch8CalculatorsGoBackFirst,
#ch8BothFirstActions #ch8BothFirstAddBodyPart,
#ch8BothFirstActions #ch8BothFirstAddOns,
#ch8BothFirstActions #ch8ProceedToNextChapter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

#ch8BothFirstActions #ch8CalculatorsStartOverFirst::before,
#ch8BothFirstActions #ch8CalculatorsGoBackFirst::before,
#ch8BothFirstActions #ch8BothFirstAddBodyPart::before,
#ch8BothFirstActions #ch8BothFirstAddOns::before,
#ch8BothFirstActions #ch8ProceedToNextChapter::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#ch8BothFirstActions #ch8CalculatorsStartOverFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

#ch8BothFirstActions #ch8CalculatorsGoBackFirst::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
}

#ch8BothFirstActions #ch8BothFirstAddBodyPart::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.8' cy='8' r='3.2'/%3E%3Cpath d='M3.6 18.2c0-2.9 2.3-5.2 5.2-5.2s5.2 2.3 5.2 5.2'/%3E%3Cpath d='M19.2 11.2v7.2'/%3E%3Cpath d='M15.8 14.8h6.4'/%3E%3C/svg%3E");
    position: relative;
    left: -2px;
}

#ch8BothFirstActions #ch8BothFirstAddOns::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='6' cy='12' r='2.1'/%3E%3Ccircle cx='12' cy='12' r='2.1'/%3E%3Ccircle cx='18' cy='12' r='2.1'/%3E%3C/svg%3E");
}

#ch8BothFirstActions #ch8ProceedToNextChapter::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 5.5L15.5 12 8 18.5'/%3E%3C/svg%3E");
}

#gafFinalActions #gafCalculatorsStartOverSecond,
#gafFinalActions #gafCalculatorsGoBackSecond,
#gafFinalActions #gafPainAddOn,
#gafFinalActions #gafAddBodyPart,
#gafFinalActions #gafRateImpairment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

#gafFinalActions #gafCalculatorsStartOverSecond::before,
#gafFinalActions #gafCalculatorsGoBackSecond::before,
#gafFinalActions #gafPainAddOn::before,
#gafFinalActions #gafAddBodyPart::before,
#gafFinalActions #gafRateImpairment::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.98;
    flex-shrink: 0;
}

#gafFinalActions #gafCalculatorsStartOverSecond::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M17.65 6.35A7.95 7.95 0 0 0 12 4C7.58 4 4.01 7.58 4.01 12S7.58 20 12 20c3.73 0 6.84-2.55 7.73-6h-2.08A5.98 5.98 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z'/%3E%3C/svg%3E");
}

#gafFinalActions #gafCalculatorsGoBackSecond::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5.5L8.5 12 16 18.5'/%3E%3C/svg%3E");
    position: relative;
    left: -8px;
    top: 2px;
}

#gafFinalActions #gafCalculatorsGoBackSecond .btn-label {
    display: inline-block;
    line-height: 1.1;
    position: relative;
    top: 1px;
}

#gafFinalActions #gafPainAddOn::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Ccircle cx='6' cy='12' r='2.1'/%3E%3Ccircle cx='12' cy='12' r='2.1'/%3E%3Ccircle cx='18' cy='12' r='2.1'/%3E%3C/svg%3E");
}

#gafFinalActions #gafAddBodyPart::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.8' cy='8' r='3.2'/%3E%3Cpath d='M3.6 18.2c0-2.9 2.3-5.2 5.2-5.2s5.2 2.3 5.2 5.2'/%3E%3Cpath d='M19.2 11.2v7.2'/%3E%3Cpath d='M15.8 14.8h6.4'/%3E%3C/svg%3E");
    position: relative;
    left: -2px;
}

#gafFinalActions #gafRateImpairment::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3.5' width='16' height='17' rx='2' ry='2'/%3E%3Cline x1='8' y1='8' x2='16' y2='8'/%3E%3Cline x1='8' y1='12' x2='11' y2='12'/%3E%3Cline x1='13' y1='12' x2='16' y2='12'/%3E%3Cline x1='10' y1='16' x2='14' y2='16'/%3E%3C/svg%3E");
}

.ime-proceed-go-back-dialog .ama-pdf-link {
    color: #2563eb;
    text-decoration: underline;
}

.ch16-card-header {
    position: relative;
    display: block;
    text-align: center;
    margin: 0;
}

.ch16-card-title {
    display: inline;
    line-height: inherit;
}

.ch16-card-title.ch16-pdf-open-two-line-title {
    display: inline-block;
    white-space: pre-line;
    text-align: center;
    line-height: 1.45;
}

.ch16-card-minimized-summary {
    display: block;
    margin-top: 6px;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.ch16-card-minimized-summary-line + .ch16-card-minimized-summary-line {
    margin-top: 2px;
}

.ch16-card-minimized-summary-line--used-crps {
    color: #999;
}

.ch16-card-controls {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(calc(-50% - 5px));
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ch16-card-control-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: #000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0;
}

.ch16-card-control-btn:hover {
    opacity: 0.7;
}

.ch16-card-control-btn[data-tooltip] {
    position: relative;
}

.ch16-card-control-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.88);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.12s ease;
}

.ch16-card-control-btn[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 3px);
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.88);
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.12s ease;
}

.ch16-card-control-btn[data-tooltip]:hover::after,
.ch16-card-control-btn[data-tooltip]:hover::before,
.ch16-card-control-btn[data-tooltip]:focus-visible::after,
.ch16-card-control-btn[data-tooltip]:focus-visible::before {
    opacity: 1;
}

.ch16-card-control-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    overflow: visible;
}

.ch16-total-card-add-method-btn svg {
    width: 22px;
    height: 22px;
}

/* Body-part Total Impairment cards should not show horizontal scrollbars. */
.calculator-card:has([id^="totalImpairment-"]) {
    overflow: visible;
}

/* Keep Total Impairment lines wrapping so no horizontal scrollbar is needed. */
.calculator-card:has([id^="totalImpairment-"]) [id^="totalImpairment-"] p,
.calculator-card:has([id^="totalImpairment-"]) [id^="totalImpairment-"] strong,
.calculator-card:has([id^="totalImpairment-"]) [id^="totalImpairment-"] span {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ch16-add-method-modal {
    width: min(440px, calc(100vw - 28px));
}

.ch16-add-method-instruction {
    display: block;
    margin-top: 6px;
    margin-bottom: 0;
    padding-bottom: 14px;
}

.ch16-add-method-list {
    margin-top: 0;
    padding-top: 8px;
    max-height: 320px;
    overflow: auto;
    /* Keep row borders/labels clear of the scrollbar track. */
    padding-right: 14px;
    box-sizing: content-box;
}

/* Keep the Add Method (digit) modal fully visible in shorter browser heights. */
.ch16-add-digit-method-modal {
    top: 16px;
    transform: translateX(-50%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-top: 18px;
    padding-bottom: 18px;
}

.ch16-add-digit-method-modal .ch16-add-method-list {
    max-height: 240px;
}

.ch16-add-method-option {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #9ccaff;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease;
    box-sizing: border-box;
}

.ch16-add-method-option:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    color: #0f3f75;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
}

.ch16-add-method-option:first-child {
    margin-top: 6px;
}

.ch16-add-method-option input[type="checkbox"] {
    margin: 0;
}

.ch16-add-method-option-note {
    margin-left: auto;
    font-size: 12px;
    color: #888;
}

.ch16-add-method-option.is-disabled {
    color: #888;
    background: #f3f3f3;
    cursor: not-allowed;
    border-color: #ddd;
}

.ch16-add-method-option.is-disabled:hover {
    background: #f3f3f3;
    border-color: #ddd;
}

.ch16-add-method-actions {
    margin-top: 14px;
}

.ch16-add-method-actions .ch16-add-method-cancel,
.ch16-add-method-actions .ch16-add-method-confirm,
.ch16-add-method-actions .ch16-add-digit-method-cancel,
.ch16-add-method-actions .ch16-add-digit-method-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ch16-add-method-actions .ch16-add-method-btn-icon {
    display: block;
    flex: 0 0 auto;
}

.ch16-add-method-actions .ch16-add-digit-cancel,
.ch16-add-method-actions .ch16-add-digit-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.ch16-add-method-actions .ch16-add-method-cancel > span,
.ch16-add-method-actions .ch16-add-method-confirm > span,
.ch16-add-method-actions .ch16-add-digit-method-cancel > span,
.ch16-add-method-actions .ch16-add-digit-method-confirm > span {
    position: relative;
    top: 1px;
}

.calculator-card h3.ch16-card-header {
    margin-top: 0;
    margin-bottom: 0;
    padding-bottom: 8px;
}

/* Give a bit more space under headers for arthroplasty + shoulder instability cards */
.calculator-card:has([id$="-arthroplasty-total"]) h3.ch16-card-header,
.calculator-card:has(#shoulder-instability-total) h3.ch16-card-header {
    padding-bottom: 19px;
}

.calculator-card:has([id$="-arthroplasty-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has(#shoulder-instability-total) h3.ch16-card-header .ch16-card-controls {
    top: calc(50% - 5px);
}

/* Synovial cards need slightly tighter spacing under the header than default */
.calculator-card:has([id$="-synovial-hypertrophy-total"]) h3.ch16-card-header {
    padding-bottom: 1px;
}

.calculator-card:has([id$="-synovial-hypertrophy-total"]) h3.ch16-card-header .ch16-card-controls {
    transform: translateY(calc(-50% - 0px));
}

/* Match synovial header/icon spacing for instability variants requested */
.calculator-card:has([id$="-subluxation-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-passive-instability-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-active-deviation-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-carpal-instability-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-constrictive-tenosynovitis-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-rotational-deformity-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-lateral-deviation-total"]) h3.ch16-card-header,
.calculator-card:has([id$="-intrinsic-tightness-total"]) h3.ch16-card-header,
.calculator-card:has(#other-nerves-total) h3.ch16-card-header,
.calculator-card:has(#spinal-total) h3.ch16-card-header,
.calculator-card:has(#brachial-total) h3.ch16-card-header {
    padding-bottom: 1px;
}

/* Nerve entry tables need a larger visual gap under header */
.calculator-card:has(#other-nerves-total) h3.ch16-card-header,
.calculator-card:has(#spinal-total) h3.ch16-card-header,
.calculator-card:has(#brachial-total) h3.ch16-card-header,
.calculator-card:has(#pv-total) h3.ch16-card-header {
    padding-bottom: 19px;
}

.calculator-card:has(#other-nerves-total) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has(#spinal-total) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has(#brachial-total) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has(#pv-total) h3.ch16-card-header .ch16-card-controls {
    transform: translateY(calc(-50% - 9px));
}

.calculator-card:has([id$="-subluxation-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-passive-instability-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-active-deviation-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-carpal-instability-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-constrictive-tenosynovitis-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-rotational-deformity-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-lateral-deviation-total"]) h3.ch16-card-header .ch16-card-controls,
.calculator-card:has([id$="-intrinsic-tightness-total"]) h3.ch16-card-header .ch16-card-controls {
    transform: translateY(calc(-50% - 0px));
}

/* Digit amputation cards: add space below title for image/slider without moving header icons */
.calculator-card:has([id$="-amputation-total"]) h3.ch16-card-header {
    padding-bottom: 20px;
}

.calculator-card:has([id$="-amputation-total"]) h3.ch16-card-header .ch16-card-controls {
    top: calc(50% - 6px);
}

/* Optical alignment: refresh glyph sits lower in its viewbox than the others */
.ch16-card-controls .ch16-card-control-btn:nth-child(1) svg {
    transform: scale(1.05);
    transform-origin: center;
}

.ch16-card-controls .ch16-card-control-btn:nth-child(2) svg {
    transform: translate(-2px, -3px);
}

.ch16-card-controls .ch16-card-control-btn:nth-child(3) svg {
    transform: scale(1.26);
    transform-origin: center;
}

/* Total impairment controls are Minimize | Add Method | Trash; keep Add Method icon centered. */
.ch16-total-card-add-controls .ch16-card-control-btn:nth-child(2) svg {
    transform: translateY(-1px);
}

/* Hand/Multiple Fingers total card uses Minimize | Add Digit | Trash. */
.ch16-total-card-hand-controls .ch16-card-control-btn:nth-child(2) svg {
    transform: translateY(-1px) scale(1);
    transform-origin: center;
}

.calculator-card.is-minimized {
    /* Single-line minimized cards: tighter bottom inset (multi-line PN uses .ch16-minimized-with-summary below). */
    padding-bottom: 11px;
}

/* Grip/Pinch single-line minimized cards render slightly taller; tighten only these two without affecting others. */
.calculator-card.is-minimized:has(#grip-strength-total-line),
.calculator-card.is-minimized:has(#pinch-strength-total-line) {
    padding-bottom: 0;
}

/* Arm amputation minimized card only: tighten bottom padding without changing other minimized cards. */
.calculator-card.is-minimized:has(#armWpiValue) {
    padding-bottom: 10px;
}

.calculator-card.is-minimized h3.ch16-card-header {
    padding-bottom: 1px !important;
}

.calculator-card.is-minimized h3.ch16-card-header .ch16-card-controls {
    top: 50% !important;
    /* Keep minimized closed-PDF position aligned with expanded closed-PDF cards. */
    transform: translateY(calc(-50% - 5px)) !important;
}

.calculator-card.is-minimized.ch16-minimized-with-summary {
    padding-bottom: 8px;
}

.calculator-card.is-minimized.ch16-minimized-with-summary h3.ch16-card-header {
    padding-bottom: 10px !important;
}

.calculator-card.is-minimized.ch16-minimized-with-summary h3.ch16-card-header .ch16-card-controls {
    transform: translateY(calc(-50% - 5px)) !important;
}

.calculator-card.ch16-total-card-minimized h3.ch16-card-header .ch16-card-controls {
    top: 50% !important;
    transform: translateY(calc(-50% - 5px)) !important;
}

/* Lock icon row by fixed top inset (no % centering), so expand/minimize toggles don't shift it. */
body:not(.ama-pdf-open) .calculator-card h3.ch16-card-header .ch16-card-controls {
    top: -20px !important;
    transform: none !important;
}

body.ama-pdf-open .calculator-card h3.ch16-card-header .ch16-card-controls {
    top: -20px !important;
    transform: none !important;
}

.calculator-card.is-minimized > :not(.ch16-card-header) {
    display: none !important;
}

/* Total impairment cards keep their header nested under #totalImpairment-*; hide only content when minimized. */
.calculator-card.ch16-total-card-minimized [id^="totalImpairment-"] > :not(.ch16-card-header) {
    display: none !important;
}

.calculator-card.ch16-total-card-minimized {
    padding-bottom: 11px;
}

.calculator-card.ch16-total-card-minimized h3.ch16-card-header {
    padding-bottom: 1px !important;
}

.rom-table, .strength-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.rom-table th, .rom-table td, .strength-table th, .strength-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.rom-table th, .strength-table .header-row th {
    background-color: #1E90FF;
    color: white;
}

.rom-table input[type="number"], .strength-table input[type="number"] {
    width: 60px;
    padding: 5px;
    text-align: center;
}

/* Almaraz calculator: reference column full width, text input left-aligned */
/* Almaraz calculator: reference column full width.
   Keep the generic left-alignment here, but override it for
   the standard ROM calculators (shoulder, elbow, wrist) below. */
.rom-table thead th:first-child,
.rom-table tbody td:first-child { text-align: left; }

.rom-table tbody td:first-child input[type="text"] {
    width: 100%;
    min-width: 200px;
    box-sizing: border-box;
    text-align: left;
}

/* Center the first-column labels (Angle° / Imp%) for
   shoulder, elbow, and wrist ROM calculators so they
   align visually with the rest of their columns. */
#shoulder-rom-simple .rom-table tbody td:first-child,
#shoulder-rom-contralateral .rom-table tbody td:first-child,
#elbow-rom-simple .rom-table tbody td:first-child,
#elbow-rom-contralateral .rom-table tbody td:first-child,
#wrist-rom-simple .rom-table tbody td:first-child,
#wrist-rom-contralateral .rom-table tbody td:first-child {
    text-align: center;
}

/* Thumb ROM: center joint labels and key text entries */
#thumb-rom-simple .rom-table td[rowspan="2"],
#thumb-rom-contralateral .rom-table td[rowspan="2"],
#thumb-rom-simple .rom-table td[rowspan="6"],
#thumb-rom-contralateral .rom-table td[rowspan="6"] {
    text-align: center;
    vertical-align: middle;
}

/* Center the Angle° / Imp% labels in the thumb ROM tables */
#thumb-rom-simple .rom-table tbody td.thumb-imp-label,
#thumb-rom-contralateral .rom-table tbody td.thumb-imp-label {
    text-align: center;
}

/* Digit ROM (index/middle/ring/little): center joint names and Imp% labels */
#index-rom-simple .rom-table td.digit-joint-label,
#middle-rom-simple .rom-table td.digit-joint-label,
#ring-rom-simple .rom-table td.digit-joint-label,
#little-rom-simple .rom-table td.digit-joint-label,
#index-rom-contralateral .rom-table td.digit-joint-label,
#middle-rom-contralateral .rom-table td.digit-joint-label,
#ring-rom-contralateral .rom-table td.digit-joint-label,
#little-rom-contralateral .rom-table td.digit-joint-label {
    text-align: center;
    vertical-align: middle;
}

#index-rom-simple .rom-table tbody td.digit-imp-label,
#middle-rom-simple .rom-table tbody td.digit-imp-label,
#ring-rom-simple .rom-table tbody td.digit-imp-label,
#little-rom-simple .rom-table tbody td.digit-imp-label,
#index-rom-contralateral .rom-table tbody td.digit-imp-label,
#middle-rom-contralateral .rom-table tbody td.digit-imp-label,
#ring-rom-contralateral .rom-table tbody td.digit-imp-label,
#little-rom-contralateral .rom-table tbody td.digit-imp-label {
    text-align: center;
}

.rom-table-contralateral .rom-subheader td {
    background-color: #e8eef5;
    font-size: 0.9em;
}

.rom-table-contralateral .rom-total-cell {
    background-color: #e0e0e0;
}

.rom-table-contralateral .rom-imp-output-cell {
    background-color: #e0e0e0;
}

.rom-table-contralateral input.rom-input-disabled,
.rom-table-contralateral input:disabled,
.rom-table input.rom-input-disabled,
.rom-table input:disabled {
    background-color: #e0e0e0;
    color: #888;
    cursor: not-allowed;
}

/* Thumb ROM CMC table: remove inner row lines between Radial/Adduction and Adduction/Opposition */
.thumb-rom-cmc-table tr:nth-child(4),
.thumb-rom-cmc-table tr:nth-child(6) {
    border-bottom: none;
}
.thumb-rom-cmc-table tr:nth-child(4) td,
.thumb-rom-cmc-table tr:nth-child(6) td {
    border-bottom: none;
}

.shoulder-rom-contralateral-option label {
    cursor: pointer;
    font-size: 0.95em;
}

.shoulder-rom-contralateral-option input[type="checkbox"],
.elbow-rom-contralateral-option input[type="checkbox"],
.wrist-rom-contralateral-option input[type="checkbox"],
.index-rom-contralateral-option input[type="checkbox"],
.middle-rom-contralateral-option input[type="checkbox"],
.ring-rom-contralateral-option input[type="checkbox"],
.little-rom-contralateral-option input[type="checkbox"],
.thumb-rom-contralateral-option input[type="checkbox"] {
    margin-right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    vertical-align: middle;
}

.elbow-rom-contralateral-option label,
.wrist-rom-contralateral-option label,
.index-rom-contralateral-option label,
.middle-rom-contralateral-option label,
.ring-rom-contralateral-option label,
.little-rom-contralateral-option label,
.thumb-rom-contralateral-option label {
    cursor: pointer;
    font-size: 0.95em;
}

.instructions, .reference, .key {
    margin-top: 20px;
    font-size: 0.9em;
}

.key p {
    margin: 5px 0;
}

.arthroplasty-options, .instability-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.arthroplasty-option, .instability-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #1E90FF;
    border-radius: 5px;
    transition: all 0.3s ease;
    background-color: white;
    margin-bottom: 10px;
}

.arthroplasty-option:hover, .instability-option:hover {
    background-color: #eaf4ff;
    border-color: #9ccaff;
    box-shadow: 0 3px 10px rgba(37, 150, 255, 0.16);
}

.arthroplasty-option label, .instability-option label {
    cursor: pointer;
    padding-left: 25px;
    position: relative;
    width: 100%;
    color: black;
    transition: color 0.3s ease;
}

.arthroplasty-option input[type="radio"]:checked + label,
.instability-option input[type="radio"]:checked + label {
    color: #1E90FF;
    font-weight: bold;
}

.arthroplasty-option label::before, .instability-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #1E90FF;
    border-radius: 50%;
    background-color: white;
}

.arthroplasty-option input[type="radio"]:checked + label::after,
.instability-option input[type="radio"]:checked + label::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #1E90FF;
    border-radius: 50%;
}

.arthroplasty-option input[type="radio"],
.instability-option input[type="radio"] {
    display: none;
}

.synovial-hypertrophy-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 15px;
}

.synovial-hypertrophy-table th,
.synovial-hypertrophy-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
}

.synovial-hypertrophy-table thead th {
    background-color: #1E90FF;
    color: white;
    font-weight: bold;
}

/* Thumb amputation joint-level exclusion visual state for non-ROM cards */
.synovial-hypertrophy-table tr.thumb-amputation-joint-disabled td {
    background-color: #f3f3f3;
    color: #8a8a8a;
}

.arthroplasty-option.thumb-amputation-joint-disabled {
    background: #f3f3f3;
    color: #8a8a8a;
    border-color: #d9d9d9;
}

/* Unified "Total: …" line at bottom of calculator cards (matches breakdown <p> totals) */
.total-impairment,
.fingers-total-impairment,
#total-imp {
    text-align: left;
    font-size: 1rem;
    line-height: 1.45;
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 0;
    color: #000000;
}

.total-impairment strong,
.fingers-total-impairment strong,
#total-imp strong {
    font-weight: 700;
}

.crps-result-item.total-impairment {
    text-align: left;
    font-size: 1rem;
    line-height: 1.45;
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 0;
    color: #000000;
}

.crps-result-item.total-impairment strong {
    font-weight: 700;
}

.overall-total h3 {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 25px;
}

.overall-total p {
    font-size: 1.1em;
    margin: 15px 0;
}

.ch16-running-totals-wrap {
    margin-top: 20px;
    margin-bottom: 4px;
}

.ch16-running-totals-card {
    margin-bottom: 16px;
    color: #4a4a4a;
}

.ch16-running-totals-card h3,
.ch16-running-totals-card p,
.ch16-running-totals-card strong {
    color: #4a4a4a;
}

.ch16-running-totals-card a {
    color: #1e90ff;
}

/* Update these styles for all checkbox types */
.synovial-checkbox,
.subluxation-checkbox,
.passive-instability-checkbox,
.active-deviation-checkbox,
.wrist-active-deviation-checkbox,
.carpal-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #1E90FF;  /* Blue border */
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
    background-color: white;
}

.synovial-checkbox:checked,
.subluxation-checkbox:checked,
.passive-instability-checkbox:checked,
.active-deviation-checkbox:checked,
.wrist-active-deviation-checkbox:checked,
.carpal-instability-checkbox:checked {
    background-color: #1E90FF;  /* Blue fill when checked */
}

.synovial-checkbox:checked::after,
.subluxation-checkbox:checked::after,
.passive-instability-checkbox:checked::after,
.active-deviation-checkbox:checked::after,
.wrist-active-deviation-checkbox:checked::after,
.carpal-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.synovial-checkbox:hover,
.subluxation-checkbox:hover,
.passive-instability-checkbox:hover,
.active-deviation-checkbox:hover,
.wrist-active-deviation-checkbox:hover,
.carpal-instability-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.synovial-checkbox:checked:hover,
.subluxation-checkbox:checked:hover,
.passive-instability-checkbox:checked:hover,
.active-deviation-checkbox:checked:hover,
.wrist-active-deviation-checkbox:checked:hover,
.carpal-instability-checkbox:checked:hover {
    background-color: #1E90FF;  /* Keep blue when checked and hovered */
}

/* Update the arthroplasty-option styles */
.arthroplasty-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #1E90FF;
    border-radius: 5px;
    transition: all 0.3s ease;
    background-color: white;
    margin-bottom: 10px;
}

.arthroplasty-option:hover {
    background-color: #F0F8FF;
}

.arthroplasty-option label {
    cursor: pointer;
    padding-left: 25px;
    position: relative;
    width: 100%;
    color: black;
    transition: color 0.3s ease;
}

/* Style for both radio and checkbox inputs */
.arthroplasty-option input[type="radio"],
.arthroplasty-option input[type="checkbox"] {
    display: none;
}

/* Style for both radio and checkbox labels */
.arthroplasty-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #1E90FF;
    border-radius: 50%;
    background-color: white;
}

/* Style for both checked radio and checkbox labels */
.arthroplasty-option input[type="radio"]:checked + label,
.arthroplasty-option input[type="checkbox"]:checked + label {
    color: #1E90FF;
    font-weight: bold;
}

/* Style for both checked radio and checkbox indicators */
.arthroplasty-option input[type="radio"]:checked + label::after,
.arthroplasty-option input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #1E90FF;
    border-radius: 50%;
}

/* Thumb ROM Calculator Styles */
#thumbCalculator {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

#thumbCalculator h3 {
    text-align: center;
    margin-bottom: 15px;
}

#thumbCalculator table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

#thumbCalculator th,
#thumbCalculator td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

#thumbCalculator .blue-header {
    background-color: #1E90FF;
    color: white;
}

#thumbCalculator .blue-cell {
    background-color: #1E90FF;
}

#thumbCalculator .grey-cell {
    background-color: #f0f0f0;
}

#thumbCalculator .joints {
    text-align: left;
    font-weight: bold;
}

#thumbCalculator .empty {
    background-color: #ffffff;
}

#thumbCalculator .no-bottom-border {
    border-bottom: none;
}

#thumbCalculator .vertical-center {
    vertical-align: middle;
}

#thumbCalculator input[type="number"] {
    width: 60px;
    padding: 4px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    -moz-appearance: textfield;
    appearance: textfield;
}

#thumbCalculator input[type="number"]:focus {
    outline: none;
    border-color: #1E90FF;
}

/* Remove spinner buttons from number inputs */
#thumbCalculator input[type="number"]::-webkit-inner-spin-button,
#thumbCalculator input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#thumbCalculator input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Add these styles for the thumb subluxation checkboxes */
.thumb-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.thumb-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Add these hover effects */
.thumb-subluxation-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.thumb-subluxation-checkbox:checked:hover {
    background-color: #2196F3;  /* Keep blue when checked and hovered */
}

/* Styles for the index finger subluxation checkboxes */
.index-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.index-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Hover effects for index subluxation checkboxes */
.index-subluxation-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.index-subluxation-checkbox:checked:hover {
    background-color: #2196F3;  /* Keep blue when checked and hovered */
}

/* Styles for the middle finger subluxation checkboxes */
.middle-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.middle-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Hover effects for middle subluxation checkboxes */
.middle-subluxation-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.middle-subluxation-checkbox:checked:hover {
    background-color: #2196F3;  /* Keep blue when checked and hovered */
}

/* Styles for the ring finger subluxation checkboxes */
.ring-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.ring-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Hover effects for ring subluxation checkboxes */
.ring-subluxation-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.ring-subluxation-checkbox:checked:hover {
    background-color: #2196F3;  /* Keep blue when checked and hovered */
}
  
/* Styles for the little finger subluxation checkboxes */
.little-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.little-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

/* Hover effects for little subluxation checkboxes */
.little-subluxation-checkbox:hover {
    background-color: #F0F8FF;  /* Light blue on hover */
}

.little-subluxation-checkbox:checked:hover {
    background-color: #2196F3;  /* Keep blue when checked and hovered */
}

/* Styles for shoulder synovial hypertrophy checkboxes */
.shoulder-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.shoulder-synovial-checkbox:checked {
    background-color: #2196F3;
}

.shoulder-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.shoulder-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.shoulder-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for elbow synovial hypertrophy checkboxes */
.elbow-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.elbow-synovial-checkbox:checked {
    background-color: #2196F3;
}

.elbow-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.elbow-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.elbow-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for wrist synovial hypertrophy checkboxes */
.wrist-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.wrist-synovial-checkbox:checked {
    background-color: #2196F3;
}

.wrist-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.wrist-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.wrist-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb synovial hypertrophy checkboxes */
.thumb-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-synovial-checkbox:checked {
    background-color: #2196F3;
}

.thumb-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Thumb total impairment — p. 499 add vs combine option row */
.thumb-p499-total-option-row {
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid #b3d9f2;
    border-radius: 8px;
    background: #f5fafd;
    font-size: 16px;
    line-height: 1.5;
    color: #1a237e;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 50px);
}

.thumb-p499-total-option-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

.thumb-p499-total-option-label {
    font-weight: 600;
    margin-right: 0;
    font-size: 17px;
    flex-shrink: 0;
}

.thumb-p499-total-option-text {
    flex: 0 1 auto;
    font-size: 17px;
}

/* Pull “Add…” ~one space closer to “Option:” (flex gap still separates from Yes/No) */
.thumb-p499-total-option-label + .thumb-p499-total-option-text {
    margin-left: -5px;
}

.thumb-p499-total-option-answers {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

/* Override global `button { width: 200px }` — p.499 Yes/No compact but readable */
.thumb-p499-toggle {
    display: inline-block;
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    margin: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cfd8dc;
    background: #fff;
    color: #1565c0;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.thumb-p499-toggle:hover {
    border-color: #90caf9;
    background: #fafafa;
}

.thumb-p499-toggle:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.thumb-p499-toggle--active {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 700;
}

.thumb-p499-toggle--active:hover {
    background: #d4e9fc;
    border-color: #1976d2;
}

.thumb-p499-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 0;
    border-radius: 50%;
    border: 2px solid #2196f3;
    background: #fff;
    color: #2196f3;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.thumb-p499-info-btn:hover {
    background: #e3f2fd;
}

.thumb-p499-modal-title {
    margin: 0 0 12px;
    font-size: 1.15rem;
    color: #0d47a1;
}

.thumb-p499-modal-body {
    margin-bottom: 8px;
}

.thumb-p499-modal-quote {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.55;
}

.thumb-p499-modal-prompt {
    margin: 0;
    font-weight: 600;
}

.thumb-p499-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}

.thumb-p499-modal-btn {
    min-width: 120px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    border: 2px solid #1976d2;
    background: #2196f3;
    color: #fff;
    cursor: pointer;
}

.thumb-p499-modal-btn:hover {
    background: #1976d2;
}

/* p. 499 ? info modal (no title — body spacing tuned for first-line start) */
.thumb-p499-info-modal {
    padding-top: 28px;
    padding-bottom: 27px;
}

.thumb-p499-info-modal-body {
    margin: 0 0 4px;
    padding: 0 4px 0 2px;
}

.thumb-p499-info-modal-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #000;
}

.thumb-p499-info-modal-message .ama-pdf-link {
    color: #1e40af;
}

.thumb-p499-info-modal-message .thumb-p499-info-only-bold {
    font-style: normal;
    font-weight: 700;
}

.thumb-p499-info-modal-actions {
    margin-top: 18px;
    padding-top: 0;
}

/* Override global `button { margin: 20px auto }` for this modal footer */
.thumb-p499-info-modal button.thumb-p499-info-ok {
    margin: 0 auto;
}

/* Index finger total impairment — p. 499 add vs combine (same layout as thumb) */
.index-p499-total-option-row {
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid #b3d9f2;
    border-radius: 8px;
    background: #f5fafd;
    font-size: 16px;
    line-height: 1.5;
    color: #1a237e;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 50px);
}

.index-p499-total-option-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

.index-p499-total-option-label {
    font-weight: 600;
    margin-right: 0;
    font-size: 17px;
    flex-shrink: 0;
}

.index-p499-total-option-text {
    flex: 0 1 auto;
    font-size: 17px;
}

.index-p499-total-option-label + .index-p499-total-option-text {
    margin-left: -5px;
}

.index-p499-total-option-answers {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.index-p499-toggle {
    display: inline-block;
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    margin: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cfd8dc;
    background: #fff;
    color: #1565c0;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.index-p499-toggle:hover {
    border-color: #90caf9;
    background: #fafafa;
}

.index-p499-toggle:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.index-p499-toggle--active {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 700;
}

.index-p499-toggle--active:hover {
    background: #d4e9fc;
    border-color: #1976d2;
}

.index-p499-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 0;
    border-radius: 50%;
    border: 2px solid #2196f3;
    background: #fff;
    color: #2196f3;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.index-p499-info-btn:hover {
    background: #e3f2fd;
}

.index-p499-info-modal {
    padding-top: 28px;
    padding-bottom: 27px;
}

.index-p499-info-modal-body {
    margin: 0 0 4px;
    padding: 0 4px 0 2px;
}

.index-p499-info-modal-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #000;
}

.index-p499-info-modal-message .ama-pdf-link {
    color: #1e40af;
}

.index-p499-info-modal-message .index-p499-info-only-bold {
    font-style: normal;
    font-weight: 700;
}

.index-p499-info-modal-actions {
    margin-top: 18px;
    padding-top: 0;
}

.index-p499-info-modal button.index-p499-info-ok {
    margin: 0 auto;
}

/* Middle finger total impairment — p. 499 add vs combine (same layout as index) */
.middle-p499-total-option-row {
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid #b3d9f2;
    border-radius: 8px;
    background: #f5fafd;
    font-size: 16px;
    line-height: 1.5;
    color: #1a237e;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 50px);
}

.middle-p499-total-option-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

.middle-p499-total-option-label {
    font-weight: 600;
    margin-right: 0;
    font-size: 17px;
    flex-shrink: 0;
}

.middle-p499-total-option-text {
    flex: 0 1 auto;
    font-size: 17px;
}

.middle-p499-total-option-label + .middle-p499-total-option-text {
    margin-left: -5px;
}

.middle-p499-total-option-answers {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.middle-p499-toggle {
    display: inline-block;
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    margin: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cfd8dc;
    background: #fff;
    color: #1565c0;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.middle-p499-toggle:hover {
    border-color: #90caf9;
    background: #fafafa;
}

.middle-p499-toggle:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.middle-p499-toggle--active {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 700;
}

.middle-p499-toggle--active:hover {
    background: #d4e9fc;
    border-color: #1976d2;
}

.middle-p499-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 0;
    border-radius: 50%;
    border: 2px solid #2196f3;
    background: #fff;
    color: #2196f3;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.middle-p499-info-btn:hover {
    background: #e3f2fd;
}

.middle-p499-info-modal {
    padding-top: 28px;
    padding-bottom: 27px;
}

.middle-p499-info-modal-body {
    margin: 0 0 4px;
    padding: 0 4px 0 2px;
}

.middle-p499-info-modal-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #000;
}

.middle-p499-info-modal-message .ama-pdf-link {
    color: #1e40af;
}

.middle-p499-info-modal-message .middle-p499-info-only-bold {
    font-style: normal;
    font-weight: 700;
}

.middle-p499-info-modal-actions {
    margin-top: 18px;
    padding-top: 0;
}

.middle-p499-info-modal button.middle-p499-info-ok {
    margin: 0 auto;
}

/* Ring finger total impairment — p. 499 add vs combine (same layout as index/middle) */
.ring-p499-total-option-row {
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid #b3d9f2;
    border-radius: 8px;
    background: #f5fafd;
    font-size: 16px;
    line-height: 1.5;
    color: #1a237e;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 50px);
}

.ring-p499-total-option-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

.ring-p499-total-option-label {
    font-weight: 600;
    margin-right: 0;
    font-size: 17px;
    flex-shrink: 0;
}

.ring-p499-total-option-text {
    flex: 0 1 auto;
    font-size: 17px;
}

.ring-p499-total-option-label + .ring-p499-total-option-text {
    margin-left: -5px;
}

.ring-p499-total-option-answers {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ring-p499-toggle {
    display: inline-block;
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    margin: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cfd8dc;
    background: #fff;
    color: #1565c0;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.ring-p499-toggle:hover {
    border-color: #90caf9;
    background: #fafafa;
}

.ring-p499-toggle:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.ring-p499-toggle--active {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 700;
}

.ring-p499-toggle--active:hover {
    background: #d4e9fc;
    border-color: #1976d2;
}

.ring-p499-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 0;
    border-radius: 50%;
    border: 2px solid #2196f3;
    background: #fff;
    color: #2196f3;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.ring-p499-info-btn:hover {
    background: #e3f2fd;
}

.ring-p499-info-modal {
    padding-top: 28px;
    padding-bottom: 27px;
}

.ring-p499-info-modal-body {
    margin: 0 0 4px;
    padding: 0 4px 0 2px;
}

.ring-p499-info-modal-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #000;
}

.ring-p499-info-modal-message .ama-pdf-link {
    color: #1e40af;
}

.ring-p499-info-modal-message .ring-p499-info-only-bold {
    font-style: normal;
    font-weight: 700;
}

.ring-p499-info-modal-actions {
    margin-top: 18px;
    padding-top: 0;
}

.ring-p499-info-modal button.ring-p499-info-ok {
    margin: 0 auto;
}

/* Little finger total impairment — p. 499 add vs combine (same layout as index/middle/ring) */
.little-p499-total-option-row {
    margin-top: 10px;
    padding: 0 16px;
    border: 1px solid #b3d9f2;
    border-radius: 8px;
    background: #f5fafd;
    font-size: 16px;
    line-height: 1.5;
    color: #1a237e;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 50px);
}

.little-p499-total-option-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

.little-p499-total-option-label {
    font-weight: 600;
    margin-right: 0;
    font-size: 17px;
    flex-shrink: 0;
}

.little-p499-total-option-text {
    flex: 0 1 auto;
    font-size: 17px;
}

.little-p499-total-option-label + .little-p499-total-option-text {
    margin-left: -5px;
}

.little-p499-total-option-answers {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.little-p499-toggle {
    display: inline-block;
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    margin: 0;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cfd8dc;
    background: #fff;
    color: #1565c0;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
}

.little-p499-toggle:hover {
    border-color: #90caf9;
    background: #fafafa;
}

.little-p499-toggle:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.little-p499-toggle--active {
    border-color: #2196f3;
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 700;
}

.little-p499-toggle--active:hover {
    background: #d4e9fc;
    border-color: #1976d2;
}

.little-p499-info-btn {
    width: 28px;
    height: 28px;
    margin-left: 0;
    border-radius: 50%;
    border: 2px solid #2196f3;
    background: #fff;
    color: #2196f3;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.little-p499-info-btn:hover {
    background: #e3f2fd;
}

.little-p499-info-modal {
    padding-top: 28px;
    padding-bottom: 27px;
}

.little-p499-info-modal-body {
    margin: 0 0 4px;
    padding: 0 4px 0 2px;
}

.little-p499-info-modal-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #000;
}

.little-p499-info-modal-message .ama-pdf-link {
    color: #1e40af;
}

.little-p499-info-modal-message .little-p499-info-only-bold {
    font-style: normal;
    font-weight: 700;
}

.little-p499-info-modal-actions {
    margin-top: 18px;
    padding-top: 0;
}

.little-p499-info-modal button.little-p499-info-ok {
    margin: 0 auto;
}

/* Styles for index synovial hypertrophy checkboxes */
.index-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-synovial-checkbox:checked {
    background-color: #2196F3;
}

.index-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.index-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle synovial hypertrophy checkboxes */
.middle-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-synovial-checkbox:checked {
    background-color: #2196F3;
}

.middle-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring synovial hypertrophy checkboxes */
.ring-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-synovial-checkbox:checked {
    background-color: #2196F3;
}

.ring-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little synovial hypertrophy checkboxes */
.little-synovial-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-synovial-checkbox:checked {
    background-color: #2196F3;
}

.little-synovial-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-synovial-checkbox:hover {
    background-color: #F0F8FF;
}

.little-synovial-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb excessive passive mediolateral instability checkboxes */
.thumb-passive-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-passive-instability-checkbox:checked {
    background-color: #2196F3;
}

.thumb-passive-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-passive-instability-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-passive-instability-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index excessive passive mediolateral instability checkboxes */
.index-passive-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-passive-instability-checkbox:checked {
    background-color: #2196F3;
}

.index-passive-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-passive-instability-checkbox:hover {
    background-color: #F0F8FF;
}

.index-passive-instability-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle excessive passive mediolateral instability checkboxes */
.middle-passive-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-passive-instability-checkbox:checked {
    background-color: #2196F3;
}

.middle-passive-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-passive-instability-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-passive-instability-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring excessive passive mediolateral instability checkboxes */
.ring-passive-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-passive-instability-checkbox:checked {
    background-color: #2196F3;
}

.ring-passive-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-passive-instability-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-passive-instability-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little excessive passive mediolateral instability checkboxes */
.little-passive-instability-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-passive-instability-checkbox:checked {
    background-color: #2196F3;
}

.little-passive-instability-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-passive-instability-checkbox:hover {
    background-color: #F0F8FF;
}

.little-passive-instability-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb constrictive tenosynovitis checkboxes */
.thumb-constrictive-tenosynovitis-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-constrictive-tenosynovitis-checkbox:checked {
    background-color: #2196F3;
}

.thumb-constrictive-tenosynovitis-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-constrictive-tenosynovitis-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-constrictive-tenosynovitis-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index constrictive tenosynovitis checkboxes */
.index-constrictive-tenosynovitis-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-constrictive-tenosynovitis-checkbox:checked {
    background-color: #2196F3;
}

.index-constrictive-tenosynovitis-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-constrictive-tenosynovitis-checkbox:hover {
    background-color: #F0F8FF;
}

.index-constrictive-tenosynovitis-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle constrictive tenosynovitis checkboxes */
.middle-constrictive-tenosynovitis-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-constrictive-tenosynovitis-checkbox:checked {
    background-color: #2196F3;
}

.middle-constrictive-tenosynovitis-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-constrictive-tenosynovitis-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-constrictive-tenosynovitis-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring constrictive tenosynovitis checkboxes */
.ring-constrictive-tenosynovitis-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-constrictive-tenosynovitis-checkbox:checked {
    background-color: #2196F3;
}

.ring-constrictive-tenosynovitis-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-constrictive-tenosynovitis-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-constrictive-tenosynovitis-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little constrictive tenosynovitis checkboxes */
.little-constrictive-tenosynovitis-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-constrictive-tenosynovitis-checkbox:checked {
    background-color: #2196F3;
}

.little-constrictive-tenosynovitis-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-constrictive-tenosynovitis-checkbox:hover {
    background-color: #F0F8FF;
}

.little-constrictive-tenosynovitis-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb rotational deformity checkboxes */
.thumb-rotational-deformity-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-rotational-deformity-checkbox:checked {
    background-color: #2196F3;
}

.thumb-rotational-deformity-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-rotational-deformity-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-rotational-deformity-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index rotational deformity checkboxes */
.index-rotational-deformity-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-rotational-deformity-checkbox:checked {
    background-color: #2196F3;
}

.index-rotational-deformity-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-rotational-deformity-checkbox:hover {
    background-color: #F0F8FF;
}

.index-rotational-deformity-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle rotational deformity checkboxes */
.middle-rotational-deformity-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-rotational-deformity-checkbox:checked {
    background-color: #2196F3;
}

.middle-rotational-deformity-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-rotational-deformity-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-rotational-deformity-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring rotational deformity checkboxes */
.ring-rotational-deformity-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-rotational-deformity-checkbox:checked {
    background-color: #2196F3;
}

.ring-rotational-deformity-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-rotational-deformity-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-rotational-deformity-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little rotational deformity checkboxes */
.little-rotational-deformity-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-rotational-deformity-checkbox:checked {
    background-color: #2196F3;
}

.little-rotational-deformity-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-rotational-deformity-checkbox:hover {
    background-color: #F0F8FF;
}

.little-rotational-deformity-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb lateral deviation checkboxes */
.thumb-lateral-deviation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-lateral-deviation-checkbox:checked {
    background-color: #2196F3;
}

.thumb-lateral-deviation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-lateral-deviation-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-lateral-deviation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index lateral deviation checkboxes */
.index-lateral-deviation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-lateral-deviation-checkbox:checked {
    background-color: #2196F3;
}

.index-lateral-deviation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-lateral-deviation-checkbox:hover {
    background-color: #F0F8FF;
}

.index-lateral-deviation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle lateral deviation checkboxes */
.middle-lateral-deviation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-lateral-deviation-checkbox:checked {
    background-color: #2196F3;
}

.middle-lateral-deviation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-lateral-deviation-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-lateral-deviation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring lateral deviation checkboxes */
.ring-lateral-deviation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-lateral-deviation-checkbox:checked {
    background-color: #2196F3;
}

.ring-lateral-deviation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-lateral-deviation-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-lateral-deviation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little lateral deviation checkboxes */
.little-lateral-deviation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-lateral-deviation-checkbox:checked {
    background-color: #2196F3;
}

.little-lateral-deviation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-lateral-deviation-checkbox:hover {
    background-color: #F0F8FF;
}

.little-lateral-deviation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb intrinsic tightness checkboxes */
.thumb-intrinsic-tightness-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-intrinsic-tightness-checkbox:checked {
    background-color: #2196F3;
}

.thumb-intrinsic-tightness-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-intrinsic-tightness-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-intrinsic-tightness-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index intrinsic tightness checkboxes */
.index-intrinsic-tightness-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-intrinsic-tightness-checkbox:checked {
    background-color: #2196F3;
}

.index-intrinsic-tightness-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-intrinsic-tightness-checkbox:hover {
    background-color: #F0F8FF;
}

.index-intrinsic-tightness-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle intrinsic tightness checkboxes */
.middle-intrinsic-tightness-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-intrinsic-tightness-checkbox:checked {
    background-color: #2196F3;
}

.middle-intrinsic-tightness-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-intrinsic-tightness-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-intrinsic-tightness-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring intrinsic tightness checkboxes */
.ring-intrinsic-tightness-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-intrinsic-tightness-checkbox:checked {
    background-color: #2196F3;
}

.ring-intrinsic-tightness-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-intrinsic-tightness-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-intrinsic-tightness-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little intrinsic tightness checkboxes */
.little-intrinsic-tightness-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-intrinsic-tightness-checkbox:checked {
    background-color: #2196F3;
}

.little-intrinsic-tightness-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-intrinsic-tightness-checkbox:hover {
    background-color: #F0F8FF;
}

.little-intrinsic-tightness-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for thumb extensor tendon subluxation checkboxes */
.thumb-extensor-tendon-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.thumb-extensor-tendon-subluxation-checkbox {
    background-color: #2196F3;
}

.thumb-extensor-tendon-subluxation-checkbox::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.thumb-extensor-tendon-subluxation-checkbox:hover {
    background-color: #F0F8FF;
}

.thumb-extensor-tendon-subluxation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for index extensor tendon subluxation checkboxes */
.index-extensor-tendon-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.index-extensor-tendon-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.index-extensor-tendon-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.index-extensor-tendon-subluxation-checkbox:hover {
    background-color: #F0F8FF;
}

.index-extensor-tendon-subluxation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for middle extensor tendon subluxation checkboxes */
.middle-extensor-tendon-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.middle-extensor-tendon-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.middle-extensor-tendon-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.middle-extensor-tendon-subluxation-checkbox:hover {
    background-color: #F0F8FF;
}

.middle-extensor-tendon-subluxation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for ring extensor tendon subluxation checkboxes */
.ring-extensor-tendon-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.ring-extensor-tendon-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.ring-extensor-tendon-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.ring-extensor-tendon-subluxation-checkbox:hover {
    background-color: #F0F8FF;
}

.ring-extensor-tendon-subluxation-checkbox:checked:hover {
    background-color: #2196F3;
}

/* Styles for little extensor tendon subluxation checkboxes */
.little-extensor-tendon-subluxation-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #2196F3;
    border-radius: 3px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 5px;
}

.little-extensor-tendon-subluxation-checkbox:checked {
    background-color: #2196F3;
}

.little-extensor-tendon-subluxation-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.little-extensor-tendon-subluxation-checkbox:hover {
    background-color: #F0F8FF;
}

.little-extensor-tendon-subluxation-checkbox:checked:hover {
    background-color: #2196F3;
}

  /* Styles for digit amputation calculators */
.finger-diagram {
    position: relative;
    width: 200px;
    height: 400px;
    margin: 0 auto;
}

.finger-diagram img {
    position: relative;
    height: 100%;
    width: auto;
    display: block;
    margin: 0 auto;
}

.slider-container {
    position: absolute;
    top: 0;
    left: -50px;
    height: 100%;
    width: 60px;
}

input[type="range"] {
    position: absolute;
    left: 20px;
    top: 85px;
    width: 350px;
    height: 20px;
    -webkit-appearance: none;
    background: transparent;
    transform-origin: left;
    transform: rotate(90deg) translateX(-150px);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -8px;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

/* Styles for Digit - Sensory calculators */
.fingers-distribution-selection,
.fingers-sensory-quality {
    margin-bottom: 20px;
}

.fingers-nerve-selection {
    margin: 10px 0;
}

.fingers-nerve-line {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 4px;
    margin-left: 40px;
}

.fingers-nerve-line .fingers-options-container {
    display: flex;
    margin-left: -20px;
    gap: 4px;
}

.fingers-nerve-label {
    min-width: 160px;
    margin-left: 3px;
}

.fingers-nerve-line label {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    position: relative;
    top: 3px;
}

.fingers-nerve-line input[type="checkbox"] {
    margin-right: 2px;
}

.fingers-finger-diagram {
    position: relative;
    width: 200px;
    height: 400px;
    margin: 0 auto;
}

.fingers-finger-diagram img {
    position: relative;
    height: 100%;
    width: auto;
    display: block;
    margin: 0 auto;
    left: -4.5px;
}

.fingers-slider-group {
    position: absolute;
    top: 0;
    height: calc(100% + 20px);
    width: 60px;
}

.fingers-slider-group.left {
    left: -211px;
    top: 192px;
}

.fingers-slider-group.right {
    right: 138px;
    top: 192px;
}

.fingers-highlight-area {
    position: absolute;
    width: 98px;
    background-color: rgba(82, 144, 238, 0.2);
    pointer-events: none;
    left: 180px;
    transform: translateY(-174px);
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
    border-radius: 0px;
    transition: opacity 0.2s ease;
}

.fingers-slider-group.left .fingers-highlight-area {
    left: 200px;
    transform: translateY(-174px) scaleX(-1) scaleY(1);
}

.fingers-slider-group.right .fingers-highlight-area {
    left: 105px;
    transform: translateY(-174px) scaleX(-1) scaleY(1);
}

input[type="range"].fingers-slider {
    position: absolute;
    width: 390px;
    height: 20px;
    -webkit-appearance: none;
    background: transparent;
    transform-origin: center;
    transform: rotate(90deg) translateY(15px) translateX(-86px);
    pointer-events: none;
}

.fingers-slider-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.fingers-slider-container:first-child {
    bottom: 0;
}

.fingers-slider-container:last-child {
    bottom: 0px;
}

input[type="range"].fingers-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -8px;
    pointer-events: auto;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

input[type="range"].fingers-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    pointer-events: none;
}

.fingers-slider-container:last-child .fingers-slider::-webkit-slider-runnable-track {
    background: transparent;
}

.fingers-digit-lengths {
    position: relative;
    width: 100%;
    height: 0;
    margin: 20px 0;
}

.fingers-digit-length-left, .fingers-digit-length-right {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    top: -200px;
}

.fingers-digit-length-left {
    left: 65px;
    text-align: right;
}

.fingers-digit-length-right {
    right: 75px;
    text-align: left;
}

.fingers-digit-length-input {
    width: 65px;
    height: 24px;
    border: 1px solid #3B90FF;
    border-radius: 4px;
    background-color: #EBF3FF;
    text-align: center;
    font-size: 14px;
    color: #333;
    -moz-appearance: textfield;
    padding-right: 8px;
}

.fingers-digit-length-input::-webkit-outer-spin-button,
.fingers-digit-length-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fingers-digit-length-wrapper {
    position: relative;
    display: inline-block;
}

.fingers-spinner-buttons {
    position: absolute;
    right: 1px;
    top: 1px;
    width: 14px;
    height: 25.6px; 
    display: none;
    flex-direction: column;
    background-color: #f0f0f0;
    border-radius: 0 3px 3px 0;
}

.fingers-digit-length-wrapper:hover .fingers-spinner-buttons {
    display: flex;
}

.fingers-spinner-up,
.fingers-spinner-down {
    height: 12.8px;
    width: 14px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fingers-spinner-up {
        border-radius: 0 3px 0 0;
}

.fingers-spinner-down {
    border-radius: 0 0 3px 0;
}

.fingers-spinner-up:hover,
.fingers-spinner-down:hover {
    background-color: #c7c7c7; /* Darker grey on hover */
}

.fingers-spinner-up::after,
.fingers-spinner-down::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    position: absolute;
}

.fingers-spinner-up::after {
    border-bottom: 4px solid #666;
    margin-top: 0;
}

.fingers-spinner-down::after {
    border-top: 4px solid #666;
    margin-top: 0;
}

.fingers-reference {
    font-size: 0.9em;
    color: #000000;
    margin: 20px 0;
}

/* Ensure full reference link text remains clickable. */
.fingers-reference .ama-pdf-link {
    display: inline-block;
    position: relative;
    z-index: 2;
}

/* Neuroma alternative options "Next" button */
.fingers-neuroma-option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 40px;
}

.fingers-neuroma-option label {
    display: flex !important;
    align-items: center;
    margin-left: 0 !important;
    margin-bottom: 0 !important;
}

.fingers-neuroma-next-button {
    display: inline-block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    width: auto;
    margin: 0;
    padding: 6px 10px;
    background-color: #1E90FF;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.fingers-neuroma-next-button.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.fingers-neuroma-next-button:hover {
    background-color: #1873CC;
}

/* Collapsible neuroma options (digit sensory cards) */
.fingers-neuroma-options-accordion {
    margin: 12px 0 16px 40px;
    /* Fixed width open/closed so the right border does not shift (room for option 2 + Next) */
    width: min(100%, calc(53.5rem + 2px));
    box-sizing: border-box;
    border: 1px solid #1e90ff;
    border-radius: 4px;
    overflow: hidden;
    /* Match header grey so no white sliver shows above bottom border when collapsed */
    background: #e8e8e8;
}

/* Thumb amputation card: about 1/3 shorter than the default accordion width */
.thumb-amputation-options-accordion {
    width: min(100%, calc(35.67rem + 2px));
    margin-top: 22px;
}

.thumb-amputation-card .total-impairment {
    margin-top: 16px;
}

.thumb-proximal-disabled {
    opacity: 0.55;
}

.arm-amputation-excluded-disabled {
    opacity: 0.55;
}

.synovial-hypertrophy-table tr.arm-amputation-joint-disabled td {
    background-color: #f3f3f3;
    color: #8a8a8a;
}

.arthroplasty-option.arm-amputation-joint-disabled {
    background: #f3f3f3;
    color: #8a8a8a;
    border-color: #d9d9d9;
}

.fingers-neuroma-options-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 0;
    /* Right padding insets chevron from card edge (matches panel inner for second-row Next) */
    padding: 6px 13px 6px 12px;
    border: none;
    background: #e8e8e8;
    font: inherit;
    font-weight: 600;
    color: #222;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.fingers-neuroma-options-toggle:hover {
    background: #dde8f4;
}

.fingers-neuroma-options-toggle:active {
    background: #d0dfef;
}

.fingers-neuroma-options-toggle:focus-visible {
    outline: 2px solid #1e90ff;
    outline-offset: 2px;
}

.fingers-neuroma-options-toggle-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: #1e90ff;
    border-radius: 4px;
    transition: transform 0.3s ease;
    /* ::after draws a down chevron; 90deg CW makes it point left when closed */
    transform: rotate(90deg);
}

.fingers-neuroma-options-accordion.is-open .fingers-neuroma-options-toggle-chevron {
    transform: rotate(0deg);
}

/* White caret: points down when open (parent 0deg); points left when closed (parent 90deg) */
.fingers-neuroma-options-toggle-chevron::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    margin-top: -2px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}

/* max-height collapse avoids grid 0fr subpixel gaps that showed white above the bottom border */
.fingers-neuroma-options-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.fingers-neuroma-options-accordion.is-open .fingers-neuroma-options-panel {
    max-height: 22rem;
}

.fingers-neuroma-options-panel-inner {
    overflow: hidden;
    min-height: 0;
    /* Left 12px with title; right matches toggle — second-row Next aligns under chevron */
    padding: 0 13px 5px 12px;
    background: #fff;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option {
    margin-left: 0;
    gap: 8px;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option label {
    gap: 0.35rem;
    /* Don't shrink label so text wraps early; let row use accordion max-width first */
    flex: 0 1 auto;
    min-width: max-content;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option label input[type="checkbox"] {
    top: 4px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type label input[type="checkbox"] {
    top: 6px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option ~ .fingers-neuroma-option label input[type="checkbox"] {
    top: 3px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type {
    margin-top: 10px;
    /* Next sits after option text; second row keeps space-between for right-aligned Next */
    justify-content: flex-start;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type label span {
    top: 7px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type .fingers-neuroma-next-button {
    position: relative;
    top: 6px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option ~ .fingers-neuroma-option .fingers-neuroma-next-button {
    position: relative;
    top: 2px;
}

.fingers-neuroma-options-panel-inner .fingers-neuroma-option ~ .fingers-neuroma-option label span {
    top: 4px;
}

@media (max-width: 640px) {
    .fingers-neuroma-options-accordion {
        margin-left: 16px;
        margin-right: 8px;
    }

    .fingers-arthroplasty-assign-options.fingers-neuroma-options-accordion {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Digit arthroplasty — Assigning/Combining Options (~2/3 width of Neuroma accordion; same open/closed width) */
.fingers-arthroplasty-assign-options.fingers-neuroma-options-accordion {
    margin-top: 20px;
    margin-left: 0;
    margin-right: 0;
    width: min(100%, calc(35.67rem + 2px));
}

/* Thumb — severe implant failure (p. 505); matches Assigning/Combining accordion width */
.fingers-arthroplasty-severe-failure-options.fingers-neuroma-options-accordion {
    margin-top: 12px;
    margin-left: 0;
    margin-right: 0;
    width: min(100%, calc(35.67rem + 2px));
}

.fingers-arthroplasty-severe-failure-option-list.arthroplasty-options {
    margin-bottom: 0;
    gap: 8px;
}

/* Wrist arthroplasty — severe failure: same width as digit arthroplasty severe-failure accordion */
.fingers-neuroma-options-accordion.wrist-arthroplasty-severe-failure-accordion {
    margin-left: 0;
    margin-right: 0;
    margin-top: 12px;
    width: min(100%, calc(35.67rem + 2px));
}

/* Elbow arthroplasty — severe failure (same width as digit severe-failure accordion) */
.fingers-neuroma-options-accordion.elbow-arthroplasty-severe-failure-accordion {
    margin-left: 0;
    margin-right: 0;
    margin-top: 12px;
    width: min(100%, calc(35.67rem + 2px));
}

/* Shoulder arthroplasty — severe failure (same width as digit severe-failure accordion) */
.fingers-neuroma-options-accordion.shoulder-arthroplasty-severe-failure-accordion {
    margin-left: 0;
    margin-right: 0;
    margin-top: 12px;
    width: min(100%, calc(35.67rem + 2px));
}

/* Arthroplasty accordions: grey header row = title (flex) + ? + blue chevron */
.fingers-arthroplasty-accordion-header-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    background: #e8e8e8;
    box-sizing: border-box;
}

.fingers-arthroplasty-accordion-header-bar .fingers-neuroma-options-toggle--title {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 6px 6px 12px;
}

.fingers-arthroplasty-accordion-header-bar .fingers-neuroma-options-toggle--chevron {
    flex: 0 0 auto;
    width: auto;
    justify-content: center;
    padding: 6px 13px 6px 4px;
    gap: 0;
}

.fingers-arthroplasty-assign-help.fingers-arthroplasty-assign-help--header {
    position: static;
    flex-shrink: 0;
    margin: 0 6px 0 0;
}

.fingers-arthroplasty-assign-help {
    position: absolute;
    top: 8px;
    right: 18px;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: 2px solid #1e90ff;
    border-radius: 50%;
    background: #fff;
    color: #1e90ff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.fingers-arthroplasty-assign-help:hover,
.fingers-arthroplasty-assign-help:focus-visible {
    background: #eef6ff;
}

.fingers-arthroplasty-assign-help:focus-visible {
    outline: 2px solid #1e90ff;
    outline-offset: 2px;
}

/* Space below grey header when accordion is open (Assigning/Combining + severe failure) */
.fingers-arthroplasty-assign-options-inner {
    padding-top: 20px;
}

.fingers-arthroplasty-assign-options-inner .fingers-arthroplasty-assign-option label {
    margin-left: 0;
}

.fingers-arthroplasty-assign-options-inner .fingers-arthroplasty-assign-option:first-of-type {
    margin-top: 0;
}

/* Custom checkbox styles */
.fingers-distribution-selection label,
.fingers-nerve-selection label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    margin-left: 40px;
    display: block;
}

/* Add this to center the title */
.fingers-calculator-card h3 {
    text-align: center;
    margin-bottom: 20px;
}

/* Add styling for the new section */
.fingers-involvement-section {
    margin-bottom: 20px;
}

.fingers-involvement-section p {
    margin-bottom: 15px;
}

/* Primary slider track */
.fingers-primary-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    pointer-events: none;
}

/* Secondary slider track (transparent) */
.fingers-secondary-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: transparent !important;
    border: none !important;
    border-radius: 2px;
    pointer-events: none;
}

.fingers-secondary-slider::-moz-range-track {
    background: transparent !important;
    border: none !important;
}

/* Add these new styles for the digit length labels */
.fingers-digit-length-label {
    text-align: right;
    line-height: 1.2;
}

.fingers-digit-length-right .fingers-digit-length-label {
    text-align: left;
}

/* Update the existing digit-length styles to accommodate the new structure */
.fingers-digit-length-left, .fingers-digit-length-right {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    top: -260px;
}

.fingers-digit-length-left {
    left: 215px;
}

.fingers-digit-length-right {
    right: 225px;
}
/* Add these styles to adjust the label alignment */
.fingers-digit-length-label div:first-child {
    margin-right: 15px;
}

/* Add styles for focus state and when spinbuttons are active */
.fingers-digit-length-input:focus,
.fingers-digit-length-wrapper:hover .fingers-digit-length-input {
    outline: none;
    border: 1px solid #3B90FF;
    box-shadow: 0 0 0 1px #3B90FF;
}

/* Add hover state */
.fingers-distribution-selection input[type="checkbox"]:hover:not(:checked),
.fingers-nerve-selection input[type="checkbox"]:hover:not(:checked) {
    background-color: #F0F8FF;
}

/* Add styles for the checkbox label text */
.fingers-distribution-selection label span {
    position: relative;
    top: 2px;
}

.fingers-nerve-line label span {
    position: relative;
    top: 2px;
    left: -2px;
}

.fingers-slider-group.right .fingers-slider-container {
    position: absolute;
    width: 100%;
    height: 100%;
    left: -2px;
}

.fingers-slider-group.left .fingers-slider-container {
    position: absolute;
    width: 100%;
    height: 100%;
    left: -3px;
}

/* Add these styles back for checkboxes */
.fingers-distribution-selection input[type="checkbox"],
.fingers-nerve-selection input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #3B90FF;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    transition: background-color 0.2s ease;
    background-color: white;
}

/* Add back the checkbox checked state */
.fingers-distribution-selection input[type="checkbox"]:checked,
.fingers-nerve-selection input[type="checkbox"]:checked {
    background-color: #3B90FF;
}

/* Add back the checkmark */
.fingers-distribution-selection input[type="checkbox"]:checked::after,
.fingers-nerve-selection input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Add back the spinner buttons positioning */
.fingers-digit-length-input:focus ~ .fingers-spinner-buttons,
.fingers-digit-length-wrapper:hover .fingers-spinner-buttons {
    display: flex;
    right: 2px;
}

/*Specific to Thumb - Sensory */
.thumb-sensory-diagram {
    position: relative;
    width: 208px;
    height: 416px;
    margin: 0 auto;
}

.thumb-sensory-diagram img {
    position: relative;
    height: 100%;
    width: auto;
    display: block;
    margin: 0 auto;
    left: -.3px;
    top: -4.5px;
}

/* PDF-open thumb sensory: keep side boxes out of diagram center and place labels above inputs. */
body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-left,
body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-right {
    flex-direction: column;
    gap: 8px;
    top: -272px;
}

body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-left {
    left: 40px;
    align-items: center;
    text-align: center;
}

body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-left .fingers-digit-length-wrapper {
    transform: translateX(-4px);
}

body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-right {
    right: 40px;
    align-items: center;
    text-align: center;
}

body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-label,
body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-right .fingers-digit-length-label {
    text-align: center;
    line-height: 1.15;
}

body.ama-pdf-open #thumb-sensory-general-wrap .fingers-digit-length-label div:first-child {
    margin-right: 0;
}

/* PDF-open finger sensory (index/middle/ring/little): move side boxes out and stack labels above. */
body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-right {
    flex-direction: column;
    gap: 8px;
    top: -272px;
}

body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-left,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-left {
    left: 52px;
    align-items: center;
    text-align: center;
}

body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-right,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-right {
    right: 52px;
    align-items: center;
    text-align: center;
}

body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-right .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-right .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-right .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-label,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-right .fingers-digit-length-label {
    text-align: center;
    line-height: 1.15;
}

body.ama-pdf-open .calculator-card:has(#if-ulnar-length) .fingers-digit-length-label div:first-child,
body.ama-pdf-open .calculator-card:has(#mf-ulnar-length) .fingers-digit-length-label div:first-child,
body.ama-pdf-open .calculator-card:has(#rf-ulnar-length) .fingers-digit-length-label div:first-child,
body.ama-pdf-open .calculator-card:has(#lf-ulnar-length) .fingers-digit-length-label div:first-child {
    margin-right: 0;
}

/* PDF-open thumb + digit sensory: Neuroma Options — full card width; label row wraps; Next on its own row (visible beside PDF viewer). */
body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-accordion {
    width: 100%;
    max-width: 100%;
    margin-left: 16px;
    margin-right: 0;
    box-sizing: border-box;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-accordion.is-open .fingers-neuroma-options-panel {
    max-height: 28rem;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner {
    padding-top: 10px;
    padding-bottom: 12px;
}

/* Neuroma rows also use .fingers-distribution-selection (default margin-bottom: 20px) — tighten for PDF-open layout. */
body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option.fingers-distribution-selection {
    margin-bottom: 0;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option {
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    row-gap: 6px;
    column-gap: 8px;
    margin-top: 0;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type {
    margin-top: 6px;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option ~ .fingers-neuroma-option {
    margin-top: 14px;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option label {
    /* Shrink to longest line so Next sits beside text, not at far right of card */
    flex: 0 1 auto;
    width: max-content;
    max-width: calc(100% - 4.75rem);
    min-width: 0;
    align-items: flex-start;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option label span {
    white-space: normal;
    min-width: 0;
    flex: 0 1 auto;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-next-button {
    margin-left: 0;
    flex: 0 0 auto;
    position: relative;
    top: 0;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option label input[type="checkbox"] {
    top: 0;
    flex: 0 0 auto;
    align-self: flex-start;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    box-sizing: border-box;
}

body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option:first-of-type label span,
body.ama-pdf-open .fingers-calculator-card:has([id$="-sensory-general-wrap"]) .fingers-neuroma-options-panel-inner .fingers-neuroma-option ~ .fingers-neuroma-option label span {
    top: 0;
}

/* Index / middle / ring — Sensory (Neuroma) */
.fingers-sensory-general-wrap {
    display: block;
}

.fingers-sensory-neuroma-wrap {
    max-width: 100%;
    width: 100%;
    margin: 0 0 1rem;
    text-align: left;
    box-sizing: border-box;
}

.fingers-neuroma-sensory-heading {
    text-align: left;
    margin-bottom: 0.75rem;
}

.fingers-neuroma-sensory-instruction {
    margin: 0 0 1rem;
    text-align: left;
    max-width: none;
}

.fingers-neuroma-sensory-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin: 0 0 1.25rem;
    width: 100%;
}

.fingers-neuroma-sensory-field--side {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 0 0 auto;
    margin-top: 9rem;
    text-align: left;
    font-size: inherit;
}

.fingers-neuroma-sensory-field--side .fingers-digit-length-wrapper {
    flex-shrink: 0;
}

/* Option 2: nerve already fixed from general sensory — locked neuroma % field */
.fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-pct-input:disabled {
    background-color: #e8e8e8;
    color: #555;
    cursor: not-allowed;
}

.fingers-sensory-neuroma-wrap .fingers-digit-length-wrapper:has(.fingers-neuroma-sensory-pct-input:disabled)
    .fingers-spinner-up:disabled,
.fingers-sensory-neuroma-wrap .fingers-digit-length-wrapper:has(.fingers-neuroma-sensory-pct-input:disabled)
    .fingers-spinner-down:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Nudge only the Ulnar input (blue box) left; label and diagram positions unchanged in layout. */
.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-digit-length-wrapper {
    transform: translateX(-0.25rem);
}

/* Match regular digit sensory label typography, but keep neuroma wording in 3 lines. */
.fingers-neuroma-sensory-label-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.2;
    color: #333;
    font-size: inherit;
    font-weight: 400;
    min-width: 84px;
}

.fingers-neuroma-sensory-label-line {
    display: block;
    line-height: 1.2;
}

/* Left side label should face inward toward its box/image. */
.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-neuroma-sensory-label-stack {
    align-items: center;
    text-align: center;
    transform: translateX(-1.2rem);
}

.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-neuroma-sensory-label-line:first-child {
    transform: translateX(0.16rem);
}

.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-neuroma-sensory-label-line:last-child {
    transform: translateX(0.32rem);
}

/* Nudge ulnar group left so image-to-box spacing matches radial side. */
.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child {
    margin-right: 2.75rem;
}

/* Right side label should read left-to-right toward its box. */
.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-neuroma-sensory-label-stack {
    align-items: flex-start;
    text-align: left;
}

/* Radial column sits closer to the diagram than ulnar (label width / wrap); offset right for symmetric gaps. */
.fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child {
    margin-left: 2.5rem;
}

/* PDF-open neuroma sensory: place side labels above blue inputs and nudge right input left. */
body.ama-pdf-open .fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-field--side {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

body.ama-pdf-open .fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-label-stack {
    min-width: 0;
    align-items: center;
    text-align: center;
    transform: none;
}

body.ama-pdf-open .fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-label-line:first-child,
body.ama-pdf-open .fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-label-line:last-child {
    transform: none;
}

/* Keep left input as-is; move the right-side input slightly left for centering. */
body.ama-pdf-open .fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-digit-length-wrapper {
    transform: translateX(-6px);
}

/* Left hand: DOM order Radial | diagram | Ulnar — mirror label/box nudges from right-hand (Ulnar | diagram | Radial). */
.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-digit-length-wrapper {
    transform: none;
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-digit-length-wrapper {
    transform: translateX(-0.25rem);
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-neuroma-sensory-label-stack {
    align-items: flex-start;
    text-align: left;
    transform: none;
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-neuroma-sensory-label-line:first-child {
    transform: none;
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child .fingers-neuroma-sensory-label-line:last-child {
    transform: translateX(0.32rem);
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-neuroma-sensory-label-stack {
    align-items: center;
    text-align: center;
    transform: translateX(-1.2rem);
}

.fingers-sensory-neuroma-wrap--left-hand .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child .fingers-neuroma-sensory-label-line:first-child {
    transform: translateX(0.16rem);
}

.fingers-neuroma-sensory-diagram-wrap {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
}

.fingers-neuroma-sensory-diagram-img {
    display: block;
    max-height: 380px;
    width: auto;
    max-width: min(220px, 100%);
    margin: 0.35rem auto 0;
    object-fit: contain;
}

/* Ring neuroma: less space between p.448 swap row and exit bar (vs default 20px on .fingers-distribution-selection) */
#rf-neuroma-p448-swap-row {
    margin-bottom: 8px;
}

/* Reference sits below exit bar */
.fingers-sensory-neuroma-wrap .fingers-neuroma-sensory-reference-below-exit {
    margin: 12px 0 12px;
    overflow-x: visible;
}

/* Neuroma sensory “exit” row — shrink-wraps to label + button (not full card width) */
.fingers-neuroma-sensory-exit-shell {
    display: inline-block;
    vertical-align: top;
    margin: 12px 0 7px 40px;
    width: max-content;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #1e90ff;
    border-radius: 4px;
    overflow: hidden;
    background: #e8e8e8;
}

.fingers-neuroma-sensory-exit-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 6px 10px;
    box-sizing: border-box;
    background: #e8e8e8;
    font: inherit;
    font-weight: 600;
    color: #222;
    text-align: left;
}

.fingers-neuroma-sensory-exit-bar-label {
    flex: 0 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.fingers-neuroma-sensory-go-back {
    flex-shrink: 0;
    margin: 0;
    min-width: 0;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 9px;
    background-color: #1e90ff;
    color: #fff;
    border: 1px solid #1e90ff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.fingers-neuroma-sensory-go-back:hover {
    background-color: #1873cc;
    border-color: #1873cc;
}

.fingers-neuroma-sensory-go-back:focus-visible {
    outline: 2px solid #1e90ff;
    outline-offset: 2px;
}

/* Same typography as digit sensory .fingers-reference; wrap naturally — no horizontal scroll region */
.fingers-sensory-neuroma-wrap .fingers-reference {
    overflow-x: visible;
}

.fingers-sensory-neuroma-wrap .fingers-reference p {
    margin: 0;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

@media (max-width: 640px) {
    .fingers-neuroma-sensory-layout {
        flex-wrap: wrap;
        justify-content: center;
    }

    .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:last-child {
        margin-left: 0;
    }

    .fingers-neuroma-sensory-layout > .fingers-neuroma-sensory-field--side:first-child {
        margin-right: 0;
    }

    .fingers-neuroma-sensory-field--side {
        margin-top: 0;
    }

    .fingers-neuroma-sensory-diagram-wrap {
        flex: 1 1 100%;
        order: -1;
    }

    .fingers-neuroma-sensory-exit-shell {
        margin-left: 16px;
        margin-right: 8px;
    }
}

/* Authentication gate / account management */
body.auth-active {
    background-color: #050b22;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

body.auth-active .container {
    max-width: 560px;
    width: min(560px, calc(100vw - 24px));
    background: #010515;
    border: 1px solid #31457a;
    border-radius: 14px;
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.62),
        0 10px 26px rgba(2, 10, 28, 0.55),
        0 0 0 1px rgba(125, 160, 255, 0.12);
    padding: 18px 22px;
    max-height: calc(100vh - 24px);
    overflow: hidden;
    transform: translateY(-2px);
}

.auth-screen {
    color: #e5ebff;
}

.auth-logo {
    display: block;
    width: min(520px, 94%);
    height: auto;
    margin: 0 auto 10px;
    border-radius: 6px;
}

.auth-title {
    margin: 0 0 4px;
    color: #f6f9ff;
    font-size: 32px;
    font-weight: 600;
}

.auth-title-ca {
    color: #f6f9ff;
}

.auth-subtitle {
    margin: 0 0 12px;
    text-align: center;
    color: #a8b6de;
    font-size: 14px;
}

.auth-setup-title {
    margin: 2px 0 6px;
    color: #f6f9ff;
    text-align: center;
    font-size: 20px;
}

.auth-setup-copy {
    margin: 0 0 14px;
    text-align: center;
    color: #a8b6de;
    font-size: 14px;
}

.auth-form {
    margin: 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.auth-field span {
    color: #dce6ff;
    font-size: 13px;
    font-weight: 600;
}

.auth-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid #304271;
    border-radius: 8px;
    background-color: #0a1638;
    color: #f4f7ff;
    font-size: 14px;
}

.auth-field input::placeholder {
    color: #8ea0cf;
}

.auth-field input:focus-visible {
    outline: 2px solid #52a7ff;
    outline-offset: 2px;
}

.auth-status-message {
    min-height: 20px;
    margin: 1px 0 6px;
    text-align: center;
    font-size: 13px;
    color: #ffb5b5;
}

.auth-status-message.auth-status-message--success {
    color: #9ef4c1;
}

.auth-form button,
.auth-modal .auth-form button {
    display: inline-flex;
    width: 100%;
    margin: 4px 0 0;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    font-size: 14px;
    transition: background-color 0.12s ease, box-shadow 0.08s ease;
}

.auth-modal .auth-form button {
    border: none;
    border-radius: 8px;
    background: #1e90ff;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.auth-modal .auth-form button:hover {
    background: #1873cc;
}

.auth-modal .auth-form button:active {
    background: #125a98;
    box-shadow: inset 0 2px 10px rgba(0, 24, 48, 0.35);
}

.auth-login-form .auth-field {
    margin-bottom: 14px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.auth-forgot-link {
    width: 100% !important;
    margin: 0 auto 8px !important;
    max-width: 450px;
    display: block;
    text-align: left;
    position: relative;
    left: -124px;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    color: #5da5ff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.1;
}

.auth-forgot-link:hover {
    color: #7eb9ff;
    text-decoration: underline;
    background: transparent !important;
}

#authLoginSubmit {
    display: flex;
    border: 1px solid #536582;
    background: transparent;
    color: #ffffff;
    margin-top: 2px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.08s ease;
}

#authLoginSubmit:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #7292b7;
}

#authLoginSubmit:active {
    background: rgba(255, 255, 255, 0.18);
    border-color: #95bae3;
    box-shadow: inset 0 2px 10px rgba(0, 4, 18, 0.55);
}

/* Sign In / Sign Out in-flight spinner (shared with PD; `js/auth.js` toggles `.auth-btn-loading`) */
@keyframes auth-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

button.auth-btn-loading {
    position: relative;
    pointer-events: none;
    cursor: progress;
    color: transparent !important;
}

button.auth-btn-loading::after {
    content: '';
    position: absolute;
    left: calc(50% - 0.625rem);
    top: calc(50% - 0.625rem);
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-btn-spin 0.7s linear infinite;
    box-sizing: border-box;
}

#authLoginSubmit.auth-btn-loading:hover,
#authLoginSubmit.auth-btn-loading:active {
    box-shadow: none;
}

.auth-login-footnote {
    margin: 12px 0 2px;
    text-align: center;
    font-size: 17px;
    color: #48628f;
}

@media (max-height: 820px) {
    body.auth-active .container {
        padding: 14px 16px;
    }

    .auth-logo {
        width: min(460px, 90%);
        margin-bottom: 8px;
    }

    .auth-title {
        font-size: 29px;
        margin-bottom: 2px;
    }

    .auth-subtitle {
        margin-bottom: 8px;
        font-size: 13px;
    }

    .auth-field {
        margin-bottom: 8px;
    }
}

.auth-sidebar-toggle {
    position: static;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #1e90ff;
    color: #fff;
    box-shadow: 0 2px 6px rgba(30, 144, 255, 0.28);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    letter-spacing: 0.2px;
    visibility: hidden;
    pointer-events: none;
    cursor: pointer;
}

.auth-sidebar-toggle span {
    transform: translateX(0);
}

.auth-sidebar-toggle.is-visible {
    visibility: visible;
    pointer-events: auto;
}

.auth-sidebar-toggle.is-loading {
    pointer-events: none;
}

.auth-sidebar-toggle.is-loading span {
    opacity: 0;
}

.auth-sidebar-toggle:hover {
    background: #1873cc;
}

.landing-header-links .auth-sidebar-toggle {
    margin-left: 2px;
    flex-shrink: 0;
}

.auth-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2060;
    background: rgba(2, 7, 24, 0.33);
}

.auth-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(340px, calc(100vw - 18px));
    height: 100vh;
    z-index: 2070;
    transform: translateX(103%);
    transition: transform 0.24s ease;
    background: #f8fbff;
    border-left: 1px solid #dce6f7;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
    padding: 14px 14px 18px;
    box-sizing: border-box;
    overflow-y: auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.auth-sidebar.is-open {
    transform: translateX(0);
}

.auth-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.auth-sidebar-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 20px;
    text-align: left;
}

.auth-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    min-width: 34px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #5b6e95;
    color: #fff;
    border: none;
    font: inherit;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.08s ease;
}

.auth-sidebar-close::before {
    content: '×';
    display: block;
    font-size: calc(1rem + 2px);
    line-height: 1;
    transform: translateY(-1px);
}

.auth-sidebar-close:hover {
    background: #1873cc;
}

.auth-sidebar-user {
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #d4e1f7;
    background: #eef5ff;
}

.auth-sidebar-user-label {
    font-size: 11px;
    color: #4b5f85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-sidebar-user-email {
    margin-top: 4px;
    color: #16377f;
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.auth-sidebar-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-sidebar-btn {
    width: 100%;
    margin: 0;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 13px;
    background: #1e90ff;
    color: #fff;
    border: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.08s ease;
}

.auth-sidebar-btn:not(.auth-sidebar-btn-signout):hover {
    background: #1873cc;
}

.auth-sidebar-btn:not(.auth-sidebar-btn-signout):active {
    background: #125a98;
    box-shadow: inset 0 2px 10px rgba(0, 24, 48, 0.35);
}

.auth-sidebar-btn-signout {
    background: #38507e;
}

.auth-sidebar-btn-signout:hover {
    background: #2d4268;
}

.auth-sidebar-btn-signout:active {
    background: #1a2a4a;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.38);
}

.auth-sidebar-section {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #dde7f8;
}

.auth-sidebar-section h3 {
    margin: 0 0 8px;
    text-align: left;
    color: #0f172a;
    font-size: 14px;
}

.auth-sidebar-list {
    margin: 0;
    padding-left: 18px;
    color: #334155;
    font-size: 13px;
}

.auth-sidebar-list li {
    margin-bottom: 7px;
}

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 24, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2100;
    box-sizing: border-box;
}

.auth-modal {
    width: min(520px, calc(100vw - 24px));
    max-height: min(90vh, 780px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dbe4f5;
    box-shadow: 0 15px 38px rgba(15, 23, 42, 0.25);
    padding: 16px 16px 18px;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.auth-modal-overlay--manage-users {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
    background: rgba(3, 8, 24, 0.38);
}

.auth-modal.auth-modal--manage-users {
    width: min(1090px, calc(100vw - 300px));
    max-height: 100vh;
    height: 100vh;
    margin-right: min(340px, calc(100vw - 18px));
    border-radius: 0;
    border-left: 1px solid #d7deeb;
    box-shadow: -8px 0 22px rgba(15, 23, 42, 0.22);
    padding: 16px 20px 22px;
    animation: authManageUsersSlideIn 0.18s ease-out;
}

@keyframes authManageUsersSlideIn {
    from {
        transform: translateX(36px);
        opacity: 0.6;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.auth-modal-header h2 {
    margin: 0;
    text-align: left;
    font-size: 20px;
    color: #111827;
}

.auth-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 36px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 8px;
    background: #5b6e95;
    color: #fff;
    border: none;
    font: inherit;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.08s ease;
}

.auth-modal-close::before {
    content: '×';
    display: block;
    position: relative;
    top: -1px;
    font-size: calc(1rem + 2px);
    line-height: 1;
}

.auth-modal-close:hover {
    background: #1873cc;
}

.auth-modal-message {
    min-height: 18px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #b42318;
}

.auth-modal-message.auth-status-message--success {
    color: #027a48;
}

.auth-modal .auth-field input {
    background: #ffffff;
    color: #111827;
    border-color: #bfcee9;
}

.auth-modal .auth-field span {
    color: #111111;
}

.auth-checkbox-field {
    margin: 8px 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 14px;
}

.auth-users-list-wrap {
    margin-top: 12px;
    border-top: 1px solid #e5ebf7;
    padding-top: 12px;
    overflow-x: hidden;
}

.auth-users-two-pane {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-users-section {
    border: 1px solid #dbe5f4;
    border-radius: 10px;
    background: #f8fbff;
    padding: 10px;
}

.auth-users-section .auth-users-list-title {
    margin-bottom: 8px;
}

.auth-users-list-title {
    margin: 0 0 8px;
    text-align: left;
    color: #111827;
    font-size: 15px;
}

.auth-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.auth-users-list-active {
    max-height: 220px;
}

.auth-users-list-deleted {
    max-height: 190px;
}

.auth-users-create-row,
.auth-users-grid-head,
.auth-users-row {
    display: grid;
    grid-template-columns: minmax(132px, 1.12fr) minmax(190px, 1.35fr) minmax(150px, 1.12fr) 84px 94px 140px;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.auth-users-create-row {
    margin: 0 0 10px;
}

.auth-users-grid-head {
    padding: 0 4px;
    margin-bottom: 8px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.auth-users-grid-head span:nth-child(4) {
    padding-left: 22px;
}

.auth-users-grid-head span:nth-child(5) {
    padding-left: 30px;
}

.auth-users-grid-head span:nth-child(6) {
    padding-left: 48px;
}

.auth-deleted-users-grid-head span:nth-child(3) {
    padding-left: 32px;
}

.auth-deleted-users-grid-head span:nth-child(4) {
    padding-left: 30px;
}

.auth-deleted-users-grid-head span:nth-child(5) {
    padding-left: 28px;
}

.auth-deleted-users-grid-head span:nth-child(6) {
    padding-left: 46px;
}

.auth-users-row-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #bfcee9;
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    background: #ffffff;
}

.auth-users-cell {
    padding: 8px 10px;
    border: 1px solid #bfcee9;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-deleted-users-grid-head,
.auth-deleted-users-row {
    grid-template-columns: minmax(132px, 1.16fr) minmax(205px, 1.5fr) 84px 94px 104px 140px;
}

.auth-users-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.auth-users-admin-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #1f4e99;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.auth-users-admin-toggle input {
    margin: 0;
}

.auth-users-admin-toggle-create {
    border: 1px solid #bfcee9;
    border-radius: 8px;
    min-height: 33px;
    background: #ffffff;
}

.auth-users-row-btn {
    width: auto !important;
    margin: 0 !important;
    min-width: 70px;
    padding: 7px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    background: #1e90ff !important;
    transition: background-color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.auth-users-create-row .auth-users-row-btn {
    width: 100% !important;
}

#authManageUsersSubmit.auth-users-row-btn {
    width: calc(100% + 6px) !important;
    margin-left: -6px !important;
}

.auth-deleted-users-row .auth-users-row-btn[data-action='reinstate'] {
    width: calc(100% + 6px) !important;
    margin-left: -6px !important;
}

.auth-users-row-btn-delete {
    background: #dc2626 !important;
}

.auth-users-row-btn:not(:disabled):hover {
    background: #1873cc !important;
    box-shadow: 0 0 0 1px rgba(24, 115, 204, 0.18);
}

.auth-users-row-btn-delete:not(:disabled):hover {
    background: #b91c1c !important;
    box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.2);
}

.auth-users-row-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.auth-users-row-empty {
    color: #334155;
    font-size: 13px;
}

.auth-users-add-date-cell {
    font-size: 12px;
    color: #334155;
    text-align: center;
    white-space: nowrap;
}

.auth-user-logs-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-user-logs-section {
    border: 1px solid #dbe5f4;
    border-radius: 10px;
    background: #f8fbff;
    padding: 10px;
}

.auth-user-logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.auth-user-log-item {
    border: 1px solid #d9e3f2;
    border-radius: 9px;
    background: #ffffff;
    padding: 8px 10px;
}

.auth-user-log-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.auth-user-log-meta {
    margin-top: 3px;
    font-size: 12px;
    color: #475569;
}

.auth-delete-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 24, 0.5);
    z-index: 2300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.auth-delete-confirm-dialog {
    width: min(420px, calc(100vw - 24px));
    border: 1px solid #d6deed;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
    padding: 14px 14px 12px;
}

.auth-delete-confirm-dialog h4 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
}

.auth-delete-confirm-dialog p {
    margin: 8px 0 0;
    color: #334155;
    font-size: 14px;
}

.auth-success-dialog {
    width: min(420px, calc(100vw - 24px));
}

.auth-delete-confirm-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.auth-delete-confirm-cancel {
    background: #475569 !important;
}

.auth-delete-confirm-cancel:hover {
    background: #334155 !important;
}

@media (max-width: 1120px) {
    .auth-modal.auth-modal--manage-users {
        width: 100vw;
        margin-right: 0;
    }
}
