body {
            font-family: Arial, sans-serif;
            margin: 0;
            background: #f7f7f7;
            color: #222;
        }
        
header {
    background: #1f3a5f;
    color: white;
    height: 120px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

        .site-name {
            font-size: 30px;
            line-height: 1;
            font-weight: 800;
            letter-spacing: 0.3px;
        }
        header a {
            color: white;
            margin-left: 16px;
            text-decoration: none;
        }
        main {
            max-width: 1100px;
            margin: 30px auto;
            background: white;
            padding: 30px;
            border-radius: 10px;
        }
        .button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 42px;
            padding: 0 18px;
            background: #17365d;
            color: white;
            border: 1px solid #17365d;
            border-radius: 6px;
            text-decoration: none;
            font-family: inherit;
            font-size: 16px;
            font-weight: 600;
            line-height: 1;
            cursor: pointer;
            box-sizing: border-box;
            vertical-align: middle;
        }

        .button:hover {
            background: #102846;
            color: white;
            text-decoration: none;
        }

        button.button {
            appearance: none;
            -webkit-appearance: none;
        }

        .card {
            border: 1px solid #ddd;
            padding: 16px;
            margin: 12px 0;
            border-radius: 8px;
            background: #fafafa;
        }
        .form-control {
            width: 100%;
            padding: 8px;
            margin-top: 4px;
            margin-bottom: 14px;
            box-sizing: border-box;
        }
        label {
            font-weight: bold;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        td, th {
            padding: 10px;
            border-bottom: 1px solid #ddd;
            text-align: left;
        }
    


.nav-account {
    font-weight: 700;
    opacity: 0.95;
    white-space: nowrap;
}


.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #dc2626;
    color: white;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 2px #1f3a5f;
}


.action-row + .action-row {
    margin-top: 8px;
}

button.button {
    appearance: none;
    -webkit-appearance: none;
}


.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px 0;
}

.action-row + .action-row {
    margin-top: 6px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    background: #17365d;
    color: white;
    border: 1px solid #17365d;
    border-radius: 6px;
    text-decoration: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    vertical-align: middle;
    white-space: nowrap;
    width: auto;
    max-width: max-content;
}

.button:hover {
    background: #102846;
    color: white;
    text-decoration: none;
}

.button.secondary {
    background: #17365d;
    border-color: #17365d;
    color: white;
}

button.button {
    appearance: none;
    -webkit-appearance: none;
}


.case-action-row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    column-gap: 4px !important;
    row-gap: 8px !important;
    margin: 14px 0 20px 0 !important;
}

.case-action-row .button {
    margin: 0 !important;
}


/* Final override: make top case action buttons match lower button spacing */
.case-action-row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    column-gap: 4px !important;
    row-gap: 6px !important;
    margin: 14px 0 20px 0 !important;
}

.case-action-row .button {
    margin-left: 0 !important;
    margin-right: 0 !important;
}


.case-button-block .button {
    display: inline-flex;
    margin: 0 6px 6px 0 !important;
}


.case-button-block {
    margin: 14px 0 20px 0;
}

.case-button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.case-button-row .button {
    margin: 0 !important;
}



/* Preview page layout: pin footer to bottom of preview sheet */
.preview-page {
    background: white;
    color: #111827;
    width: 8.5in;
    min-height: 11in;
    margin: 24px auto;
    padding: 0.75in;
    border: 1px solid #d1d5db;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    font-family: Georgia, "Times New Roman", serif;
    page-break-after: always;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.preview-instruction-text {
    white-space: pre-wrap;
    font-size: 18px;
    line-height: 1.6;
    flex: 1 1 auto;
}

.preview-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: none;
    font-size: 14px;
    line-height: 1.4;
    color: #374151;
}

