:root {
    --page-bg:
        radial-gradient(circle at top left, rgba(115, 115, 115, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(163, 163, 163, 0.10), transparent 24%),
        linear-gradient(180deg, #ececec 0%, #d9d9d9 100%);
    --shell-bg: rgba(250, 250, 250, 0.82);
    --shell-border: rgba(115, 115, 115, 0.24);
    --shell-shadow: 0 24px 60px rgba(38, 38, 38, 0.12);
    --text-main: #262626;
    --text-muted: #525252;
    --field-bg: rgba(255, 255, 255, 0.9);
    --field-border: #a3a3a3;
    --accent: #0f766e;
    --accent-hover: #115e59;
    --secondary: #1d4ed8;
    --secondary-hover: #1e40af;
    --toggle-bg: rgba(245, 245, 245, 0.9);
    --toggle-border: rgba(115, 115, 115, 0.28);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body.dark-theme {
    --page-bg:
        radial-gradient(circle at top left, rgba(64, 64, 64, 0.16), transparent 24%),
        radial-gradient(circle at top right, rgba(82, 82, 82, 0.14), transparent 24%),
        linear-gradient(180deg, #121212 0%, #1c1c1c 44%, #262626 100%);
    --shell-bg: rgba(24, 24, 27, 0.84);
    --shell-border: rgba(115, 115, 115, 0.2);
    --shell-shadow: 0 28px 70px rgba(0, 0, 0, 0.46);
    --text-main: #e5e5e5;
    --text-muted: #a3a3a3;
    --field-bg: rgba(38, 38, 38, 0.86);
    --field-border: #525252;
    --accent: #10b981;
    --accent-hover: #059669;
    --secondary: #3b82f6;
    --secondary-hover: #2563eb;
    --toggle-bg: rgba(38, 38, 38, 0.9);
    --toggle-border: rgba(115, 115, 115, 0.24);
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background: var(--page-bg);
    color: var(--text-main);
    transition: background 0.25s ease, color 0.25s ease;
}

body.signature-page-open {
    margin: 0;
    background: #ffffff;
}

.container {
    width: min(100%, 860px);
    max-width: 860px;
    margin: 72px auto 0;
    background: var(--shell-bg);
    padding: 28px;
    border: 1px solid var(--shell-border);
    border-radius: 24px;
    box-shadow: var(--shell-shadow);
    backdrop-filter: blur(14px);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

h1, h2 {
    color: var(--text-main);
}

.container > h1 {
    margin-top: 0;
    margin-bottom: 28px;
    font-size: 36px;
    letter-spacing: 0.4px;
}

form {
    margin-bottom: 20px;
}

form h2 {
    margin-top: 26px;
    margin-bottom: 12px;
    font-size: 20px;
}

label {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-weight: 600;
}

input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    background: var(--field-bg);
    color: var(--text-main);
    box-sizing: border-box;
}

input[type="file"] {
    padding: 10px 12px;
}

#blueFormColor {
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

#blueFormColor::-webkit-color-swatch-wrapper {
    padding: 0;
}

#blueFormColor::-webkit-color-swatch {
    border: none;
    border-radius: 7px;
}

#blueFormColor::-moz-color-swatch {
    border: none;
    border-radius: 7px;
}

select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    background: var(--field-bg);
    color: var(--text-main);
    box-sizing: border-box;
}

button {
    background-color: var(--accent);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

button:hover,
.action-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: auto;
    max-width: 100%;
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: white;
    background-color: var(--accent);
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.file-action-button {
    overflow: hidden;
    touch-action: manipulation;
    margin-bottom: 0;
}

.file-action-button input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

#downloadPdfBtn {
    margin-left: 10px;
    background-color: var(--secondary);
}

#downloadPdfBtn:hover {
    background-color: var(--secondary-hover);
}

#sharePdfBtn {
    margin-left: 10px;
    background-color: #7c3aed;
}

#sharePdfBtn:hover {
    background-color: #6d28d9;
}

#removeLogoBtn {
    margin-top: 6px;
    background-color: #b45309;
}

#removeLogoBtn:hover {
    background-color: #92400e;
}

.secondary-button,
#takePhotoBtn,
#choosePhotoBtn {
    background-color: var(--secondary);
    color: white;
}

.secondary-button:hover,
#takePhotoBtn:hover,
#choosePhotoBtn:hover {
    background-color: var(--secondary-hover);
}

#removePhotoBtn {
    background-color: #b45309;
}

#removePhotoBtn:hover {
    background-color: #92400e;
}

