/* Classic/base layer: shared tokens, Bootstrap compatibility, shell, dashboard,
   navigation/tree, detail/forms, invoice/print and PhotoViewer. The additive
   modern.css layer loads after this file; removing it restores this presentation. */
/* 1. Theme tokens, Bootstrap compatibility and request feedback. */
:root {
    --bg-darkest: #0d1117;
    --bg-dark: #161b22;
    --bg-darker: #1a1f26;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    
    --repair-price: #2e8b57;
    --repair-status-pending: #6c757d;
    --repair-status-in-progress: #ffc107;
    --repair-status-done: #28a745;
    --repair-type-labor: #5ca0d3;
    --repair-type-labor-no-vat: #e0ad68;
    --repair-type-part: #4169e1;
}

[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-darkest);
    --bs-body-color: var(--text-primary);
    --bs-secondary-bg: var(--bg-dark);
    --bs-tertiary-bg: var(--bg-darker);
    --bs-border-color: var(--border-color);
    --bs-link-color: var(--accent-blue);
}

.backend-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1090;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--accent-blue);
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
    font-size: 1rem;
    pointer-events: none;
}

.backend-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent-blue);
}

.backend-loading[hidden] {
    display: none;
}

@media print {
    .backend-loading { display: none; }
}

.bg-dark {
    background-color: var(--bg-dark) !important;
}

.bg-darker {
    background-color: var(--bg-darker) !important;
}

.border-secondary {
    border-color: var(--border-color) !important;
}

.card, .modal-content {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
}

.form-control, .form-select {
    background-color: var(--bg-darker);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-darker);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(88, 166, 255, 0.25);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.input-group-text {
    background-color: var(--bg-darker);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.list-group-item {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
    transition: background-color 0.15s ease;
}

.list-group-item:hover {
    background-color: var(--bg-darker);
}

.list-group-item.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.sidebar {
    background-color: var(--bg-dark) !important;
    overflow-y: auto;
}

/* 2. Classic application shell and recent-activity dashboard. */
html {
    height: 100%;
}

body.app-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

body.app-layout > nav.navbar {
    flex: 0 0 auto;
}

body.app-layout > .container-fluid {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.app-layout .container-fluid > .row {
    flex: 1 1 auto;
    min-height: 0;
}

body.app-layout .sidebar {
    display: flex;
    flex-direction: column;
    height:100%;
    min-height: 0;
    overflow: auto;
}

#customerTree {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

body.app-layout main.col-md-9,
body.app-layout main.col-lg-9 {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}

.dashboard-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.12), rgba(63, 185, 80, 0.06));
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.recent-cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}