@media print {
    .no-print,
    header,
    nav {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .preview-page {
        border: none;
        box-shadow: none;
        margin: 0;
        width: auto;
        min-height: 11in;
        page-break-after: always;
    }
}


.export-button-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.export-button-row .button {
    white-space: nowrap;
    padding-left: 22px;
    padding-right: 22px;
}


.download-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.download-modal {
    width: 100%;
    max-width: 620px;
    background: #ffffff;
    color: #111827;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    padding: 28px;
    border: 1px solid #d1d5db;
}

.download-modal h2 {
    margin-top: 0;
    margin-bottom: 14px;
    color: #0f172a;
}

.download-modal p {
    line-height: 1.55;
    margin: 0 0 14px 0;
}

.download-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}


.download-warning-box {
    border: 1px solid #f59e0b;
    background: #fff7ed;
    color: #111827;
    border-radius: 10px;
    padding: 18px;
    margin: 18px 0;
}

.download-warning-box h2,
.download-options-box h2 {
    margin-top: 0;
}

.download-options-box {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    border-radius: 10px;
    padding: 18px;
    margin: 18px 0;
}

.download-check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    font-weight: 700;
}

.download-check-row input {
    width: 18px;
    height: 18px;
}



.account-menu-button {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.account-menu-button:hover {
    text-decoration: underline;
}

.account-menu-caret {
    font-size: 0.85em;
    margin-left: 4px;
}

.account-menu-dropdown {
    position: absolute;
    right: 0;
    top: 34px;
    min-width: 220px;
    background: white;
    color: #111827;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 14px 35px rgba(0,0,0,0.22);
    z-index: 1000;
    overflow: hidden;
}

.account-menu-dropdown a,
.account-menu-dropdown button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    background: white;
    color: #111827;
    border: none;
    text-align: left;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.account-menu-dropdown a:hover,
.account-menu-dropdown button:hover {
    background: #f3f4f6;
}


header nav,
nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 34px;
    row-gap: 10px;
}

.account-menu {
    position: relative;
    display: inline-block;
    margin-left: 0 !important;
}

.nav-notification {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}


.account-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px 0;
    border-bottom: 1px solid #d1d5db;
}

.account-tabs a {
    display: inline-block;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
    font-weight: 800;
}

.account-tabs a.active {
    background: white;
    color: #0f172a;
    border-color: #9ca3af;
}

.account-settings-card hr {
    margin: 26px 0;
    border: none;
    border-top: 1px solid #d1d5db;
}

.default-instruction-list {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    max-height: 420px;
    overflow: auto;
}

.default-instruction-list ul {
    list-style: none;
    padding-left: 0;
    margin: 10px 0 0 0;
}

.default-instruction-list li {
    margin: 8px 0;
}

.help-text {
    color: #4b5563;
    font-size: 0.95em;
}


.account-settings-card input[type="text"],
.account-settings-card input[type="email"],
.account-settings-card input[type="password"],
.account-settings-card select,
.account-settings-card textarea {
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}

.account-settings-card label {
    display: block;
    font-weight: 800;
    margin-bottom: 6px;
}

.account-settings-card .errorlist {
    color: #991b1b;
    margin: 6px 0 0 0;
    padding-left: 20px;
}

.form-errors {
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    margin-bottom: 18px;
}

.password-help ul {
    margin-top: 8px;
}


.email-address-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.email-address-option {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    font-weight: 400 !important;
}

.email-address-option input {
    width: auto !important;
}

.status-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 800;
}

.status-pill.success {
    background: #dcfce7;
    color: #166534;
}

.status-pill.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-pill.primary {
    background: #dbeafe;
    color: #1e40af;
}


.case-charge-list {
    margin-top: 6px;
    padding-left: 22px;
}

.case-charge-list li {
    margin: 6px 0;
}

.charge-form-list {
    display: grid;
    gap: 16px;
}

.charge-form-row {
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
}

.charge-grid {
    display: grid;
    grid-template-columns: 140px 1fr 220px;
    gap: 14px;
}