.floating-actions {
    position: fixed;
    top: 22px;
    right: 24px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

#themeToggle,
#homeShortcutBtn,
#generateShortcutBtn {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--toggle-border);
    background: var(--toggle-bg);
    color: var(--text-main);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(14px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#generateShortcutBtn {
    background: var(--accent);
    border-color: transparent;
    color: #ffffff;
}

.floating-icon {
    font-size: 24px;
    line-height: 1;
}

#themeToggle:hover,
#homeShortcutBtn:hover,
#generateShortcutBtn:hover {
    background: var(--toggle-bg);
    color: var(--text-main);
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.75);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.bill-of-sale {
    position: relative;
    margin-top: 28px;
    padding: 42px 36px 28px;
    display: none;
    background:
        linear-gradient(180deg, rgba(191, 167, 106, 0.12), rgba(191, 167, 106, 0.02) 90px),
        #fffdf8;
    border: 2px solid #2f2a23;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.document-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 18px;
    align-items: start;
    margin-bottom: 20px;
}

.document-heading {
    min-width: 0;
}

.bill-of-sale.logo-left .document-header {
    grid-template-columns: 130px minmax(0, 1fr);
}

.bill-of-sale.logo-left .document-logo-wrap {
    order: 1;
    justify-content: flex-start;
}

.bill-of-sale.logo-left .document-heading {
    order: 2;
}

.bill-of-sale.logo-hidden .document-header {
    grid-template-columns: minmax(0, 1fr);
}

.document-logo-wrap {
    width: 130px;
    min-height: 78px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    overflow: hidden;
}

.document-logo-wrap img {
    max-width: 100%;
    max-height: 78px;
    object-fit: contain;
}

.bill-of-sale.logo-size-small .document-header {
    grid-template-columns: minmax(0, 1fr) 100px;
}

.bill-of-sale.logo-size-small.logo-left .document-header {
    grid-template-columns: 100px minmax(0, 1fr);
}

.bill-of-sale.logo-size-small .document-logo-wrap {
    width: 100px;
    min-height: 56px;
}

.bill-of-sale.logo-size-small .document-logo-wrap img {
    max-height: 56px;
}

.bill-of-sale.logo-size-medium .document-header {
    grid-template-columns: minmax(0, 1fr) 130px;
}

.bill-of-sale.logo-size-medium.logo-left .document-header {
    grid-template-columns: 130px minmax(0, 1fr);
}

.bill-of-sale.logo-size-medium .document-logo-wrap {
    width: 130px;
    min-height: 78px;
}

.bill-of-sale.logo-size-medium .document-logo-wrap img {
    max-height: 78px;
}

.bill-of-sale.logo-size-large .document-header {
    grid-template-columns: minmax(0, 1fr) 170px;
}

.bill-of-sale.logo-size-large.logo-left .document-header {
    grid-template-columns: 170px minmax(0, 1fr);
}

.bill-of-sale.logo-size-large .document-logo-wrap {
    width: 170px;
    min-height: 96px;
}

.bill-of-sale.logo-size-large .document-logo-wrap img {
    max-height: 96px;
}

.bill-of-sale::before {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    border: 1px solid #bfa76a;
    pointer-events: none;
}

.bill-of-sale::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    left: 18px;
    border: 1px solid rgba(47, 42, 35, 0.35);
    pointer-events: none;
}

.bill-of-sale h1,
.bill-of-sale h2,
.bill-of-sale p,
.bill-of-sale div {
    position: relative;
    z-index: 1;
}

.bill-of-sale h1 {
    margin: 0;
    padding-bottom: 14px;
    border-bottom: 2px solid #bfa76a;
    font-family: "Times New Roman", Georgia, serif;
    font-size: 34px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: #1f1a14;
}

.bill-of-sale h2 {
    margin: 24px 0 10px;
    padding: 0 0 6px;
    border-bottom: 1px solid #d8c79a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #5a4722;
}

.bill-of-sale p {
    margin: 8px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    line-height: 1.45;
    color: #231f1a;
}

.bill-of-sale strong {
    color: #15120e;
}

.doc-section {
    position: relative;
    z-index: 1;
}

.document-photo-section {
    position: relative;
    z-index: 1;
    margin-top: 22px;
}

.document-photo-section.photo-hidden {
    display: none;
}

