body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.dark {
    color-scheme: dark;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Grid items must be allowed to shrink so tables/forms scroll inside cards instead of pushing the page wide */
.grid > * {
    min-width: 0;
}

/* Invoice sheet keeps A4 width; on narrow screens it scrolls inside its wrapper (see invoice pages) instead of breaking page layout */

/* Direct Billing side column: stacked on phones, Customer | Assessment side by
   side from tablets up, full-width bottom row on wide desktop (wrapper dissolves) */
.bill-side {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.bill-side > * {
    min-width: 0;
}
@media (min-width: 1024px) {
    .bill-side {
        grid-template-columns: 1fr 1fr;
    }
    .bill-side-summary {
        grid-column: span 2;
    }
}
@media (min-width: 1281px) {
    .bill-side {
        display: contents;
    }
    .bill-side-customer {
        grid-row-start: 3;
        grid-column-start: 1;
    }
    .bill-side-assessment {
        grid-row-start: 3;
        grid-column-start: 2;
        grid-column-end: span 2;
    }
    .bill-side-summary {
        grid-column-start: 3;
        grid-row-start: 1;
        grid-row-end: span 2;
    }
}

/* Sortable table headers (toggled by assets/ui.js) */
th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th[data-sort]:hover {
    color: #10b981;
}
th[data-sort]::after {
    content: '\21C5';
    margin-left: 4px;
    font-size: 0.75em;
    opacity: 0.4;
}
th[data-sort].sort-asc::after {
    content: '\25B2';
    opacity: 1;
    color: #10b981;
}
th[data-sort].sort-desc::after {
    content: '\25BC';
    opacity: 1;
    color: #10b981;
}

.invoice-a4 {
    width: 210mm;
    min-height: 297mm;
    margin-left: auto;
    margin-right: auto;
}

@page {
    size: A4;
    margin: 10mm;
}

@media print {
    .no-print {
        display: none !important;
    }
    body {
        background: #fff !important;
        padding: 0 !important;
    }
    .receipt,
    .invoice-a4 {
        box-shadow: none !important;
        margin: 0 !important;
        width: 100% !important;
        min-height: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    .invoice-a4 {
        font-size: 11px;
    }
    .invoice-a4 table {
        page-break-inside: auto;
    }
    .invoice-a4 tr {
        page-break-inside: avoid;
    }
}