.delete-charge-row {
    margin-top: 10px;
    color: #991b1b;
    font-weight: 700;
}

.muted {
    color: #6b7280;
}


.select-instructions-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-status {
    margin-left: 12px;
}


.instruction-category-card {
    margin: 22px 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    overflow: hidden;
}

.instruction-category-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    padding: 14px 18px;
    background: #1f3f66;
    color: white;
    font-size: 1.15rem;
    font-weight: 800;
    list-style: none;
}

.instruction-category-summary::-webkit-details-marker {
    display: none;
}

.instruction-category-summary::before {
    content: "▸";
    margin-right: 8px;
}

.instruction-category-card[open] > .instruction-category-summary::before {
    content: "▾";
}

.category-count {
    font-size: 0.9rem;
    font-weight: 700;
    opacity: 0.9;
    white-space: nowrap;
}

.instruction-category-body {
    background: white;
}

.instruction-select-row {
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
}

.instruction-select-row:last-child {
    border-bottom: none;
}

.instruction-select-row summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 18px;
}

.instruction-select-row summary::-webkit-details-marker {
    display: none;
}

.instruction-select-row:nth-child(even) summary {
    background: #f9fafb;
}

.instruction-select-summary {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 700;
}

.instruction-select-summary input {
    width: auto !important;
}