.document-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.document-photo-wrap {
    border: 1px solid rgba(106, 90, 54, 0.28);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.document-photo-wrap img {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.document-photo-section.photo-size-small .document-photo-grid {
    grid-template-columns: 1fr;
}

.document-photo-section.photo-size-small .document-photo-wrap img {
    max-height: 180px;
}

.document-photo-section.photo-size-medium .document-photo-wrap img {
    max-height: 280px;
}

.document-photo-section.photo-size-large .document-photo-grid {
    grid-template-columns: 1fr;
}

.document-photo-section.photo-size-large .document-photo-wrap img {
    max-height: 420px;
}

.legal-copy {
    margin-top: 18px;
}

.signatures {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-top: 40px;
    gap: 28px;
}

.signatures > .signature-block {
    flex: 1 1 0;
    min-width: 0;
}

.signature-block {
    display: flex;
    flex-direction: column;
}

.signature-image-wrap {
    width: 100%;
    min-height: 56px;
    border-bottom: 1px solid rgba(106, 90, 54, 0.55);
    margin-bottom: 10px;
    display: flex;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.96);
    padding-right: 6px;
}

.signature-image-wrap img {
    max-width: 100%;
    max-height: 52px;
    object-fit: contain;
}

.signature-block span {
    display: inline-block;
    min-width: 120px;
}

.signature-btn {
    align-self: flex-start;
    margin-top: 8px;
    padding: 8px 14px;
    font-size: 14px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.bill-of-sale .signatures p:nth-child(2),
.bill-of-sale .signatures p:nth-child(3) {
    font-size: 14px;
}

.document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(106, 90, 54, 0.4);
}

.bill-of-sale.blue-form-style {
    --blue-form-accent: #234f98;
    --blue-form-border: #3560a8;
    --blue-form-shadow: rgba(15, 41, 88, 0.08);
    padding: 36px 34px 28px;
    background: white;
    border: 1px solid var(--blue-form-border);
    box-shadow: 0 10px 30px var(--blue-form-shadow);
}

.bill-of-sale.blue-form-style::before,
.bill-of-sale.blue-form-style::after {
    display: none;
}

.bill-of-sale.blue-form-style h1 {
    border-bottom: none;
    padding-bottom: 0;
    font-family: Arial, sans-serif;
    font-size: 24px;
    text-align: left;
    letter-spacing: 0.4px;
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style h2 {
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--blue-form-border);
    background: var(--blue-form-accent);
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    color: white;
}

.bill-of-sale.blue-form-style .doc-section {
    margin-top: 18px;
}

.bill-of-sale.blue-form-style .document-photo-wrap {
    border: 1px solid var(--blue-form-border);
    border-radius: 0;
    padding: 10px;
    background: #ffffff;
}

.bill-of-sale.blue-form-style .document-photo-wrap img {
    border-radius: 0;
}

.bill-of-sale.blue-form-style .doc-section p {
    margin: 0;
    padding: 6px 10px;
    border-right: 1px solid var(--blue-form-border);
    border-bottom: 1px solid var(--blue-form-border);
    border-left: 1px solid var(--blue-form-border);
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.35;
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style > p:first-of-type {
    margin: 0 0 10px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style .legal-copy {
    margin-top: 18px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style strong {
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style .signatures {
    gap: 16px;
    margin-top: 28px;
}

.bill-of-sale.blue-form-style .signatures > .signature-block {
    flex: 1 1 0;
    border: 1px solid var(--blue-form-border);
    padding-top: 44px;
}

.bill-of-sale.blue-form-style .signature-image-wrap {
    border-bottom: 1px solid var(--blue-form-border);
    margin: 0 10px 8px;
}

.bill-of-sale.blue-form-style .signatures p {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--blue-form-accent);
}

.bill-of-sale.blue-form-style .signatures p:nth-child(2) {
    padding: 8px 10px;
    background: var(--blue-form-accent);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    color: white;
    letter-spacing: 0;
}

.bill-of-sale.blue-form-style .signatures p:nth-child(3) {
    padding: 8px 10px 0;
    font-size: 12px;
}

.bill-of-sale.blue-form-style .document-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--blue-form-border);
}

.print-help {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.custom-template-builder {
    margin: 22px 0 8px;
    padding: 18px;
    border: 1px solid var(--shell-border);
    border-radius: 16px;
    background: rgba(148, 163, 184, 0.08);
}

.custom-field-rows {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.custom-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.custom-field-options {
    display: grid;
    gap: 8px;
}

.custom-field-options button {
    min-width: 92px;
    margin-top: 0;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    white-space: nowrap;
}

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

.custom-template-status {
    min-height: 20px;
    margin-top: 12px;
    color: var(--text-muted);
}

.photo-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 4px 0 6px;
    align-items: stretch;
}

.photo-preview-section {
    margin: 10px 0 6px;
    padding: 12px;
    border: 1px solid var(--field-border);
    border-radius: 16px;
    background: var(--field-bg);
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.photo-preview-grid .document-photo-wrap img {
    max-height: 220px;
}

.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 12px;
}

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

.signature-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(2, 8, 23, 0.72);
}

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

.signature-modal.ios-signature-mode {
    position: fixed;
    inset: 0;
    min-height: 100dvh;
    display: block;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

.signature-modal.ios-signature-mode .signature-modal-panel {
    width: 100%;
    max-height: none;
    min-height: 100dvh;
    margin: 0;
    padding: 14px;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.signature-modal.ios-signature-mode .signature-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 10px;
    background: #ffffff;
}

.signature-modal.ios-signature-mode .signature-modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #ffffff;
}

.signature-modal.ios-signature-mode .signature-canvas-wrap {
    min-height: 180px;
}

.signature-modal.ios-signature-mode #signatureCanvas {
    height: 180px;
}

.signature-modal-panel {
    width: min(720px, 100%);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
    scrollbar-gutter: stable;
}

.signature-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.signature-modal-header h2 {
    margin: 0;
    color: #172033;
}

.signature-modal-help {
    margin: 0 0 14px;
    color: #475569;
}

.signature-canvas-wrap {
    min-height: 180px;
    border: 2px dashed #94a3b8;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
}

#signatureCanvas {
    width: 100%;
    height: 260px;
    display: block;
    touch-action: none;
    background: #ffffff;
}