.recent-car-card {
    width: 100%;
    color: var(--text-primary);
    appearance: none;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.recent-car-card:hover,
.recent-car-card:focus-visible {
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.recent-car-card:focus-visible {
    outline: 3px solid rgba(88, 166, 255, 0.35);
    outline-offset: 2px;
}

.recent-car-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.recent-car-meta > div {
    min-width: 0;
    display: grid;
    grid-template-rows: 2.5rem auto;
    align-content: start;
}

.recent-car-meta > div > .small {
    line-height: 1.25rem;
}

.recent-car-meta > div > span:not(.small) {
    min-height: 2.5rem;
    line-height: 1.25rem;
}

.recent-car-repair {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.recent-car-open {
    display: block;
    color: var(--accent-blue);
    font-weight: 600;
}

.dashboard-empty {
    background-color: var(--bg-dark);
    border: 1px dashed var(--border-color);
    border-radius: 0.75rem;
}

@media (max-width: 575.98px) {
    .recent-car-meta {
        grid-template-columns: 1fr 1fr;
    }

    .recent-car-meta > div {
        grid-template-rows: auto auto;
    }
}

/* 3. Customer navigation tree and search feedback. */
.tree-item {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.tree-item:hover {
    background-color: var(--bg-darker);
}

.tree-item.active {
    background-color: rgba(88, 166, 255, 0.15);
    border-left: 3px solid var(--accent-blue);
}

.search-results-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.25rem 0.65rem;
}

.search-match {
    color: inherit;
    background: rgba(210, 153, 34, 0.45);
    border-radius: 0.2rem;
    padding: 0 0.1rem;
}

.branch-feedback {
    padding: 0.25rem 0.75rem;
}

.branch-skeletons {
    display: grid;
    gap: 0.35rem;
}

.branch-skeleton {
    display: block;
    height: 1.6rem;
    border-radius: 0.3rem;
    background: linear-gradient(90deg, rgba(139,148,158,0.08), rgba(139,148,158,0.2), rgba(139,148,158,0.08));
    background-size: 200% 100%;
    animation: branch-skeleton-pulse 1.2s ease-in-out infinite;
}

.branch-skeleton:nth-child(2) { width: 78%; }

@keyframes branch-skeleton-pulse {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.tree-toggle {
    cursor: pointer;
    padding: 0.25rem;
    margin-right: 0.25rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-children {
    margin-left: 1.5rem;
    border-left: 1px solid var(--border-color);
    padding-left: 0.5rem;
}

.tree-car {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tree-car:hover {
    color: var(--text-primary);
}

.tree-car.active {
    color: var(--accent-green);
}

.tree-group {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tree-group:hover {
    color: var(--text-primary);
}

.tree-group.active {
    color: var(--accent-blue);
}

.tree-repair {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
}

.tree-repair:hover {
    color: var(--text-primary);
}

.tree-repair.active {
    color: var(--accent-yellow);
}

.tree-repair .status-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
}

/* 4. Detail workspace, repair editor and visit totals. */
.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--bg-darker);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.breadcrumb-sep {
    color: var(--text-secondary);
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.breadcrumb-current {
    color: var(--accent-blue);
    font-weight: 500;
}

.detail-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.detail-section {
    background-color: var(--bg-dark);
    border-radius: 8px;
    padding: 0.4rem;
    margin-bottom: 1rem;
}

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

.info-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item p {
    margin-bottom: 0;
    font-size: 1rem;
}

.info-item .form-control-sm {
    max-width: 140px;
}

.visit-total {
    color: var(--repair-price);
    font-weight: 500;
}

.status-pending {
    color: var(--accent-yellow);
}

.status-in_progress {
    color: var(--accent-blue);
}

.status-done {
    color: var(--accent-green);
}

.btn-primary {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.btn-primary:hover {
    background-color: #4c9aff;
    border-color: #4c9aff;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--bg-darker);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.toast {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
}

.toast .toast-body {
    color: var(--text-primary);
}

.spinner-border {
    color: var(--accent-blue);
}

.empty-state {
    color: var(--text-secondary);
}

.price-display {
    font-weight: 600;
    color: var(--accent-green);
}

.repair-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    container: repair-list / inline-size;
}

.repair-item {
    padding: 8px 12px;
    background-color: var(--bg-darker);
    border-radius: 6px;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    container-type: inline-size;
}

.repair-item:hover {
    background-color: rgba(88, 166, 255, 0.08);
}

.repair-type {
    flex-shrink: 0;
}

.repair-type select {
    width: 60px;
}

.app-select {
    position: relative;
    display: block;
    min-width: 0;
}

.app-select-toggle {
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-select-menu {
    top: calc(100% + 0.2rem);
    left: 0;
    min-width: 100%;
    max-height: 14rem;
    overflow-y: auto;
    z-index: 1060;
}

.repair-type .app-select-toggle {
    width: 92px;
}

.repair-type select option {
    color: #fff;
}

.repair-type select:has(option[value="labor"]:checked) {
    color: var(--repair-type-labor);
}

.repair-type select:has(option[value="part"]:checked) {
    color: var(--repair-type-part);
}

.repair-type-labor .app-select-toggle { color: var(--repair-type-labor); }
.repair-type-part .app-select-toggle { color: var(--repair-type-part); }
.repair-type-labor_no_vat .app-select-toggle {
    width: max-content;
    color: var(--repair-type-labor-no-vat);
    font-size: 0.75rem;
}

.repair-description {
    flex: 1;
    min-width: 100px;
}

.repair-description input {
    width: 100%;
}

.repair-suggestions {
    width: 100%;
    min-width: 0;
    max-height: 12rem;
    overflow-y: auto;
    z-index: 1050;
}

.repair-quantity {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.repair-quantity input {
    width: 35px;
    text-align: center;
}

.repair-list-price,
.repair-unit-price,
.repair-discount,
.repair-price {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Retain list-price data and save semantics while keeping the optional field out of the active UI. */
.repair-list-price {
    display: none;
}

.price-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #f8fafc;
    flex-shrink: 0;
    margin-right: 0.2rem;
    max-width: 3.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repair-list-price input,
.repair-unit-price input {
    width: 72px;
    text-align: right;
}

.repair-discount input {
    width: 40px;
    text-align: right;
}

.repair-price {
    color: var(--repair-price);
    justify-self: start;
    width: max-content;
    white-space: nowrap;
}

.final-price-display {
    font-weight: bold;
    width: auto;
    text-align: left;
}

.repair-quantity input::-webkit-outer-spin-button,
.repair-quantity input::-webkit-inner-spin-button,
.repair-list-price input::-webkit-outer-spin-button,
.repair-list-price input::-webkit-inner-spin-button,
.repair-unit-price input::-webkit-outer-spin-button,
.repair-unit-price input::-webkit-inner-spin-button,
.repair-discount input::-webkit-outer-spin-button,
.repair-discount input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.repair-quantity input[type=number],
.repair-list-price input[type=number],
.repair-unit-price input[type=number],
.repair-discount input[type=number] {
    -moz-appearance: textfield;
}

.repair-item select,
.repair-item input {
    color: inherit;
    cursor: pointer;
}

.repair-item select {
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
    padding-right: 8px;
}

.repair-actions {
    flex-shrink: 0;
    display: flex;
}

.repair-save-state {
    width: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.repair-save-icon {
    width: 2rem;
    min-height: 2rem;
    display: grid;
    place-items: center;
}

.repair-save-state .spinner-border,
.branch-refreshing .spinner-border {
    width: 0.75rem;
    height: 0.75rem;
    border-width: 0.12em;
}

/* Reflow by available workspace width, including narrow desktop panes. */
@container repair-list (max-width: 640px) {
    .repair-item {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .repair-type {
        grid-column: 1 / -1;
    }

    .repair-description {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .repair-unit-price,
    .repair-quantity,
    .repair-discount {
        grid-column: span 2;
        min-width: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .repair-unit-price input,
    .repair-quantity input,
    .repair-discount input {
        width: 100%;
        min-width: 0;
    }

    .repair-price {
        grid-column: 1 / 5;
    }

    .repair-save-state,
    .repair-actions {
        justify-self: end;
    }
}

.currency-symbol {
    color: var(--text-secondary);
    margin-right: 0.2rem;
}

.cost-breakdown {
    display: flex;
    gap: 24px;
    padding: 8px 0;
}

.cost-item {
    display: flex;
    gap: 4px;
    align-items: center;
}

.cost-item .text-secondary {
    font-size: 0.75rem;
    text-transform: uppercase;
}

.cost-item .price-display {
    font-size: 1rem;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
    
    .sidebar.show {
        display: block !important;
        max-height: 40vh;
        overflow-y: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }
}

/* 5. Retained legacy visit table and status presentation. */
#dbModeToggle .btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

#dbModeToggle .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.car-repairs-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.car-repairs-table td {
    padding: 4px 8px;
    vertical-align: middle;
}

.car-repairs-table .col-type {
    width: 60px;
}

.car-repairs-table .col-desc {
    color: var(--text-primary);
}

.car-repairs-table .col-status {
    width: 80px;
    text-align: center;
}

.car-repairs-table .col-price {
    width: 80px;
    text-align: right;
    color: var(--repair-price);
}

.car-repairs-table .col-type {
    width: 60px;
}

.car-repairs-table .col-type.type-labor {
    color: var(--repair-type-labor);
}

.car-repairs-table .col-type.type-part {
    color: var(--repair-type-part);
}

.car-repairs-table .col-status {
    width: 120px;
    text-align: center;
}

.car-repairs-table .col-status.status-pending {
    color: var(--repair-status-pending);
}

.car-repairs-table .col-status.status-in_progress {
    color: var(--repair-status-in-progress);
}

.car-repairs-table .col-status.status-done {
    color: var(--repair-status-done);
}

.car-repairs-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--border-color);
}

.visit-card-total {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    font-size: 0.875rem;
}

/* 6. Invoice preview, responsive print table and print-only document. */
#printPreviewModal .modal-body {
    background-color: #f5f5f5;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.print-document {
    background: white;
    padding: 40px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: #333;
    min-height: 600px;
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

.print-company {
    font-size: 28px;
    font-weight: bold;
    color: #1a1a1a;
    letter-spacing: 1px;
}

.print-header-right {
    text-align: right;
}

.print-title {
    font-size: 20px;
    color: #666;
    margin-bottom: 5px;
}

.print-date {
    color: #888;
    font-size: 14px;
}

.print-info {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.print-info-row {
    display: flex;
    margin-bottom: 8px;
}

.print-label {
    font-weight: 600;
    width: 100px;
    flex-shrink: 0;
    color: #555;
}

.print-value {
    color: #333;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.print-table-scroll {
    max-width: 100%;
}

.print-table th {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid #333;
    font-weight: bold;
    background-color: #fafafa;
}

.print-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
}

.print-table .text-end {
    text-align: right;
}

.print-table .text-center {
    text-align: center;
}

.print-totals {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
}

.print-total-row {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 8px;
}

.print-total-row .print-label {
    width: auto;
    text-align: right;
}

.print-total-row .print-value {
    width: 120px;
    text-align: right;
    font-weight: 500;
}

.print-total-final {
    font-size: 18px;
    font-weight: bold;
    color: #1a1a1a;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 2px solid #333;
}

.print-total-final .print-value {
    font-size: 20px;
}

@media (max-width: 575.98px) {
    #printPreviewModal .modal-dialog {
        margin: 0.5rem;
    }

    #printPreviewModal .modal-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    #printPreviewModal .modal-header > div {
        width: 100%;
        flex-wrap: wrap;
    }

    #printPreviewModal .modal-body {
        overflow-x: hidden;
    }

    #printPreviewModal .print-document {
        min-width: 0;
        padding: 1rem;
    }

    #printPreviewModal .print-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    #printPreviewModal .print-header-right {
        text-align: left;
    }

    #printPreviewModal .print-info-row {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    #printPreviewModal .print-info-row .print-label {
        width: 100%;
    }

    #printPreviewModal .print-table-scroll {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    #printPreviewModal .print-table {
        min-width: 38rem;
    }
}

@media print {
    body > * {
        display: none !important;
    }

    body.app-layout {
        display: block;
        height: auto;
        overflow: visible;
    }
    
    #printContainer {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        padding: 40px;
        font-family: 'Segoe UI', Arial, sans-serif;
        font-size: 14px;
        color: #333;
    }
    
    #printContainer .print-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #333;
    }
    
    #printContainer .print-company {
        font-size: 28px;
        font-weight: bold;
        color: #1a1a1a;
        letter-spacing: 1px;
    }
    
    #printContainer .print-header-right {
        text-align: right;
    }
    
    #printContainer .print-title {
        font-size: 20px;
        color: #666;
        margin-bottom: 5px;
    }
    
    #printContainer .print-date {
        color: #888;
        font-size: 14px;
    }
    
    #printContainer .print-info {
        margin-bottom: 25px;
        padding-bottom: 15px;
        border-bottom: 1px solid #ddd;
    }
    
    #printContainer .print-info-row {
        display: flex;
        margin-bottom: 8px;
    }
    
    #printContainer .print-label {
        font-weight: 600;
        width: 100px;
        flex-shrink: 0;
        color: #555;
    }
    
    #printContainer .print-value {
        color: #333;
    }
    
    #printContainer .print-table {
        width: 100%;
        min-width: 0;
        border-collapse: collapse;
        margin-bottom: 25px;
    }

    #printContainer .print-table-scroll {
        max-width: none;
        overflow: visible;
    }
    
    #printContainer .print-table th {
        text-align: left;
        padding: 12px 8px;
        border-bottom: 2px solid #333;
        font-weight: bold;
        background-color: #fafafa;
    }
    
    #printContainer .print-table td {
        padding: 10px 8px;
        border-bottom: 1px solid #eee;
    }
    
    #printContainer .print-table .text-end {
        text-align: right;
    }
    
    #printContainer .print-table .text-center {
        text-align: center;
    }
    
    #printContainer .print-totals {
        text-align: right;
        margin-top: 20px;
        padding-top: 15px;
    }
    
    #printContainer .print-total-row {
        display: flex;
        justify-content: flex-end;
        gap: 20px;
        margin-bottom: 8px;
    }
    
    #printContainer .print-total-row .print-label {
        width: auto;
        text-align: right;
    }
    
    #printContainer .print-total-row .print-value {
        width: 120px;
        text-align: right;
        font-weight: 500;
    }
    
    #printContainer .print-total-final {
        font-size: 18px;
        font-weight: bold;
        color: #1a1a1a;
        padding-top: 10px;
        margin-top: 10px;
        border-top: 2px solid #333;
    }
    
    #printContainer .print-total-final .print-value {
        font-size: 20px;
    }
    
    #printContainer .print-total-final .print-label {
        width: auto;
    }
}

/* 7. Visit photos and standalone PhotoViewer surfaces. */
.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-thumbnail {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--bg-darker);
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-thumbnail img:hover {
    transform: scale(1.05);
}

.photo-thumbnail .photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 2px 6px;
    font-size: 0.75rem;
}

.photo-thumbnail:hover .photo-delete {
    opacity: 1;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-darker);
}

.gallery-item .gallery-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item .gallery-img:hover {
    transform: scale(1.02);
}

.gallery-item .btn-danger {
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .btn-danger {
    opacity: 1;
}

#photoGalleryModal .modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#fullsizePhotoModal .modal-body {
    background-color: #000;
}