.instruction-full-text {
    margin: 0 18px 16px 46px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.instruction-body,
.instruction-notes {
    line-height: 1.55;
}

.instruction-notes {
    color: #374151;
}


.instruction-expand-hint {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
}

.instruction-select-row[open] .instruction-expand-hint {
    color: #1f3f66;
}

.instruction-full-text h4 {
    margin: 0 0 10px 0;
    color: #1f3f66;
    font-size: 1rem;
}

.instruction-full-text {
    margin: 0 18px 18px 46px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 10px;
}

.instruction-body {
    line-height: 1.6;
}

.instruction-notes {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #d1d5db;
    line-height: 1.55;
    color: #374151;
}

.instruction-notes.muted {
    color: #6b7280;
}


.instruction-title-line {
    flex: 1;
}

.instruction-expand-hint {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.instruction-select-row[open] .instruction-expand-hint {
    color: #1f3f66;
}

.instruction-full-text h4 {
    margin: 0 0 10px 0;
    color: #1f3f66;
    font-size: 1rem;
}

.instruction-full-text {
    margin: 0 18px 18px 46px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 10px;
}

.instruction-body {
    line-height: 1.6;
}

.instruction-notes {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #d1d5db;
    line-height: 1.55;
    color: #374151;
}

.instruction-notes.muted,
.muted {
    color: #6b7280;
}


.selected-instruction-text,
.instruction-full-text,
.instruction-body,
.instruction-notes {
    max-width: none !important;
    width: auto;
}

.selected-instruction-text {
    line-height: 1.45;
    white-space: normal;
}

.instruction-full-text p,
.selected-instruction-text p {
    max-width: none !important;
}


.preview-page {
    width: 8.5in !important;
    height: 11in !important;
    min-height: 11in !important;
    max-height: 11in !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    page-break-after: always;
    break-after: page;
}

.preview-instruction-text {
    white-space: pre-wrap;
    line-height: 1.35;
}

@media print {
    .preview-page {
        width: 8.5in !important;
        height: 11in !important;
        margin: 0 auto !important;
        page-break-after: always;
        break-after: page;
    }
}


/* Letter-size preview page with footer anchored at the bottom */
.preview-page {
    position: relative !important;
    width: 8.5in !important;
    height: 11in !important;
    min-height: 11in !important;
    max-height: 11in !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 0.75in 0.75in 0.95in 0.75in !important;
    background: white;
    page-break-after: always;
    break-after: page;
}

.preview-instruction-text {
    white-space: pre-wrap;
    line-height: 1.35;
    font-size: 12pt;
    max-height: 9.25in;
    overflow: hidden;
}

.preview-footer {
    position: absolute !important;
    left: 0.75in !important;
    right: 0.75in !important;
    bottom: 0.55in !important;
    font-size: 10pt !important;
    line-height: 1.2 !important;
    color: #374151 !important;
    text-align: left !important;
}

.preview-footer div {
    margin: 0 !important;
    padding: 0 !important;
}

@media print {
    @page {
        size: letter;
        margin: 0;
    }

    .preview-page {
        width: 8.5in !important;
        height: 11in !important;
        min-height: 11in !important;
        max-height: 11in !important;
        margin: 0 auto !important;
        padding: 0.75in 0.75in 0.95in 0.75in !important;
        page-break-after: always;
        break-after: page;
    }

    .preview-footer {
        bottom: 0.55in !important;
    }
}


.site-title-link {
    color: inherit !important;
    text-decoration: none !important;
    display: inline-block;
}

.site-title-link:visited {
    color: inherit !important;
}

.site-title-link:hover {
    color: inherit !important;
    text-decoration: none !important;
    opacity: 0.9;
}



.site-logo-link {
    display: flex;
    align-items: center;
    height: 100%;
    text-decoration: none !important;
}

.site-logo-img {
    display: block;
    height: 100%;
    width: auto;
    max-height: none !important;
}

.site-logo-link:hover {
    opacity: 0.92;
}




/* Final header logo sizing override */
header {
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    padding: 0 32px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
}

.site-title {
    height: 120px !important;
    max-height: 120px !important;
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
}

.site-logo-link {
    height: 120px !important;
    max-height: 120px !important;
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
    text-decoration: none !important;
}

.site-logo-img {
    height: 120px !important;
    max-height: 120px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    display: block !important;
}


/* Fix account dropdown being clipped by header/logo sizing */
header {
    overflow: visible !important;
    position: relative !important;
    z-index: 1000 !important;
}

.site-title,
.site-logo-link {
    overflow: visible !important;
}

nav {
    position: relative !important;
    z-index: 2000 !important;
}

.user-menu,
.user-dropdown,
.dropdown,
.dropdown-menu {
    z-index: 3000 !important;
}



/* Let logout form behave like the other account dropdown rows */
.account-menu-dropdown form {
    display: contents;
}

/* CSP cleanup utility classes */
.hidden {
    display: none !important;
}

.inline-form {
    display: inline;
}

.inline-flex-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.flex-between-start {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.flex-actions-end {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mt-18 {
    margin-top: 18px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-22 {
    margin-top: 22px;
}

.mb-6 {
    margin-bottom: 6px;
}

.mb-18 {
    margin-bottom: 18px;
}

.help-indent {
    margin-left: 28px;
}

.error-small {
    color: #991b1b;
    font-size: 14px;
    margin-top: 4px;
}

.warning-text {
    color: #b45309;
    font-weight: bold;
}

.center-card-narrow {
    max-width: 720px;
    margin: 40px auto;
}

.warning-box {
    border: 1px solid #f59e0b;
    background: #fff7ed;
    padding: 16px;
    border-radius: 8px;
    margin: 18px 0;
}

.no-top-margin {
    margin-top: 0;
}

.pre-wrap {
    white-space: pre-wrap;
}

.user-cell-compact {
    line-height: 1.2;
}

.user-cell-email {
    font-size: 0.9em;
    margin-top: 2px;
}

.auth-card {
    max-width: 560px;
    margin: 40px auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    max-width: 420px;
}

.mt-18 {
    margin-top: 18px;
}

.auth-card-narrow {
    max-width: 620px;
}

.auth-intro {
    margin-bottom: 24px;
}

.auth-form {
    margin-top: 8px;
}

.auth-field {
    margin-bottom: 22px;
}

.auth-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-field input,
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
    display: block;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    padding: 10px 12px;
}

.auth-submit {
    margin-top: 4px;
}

.auth-footer-link {
    margin-top: 26px;
}