.signature-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    background: #ffffff;
}

@media (max-width: 768px) {
    body {
        margin: 14px;
    }

    .container {
        margin-top: 78px;
        width: 100%;
        padding: 18px 14px;
        border-radius: 18px;
    }

    .container > h1 {
        margin-bottom: 22px;
        font-size: 30px;
        line-height: 1.15;
    }

    form h2 {
        margin-top: 22px;
        font-size: 18px;
    }

    button,
    #downloadPdfBtn,
    #sharePdfBtn {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }

    .document-actions {
        display: block;
    }

    .floating-actions {
        top: 14px;
        right: 14px;
    }

    #themeToggle,
    #homeShortcutBtn,
    #generateShortcutBtn {
        width: 46px;
        height: 46px;
        padding: 0;
    }

    .bill-of-sale {
        padding: 30px 20px 24px;
    }

    .document-header {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    .bill-of-sale.logo-left .document-header,
    .bill-of-sale.logo-size-small .document-header,
    .bill-of-sale.logo-size-medium .document-header,
    .bill-of-sale.logo-size-large .document-header {
        grid-template-columns: 1fr;
    }

    .document-logo-wrap {
        width: 110px;
        min-height: 64px;
        justify-content: flex-start;
    }

    .document-logo-wrap img {
        max-height: 64px;
    }

    .signatures {
        flex-direction: column;
        gap: 18px;
    }

    .signatures div,
    .bill-of-sale.blue-form-style .signatures div {
        width: 100%;
    }

    .custom-field-row {
        grid-template-columns: 1fr;
    }

    .photo-actions {
        grid-template-columns: 1fr;
    }

    .photo-actions button {
        width: 100%;
    }

    .photo-actions .action-button {
        width: 100%;
        justify-self: stretch;
    }

    .photo-preview-grid,
    .document-photo-grid {
        grid-template-columns: 1fr;
    }

    .custom-field-options button {
        width: 100%;
    }

    .signature-modal {
        display: block;
        padding: 12px;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .signature-modal-panel {
        width: 100%;
        max-height: none;
        margin: 0 auto;
        padding: 16px;
        border-radius: 18px;
        overflow: visible;
    }

    .signature-canvas-wrap {
        min-height: 160px;
    }

    #signatureCanvas {
        height: 220px;
    }

    .signature-modal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .signature-modal-actions {
        flex-direction: column;
    }

    .signature-modal-actions button,
    .signature-modal-header button {
        width: 100%;
    }
}

@media (max-height: 540px) {
    .signature-modal {
        display: block;
        padding-top: 10px;
        padding-bottom: 10px;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .signature-modal-panel {
        max-height: none;
        margin: 0 auto;
    }

    .signature-canvas-wrap {
        min-height: 120px;
    }

    #signatureCanvas {
        height: 160px;
    }
}

@media (max-width: 932px) and (orientation: landscape) {
    .signature-modal {
        display: block;
        padding: 8px;
        overflow-y: auto;
    }

    .signature-modal-panel {
        width: 100%;
        max-height: none;
        margin: 0 auto;
        padding: 14px;
        border-radius: 16px;
        overflow: visible;
    }

    .signature-modal-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 8px;
    }

    .signature-modal-help {
        margin-bottom: 8px;
        font-size: 14px;
    }

    .signature-canvas-wrap {
        min-height: 96px;
    }

    #signatureCanvas {
        height: 96px;
    }

    .signature-modal-actions {
        flex-direction: row;
        margin-top: 10px;
    }

    .signature-modal-actions button,
    .signature-modal-header button {
        width: auto;
        flex: 1;
    }
}

@media print {
    @page {
        margin: 0.35in;
    }

    body {
        margin: 0;
        background-color: white;
    }
    .container {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    .container > h1 {
        display: none;
    }
    #billForm, #generateBtn, #printBtn, #downloadPdfBtn, #sharePdfBtn, #printHelp, .signature-btn {
        display: none;
    }
    .bill-of-sale {
        display: flex !important;
        flex-direction: column;
        margin-top: 0;
        padding: 36px 26px 20px;
        background: #fffdf8;
        box-shadow: none;
        border-width: 1.5px;
        min-height: 9.9in;
        box-sizing: border-box;
        page-break-inside: avoid;
        font-size: 14px;
    }

    .bill-of-sale::before {
        top: 6px;
        right: 6px;
        bottom: 6px;
        left: 6px;
    }

    .bill-of-sale::after {
        top: 12px;
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    .bill-of-sale h1 {
        margin: 0;
        padding-bottom: 12px;
        font-size: 32px;
    }

    .document-header {
        grid-template-columns: minmax(0, 1fr) 120px;
        gap: 16px;
        margin-bottom: 18px;
    }

    .bill-of-sale.logo-hidden .document-header {
        grid-template-columns: minmax(0, 1fr);
    }

    .bill-of-sale h2 {
        margin: 18px 0 10px;
        font-size: 17px;
    }

    .document-photo-wrap img {
        max-height: 240px;
    }

    .bill-of-sale p {
        margin: 6px 0;
        font-size: 14px;
        line-height: 1.35;
    }

    .signatures {
        margin-top: 28px;
        gap: 24px;
    }

    .bill-of-sale .signatures {
        margin-top: auto;
        padding-top: 32px;
    }

    .bill-of-sale .signatures p:nth-child(2),
    .bill-of-sale .signatures p:nth-child(3) {
        font-size: 14px;
    }

    .bill-of-sale.blue-form-style {
        padding: 24px 22px 18px;
        border-width: 1px;
        min-height: 9.9in;
    }

    .document-logo-wrap {
        width: 120px;
        min-height: 70px;
    }

    .document-logo-wrap img {
        max-height: 70px;
    }

    .bill-of-sale.logo-size-small .document-header {
        grid-template-columns: minmax(0, 1fr) 90px;
    }

    .bill-of-sale.logo-size-small.logo-left .document-header {
        grid-template-columns: 90px minmax(0, 1fr);
    }

    .bill-of-sale.logo-size-small .document-logo-wrap {
        width: 90px;
        min-height: 54px;
    }

    .bill-of-sale.logo-size-small .document-logo-wrap img {
        max-height: 54px;
    }

    .bill-of-sale.logo-size-large .document-header {
        grid-template-columns: minmax(0, 1fr) 150px;
    }

    .bill-of-sale.logo-size-large.logo-left .document-header {
        grid-template-columns: 150px minmax(0, 1fr);
    }

    .bill-of-sale.logo-size-large .document-logo-wrap {
        width: 150px;
        min-height: 84px;
    }

    .bill-of-sale.logo-size-large .document-logo-wrap img {
        max-height: 84px;
    }

    .bill-of-sale.blue-form-style h1 {
        font-size: 27px;
    }

    .bill-of-sale.blue-form-style h2 {
        font-size: 16px;
    }

    .bill-of-sale.blue-form-style .doc-section {
        margin-top: 14px;
    }

    .bill-of-sale.blue-form-style .doc-section p,
    .bill-of-sale.blue-form-style > p:first-of-type,
    .bill-of-sale.blue-form-style .legal-copy {
        font-size: 13px;
    }

    .bill-of-sale.blue-form-style .signatures {
        margin-top: auto;
        gap: 16px;
    }

    .bill-of-sale.blue-form-style .signatures div {
        padding-top: 52px;
    }

    .bill-of-sale.blue-form-style .signatures p:nth-child(2) {
        font-size: 14px;
    }

    .bill-of-sale.blue-form-style .signatures p:nth-child(3) {
        font-size: 12px;
    }
}
