/* Forklift / Atelier — 2026.10
   CSS-only skin for the existing application. No external fonts or libraries. */
:root {
    color-scheme: light;
    --ink: #202b26;
    --soft: #67736b;
    --forest: #173e32;
    --forest-hover: #225341;
    --accent: #bb9766;
    --bg: #f4f5f1;
    --paper: #fff;
    --line: #e0e5dd;
    --line-soft: #edf0ea;
    --radius: 12px;
    --sidebar: 236px;
    --focus: #327859;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
    font-synthesis: none;
    -webkit-text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    line-height: 1.5;
    background: var(--bg);
}

a {
    color: #296249;
    text-decoration: none;
    text-underline-offset: 3px;
}

a:hover {
    color: #173e32;
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 4px;
}

::selection {
    color: #173e32;
    background: #d6e7d7;
}

h1,
h2,
h3,
p {
    overflow-wrap: break-word;
}

h1,
h2,
h3 {
    font-weight: 650;
    color: var(--ink);
}

h1 {
    margin: 0 0 9px;
    font-size: clamp(27px, 2.6vw, 36px);
    line-height: 1.18;
    letter-spacing: -1.2px;
}

h2 {
    margin: 0 0 22px;
    font-size: 17px;
    line-height: 1.4;
    letter-spacing: -.35px;
}

h3 {
    margin: 0 0 18px;
    font-size: 15px;
    letter-spacing: -.2px;
}

p {
    margin: 0 0 16px;
}

strong {
    font-weight: 650;
}

/* Navigation / a fixed desktop rail, using the existing header markup. */
header {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 34px 18px 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--forest);
    color: #fff;
    border-right: 1px solid #123328;
    scrollbar-width: thin;
    scrollbar-color: #557061 transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 9px 31px;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 1.6px;
    line-height: 1.3;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 37px;
    height: 41px;
    flex: 0 0 37px;
    border: 1px solid #a2b39f;
    border-radius: 8px 8px 8px 0;
    background: transparent;
    color: #ecdfc4;
    font-size: 25px;
    font-weight: 450;
    letter-spacing: -2px;
}

.brand small {
    display: block;
    margin-top: 5px;
    color: #b2c4b7;
    font-size: 8px;
    font-weight: 550;
    letter-spacing: 1.7px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 22px;
    border-top: 1px solid #ffffff20;
}

nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #c7d6cb;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease;
}

nav a::before {
    content: '';
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    background: currentColor;
    opacity: .8;
    -webkit-mask: var(--nav-icon) center / 18px 18px no-repeat;
    mask: var(--nav-icon) center / 18px 18px no-repeat;
}

nav a:hover,
nav a:focus-visible {
    color: #fff;
    background: #ffffff0d;
    text-decoration: none;
}

nav a[href='?page=dashboard'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='round'%3E%3Cpath d='M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z'/%3E%3C/svg%3E");
}

nav a[href='?page=forklifts'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 16V9h8v7M6 9V4h6l3 5v8M18 3v16h4M3 16h12'/%3E%3Ccircle cx='6' cy='18' r='2'/%3E%3Ccircle cx='13' cy='18' r='2'/%3E%3C/svg%3E");
}

nav a[href='?page=companies'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V4h11v17M15 10h5v11M2 21h20M8 8h3M8 12h3M8 16h3'/%3E%3C/svg%3E");
}

nav a[href='?page=maintenance'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 6a5 5 0 0 0-6 6L3 17a2.8 2.8 0 0 0 4 4l5-5a5 5 0 0 0 6-6l-4 3-3-3 3-4Z'/%3E%3C/svg%3E");
}

nav a[href='?page=rentals'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M4 11h16M8 15h3M14 15h2'/%3E%3C/svg%3E");
}

nav a[href='?page=invoices'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5'/%3E%3C/svg%3E");
}

nav a[href='?page=reports'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3v18h17M8 16v-5M13 16V6M18 16V9'/%3E%3C/svg%3E");
}

nav a[href='?page=users'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='7' r='3'/%3E%3Cpath d='M3 21v-3a6 6 0 0 1 12 0v3M16 4a3 3 0 0 1 0 6M18 13a5 5 0 0 1 3 5v3'/%3E%3C/svg%3E");
}

nav a[href='?page=audit'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11a9 9 0 1 1 2 7M3 5v6h6M12 7v5l3 2'/%3E%3C/svg%3E");
}

nav a[href='?page=notifications'] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9M10 21h4'/%3E%3C/svg%3E");
}

/* Infer current sections from existing form markup; no PHP/JS changes required. */
body:has(main > .page-heading + .grid) nav a[href='?page=dashboard'],
body:has(main input[name='action'][value='forklift']) nav a[href='?page=forklifts'],
body:has(main input[name='action'][value='company']) nav a[href='?page=companies'],
body:has(main input[name='action'][value='maintenance']) nav a[href='?page=maintenance'],
body:has(main input[name='action'][value='rental'], main input[name='action'][value='rental_photos']) nav a[href='?page=rentals'],
body:has(main .report-filter) nav a[href='?page=reports'],
body:has(main input[name='action'][value='user_add']) nav a[href='?page=users'],
nav a[aria-current='page'] {
    color: #f6f6ec;
    background: #ffffff12;
    border-color: #ffffff10;
    box-shadow: inset 2px 0 #d1b486;
}

header>div:last-child:not(.brand) {
    margin: auto 0 0 !important;
    padding: 24px 9px 0;
}

header form {
    margin: 0;
}

header button.secondary {
    width: 100%;
    min-height: 39px;
    padding: 9px 12px;
    justify-content: flex-start;
    color: #d2ded4;
    background: transparent;
    border: 1px solid #ffffff28;
    font-weight: 450;
}

header button.secondary::before {
    content: '↗';
    margin-right: 2px;
    font-size: 17px;
}

header button.secondary:hover {
    background: #ffffff0d;
    color: #fff;
    border-color: #ffffff50;
}

/* Main workspace */
main {
    width: calc(100% - var(--sidebar));
    max-width: 1640px;
    min-width: 0;
    min-height: calc(100vh - 65px);
    margin: 0 0 0 var(--sidebar);
    padding: 30px clamp(24px, 3.1vw, 54px) 42px;
}

.topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 37px;
    padding-bottom: 22px;
    margin-bottom: 35px;
    border-bottom: 1px solid var(--line);
    color: var(--soft);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.8px;
}

.topline span:last-child {
    font-size: 12px;
    font-weight: 450;
    letter-spacing: .3px;
    font-variant-numeric: tabular-nums;
}

.topline span:last-child::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 9px 2px 0;
    background: #668c66;
    border-radius: 50%;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    margin: 0 0 30px;
}

.eyebrow {
    margin: 0 0 11px;
    color: #7a684c;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: 1.65px;
}

.lead {
    margin: 0;
    color: var(--soft);
    font-size: 13px;
    line-height: 1.65;
}

main>h1 {
    margin: 0 0 30px;
}

.muted {
    color: var(--soft);
    font-size: 12px;
    line-height: 1.65;
}

.small {
    font-size: 12px;
}

footer {
    margin-left: var(--sidebar);
    padding: 20px 28px;
    border-top: 1px solid var(--line);
    color: #677360;
    font-size: 10px;
    letter-spacing: .35px;
    text-align: center;
}

/* Cards / calm surfaces and a deliberate numerical hierarchy */
.card {
    min-width: 0;
    margin: 0 0 24px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 2px 3px #23352302;
}

.card>p {
    line-height: 1.7;
}

.card>p:last-child {
    margin-bottom: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
    gap: 14px;
    margin: 0 0 28px;
}

.grid>.card {
    position: relative;
    min-height: 143px;
    padding: 22px 21px 20px;
    margin: 0;
    border-radius: 10px;
}

.grid>.card .muted {
    font-size: 11px;
    font-weight: 500;
}

.stat {
    margin-top: 20px;
    color: var(--forest);
    font-size: 42px;
    font-weight: 550;
    line-height: 1;
    letter-spacing: -1.8px;
    font-variant-numeric: tabular-nums lining-nums;
}

.stat.smaller {
    font-size: clamp(21px, 2.3vw, 30px);
    letter-spacing: -.8px;
    overflow-wrap: anywhere;
}

.grid>.card:first-child {
    background: var(--forest);
    border-color: var(--forest);
}

.grid>.card:first-child .muted {
    color: #c3d2c6;
}

.grid>.card:first-child .stat {
    color: #fff9eb;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px;
}

.two-col>.card {
    margin-bottom: 0;
}

.section-divider {
    height: 1px;
    background: var(--line);
    margin: 32px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 25px;
    font-size: 12px;
    font-weight: 550;
}

/* Tables */
.scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8d1c6 transparent;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.two-col table {
    min-width: 460px;
}

th,
td {
    padding: 16px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
}

th {
    padding-top: 12px;
    padding-bottom: 12px;
    background: #f5f7f2;
    color: #66715f;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: .65px;
    text-transform: uppercase;
}

th:first-child {
    border-radius: 6px 0 0 6px;
}

th:last-child {
    border-radius: 0 6px 6px 0;
}

td {
    max-width: 360px;
    color: #4c584e;
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: break-word;
}

td:first-child {
    color: #263d2d;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: 0;
}

tr:has(td):hover {
    background: #fafbf8;
}

td>a {
    font-weight: 550;
}

td>form {
    margin: 0;
}

td>p:last-child {
    margin-bottom: 0;
}

td details {
    min-width: 180px;
}

.table-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 210px;
}

.table-actions>a {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid #e3e8dd;
    border-radius: 5px;
    background: #fff;
    color: #405c46;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.5;
    text-decoration: none;
}

.table-actions>a:hover {
    border-color: #a9bca5;
    background: #f0f5ed;
}

.thumb {
    display: block;
    width: 70px;
    height: 53px;
    border: 1px solid #e0e6dc;
    border-radius: 6px;
    object-fit: cover;
    background: #eef1e9;
}

/* Forms / consistent rhythm and forgiving hit targets */
form {
    margin: 0;
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
    gap: 0 20px;
    align-items: start;
}

label {
    display: block;
    min-width: 0;
    margin: 0 0 22px;
    color: #465345;
    font-size: 12px;
    font-weight: 550;
    line-height: 1.5;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 43px;
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid #d8dfd3;
    border-radius: 6px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #a7b7a1;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #507c59;
    box-shadow: 0 0 0 3px #39744912;
}

input::placeholder,
textarea::placeholder {
    color: #6d7867;
    opacity: 1;
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #f2f4ee;
    color: #7e877a;
    cursor: not-allowed;
}

input[type='hidden'] {
    display: none;
}

input[type='date'] {
    color-scheme: light;
}

input[type='file'] {
    height: auto;
    min-height: 46px;
    padding: 5px;
    overflow: hidden;
    background: #fafbf8;
    font-size: 11px;
    font-weight: 400;
}

input[type='file']::file-selector-button {
    margin-right: 10px;
    padding: 7px 11px;
    border: 1px solid #d9e1d2;
    border-radius: 4px;
    background: #fff;
    color: #39533d;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

input[type='checkbox'],
input[type='radio'] {
    display: inline-block;
    width: 16px;
    min-height: 16px;
    height: 16px;
    margin: 0 6px 0 0;
    accent-color: var(--forest);
    vertical-align: middle;
}

textarea {
    min-height: 106px;
    resize: vertical;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 10px 17px;
    border: 1px solid var(--forest);
    border-radius: 6px;
    background: var(--forest);
    color: #fff;
    font-size: 12px;
    font-weight: 550;
    line-height: 1.5;
    letter-spacing: .05px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

button:hover,
.btn:hover {
    background: var(--forest-hover);
    border-color: var(--forest-hover);
    color: #fff;
    text-decoration: none;
}

button:active,
.btn:active {
    background: #102c23;
}

button:disabled {
    opacity: .55;
    cursor: wait;
}

button.secondary,
.btn.secondary {
    background: #fff;
    color: #41583e;
    border: 1px solid #d6dfcf;
}

button.secondary:hover,
.btn.secondary:hover {
    background: #f0f4eb;
    color: #233e27;
    border-color: #aebfa5;
}

td button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
}

form.inline {
    display: inline;
}

.inline-form,
.report-filter {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-form input {
    flex: 1 1 180px;
    min-width: 170px;
    width: auto;
    margin: 0;
}

.inline-form button {
    flex: 0 0 auto;
}

.report-filter label {
    flex: 1 1 135px;
    margin: 0;
}

.report-filter input,
.report-filter select {
    min-width: 0;
}

.report-filter>button {
    min-height: 43px;
}

.report-filter>a {
    align-self: center;
    font-size: 11px;
}

.report-filter+p {
    margin: 17px 0 0;
}

form>p[role='status'] {
    margin: 14px 0 0;
    color: #426744;
    font-size: 12px;
}

/* Details, finance and status */
details:not(.invoice-menu) {
    margin: 18px 0;
}

details:not(.invoice-menu)>summary {
    display: flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    padding: 4px 0;
    color: #335e3d;
    font-size: 12px;
    font-weight: 550;
    list-style: none;
    cursor: pointer;
}

details:not(.invoice-menu)>summary::-webkit-details-marker {
    display: none;
}

details:not(.invoice-menu)>summary::before {
    content: '+';
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border: 1px solid #d9e1d1;
    border-radius: 4px;
    color: #57734d;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
}

details[open]:not(.invoice-menu)>summary {
    margin-bottom: 20px;
}

details[open]:not(.invoice-menu)>summary::before {
    content: '−';
}

.card>details>summary {
    font-size: 15px;
}

td details>summary {
    font-size: 11px !important;
}

td details[open] p {
    margin: 9px 0;
    font-size: 12px;
}

.money-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 6px 0 27px;
    border: 1px solid #dfe6d8;
    border-radius: 8px;
    background: #f7f9f3;
    overflow: hidden;
}

.money-strip>div {
    min-width: 0;
    padding: 20px;
    border-right: 1px solid #e0e6d9;
}

.money-strip>div:last-child {
    border-right: 0;
}

.money-strip span {
    display: block;
    margin-bottom: 9px;
    color: #6d7965;
    font-size: 11px;
}

.money-strip strong {
    display: block;
    color: #243f2a;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.4px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.debt-amount {
    color: #975227;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid #dce3d7;
    border-radius: 5px;
    background: #f4f6ef;
    color: #64715d;
    font-size: 10px;
    font-weight: 550;
    line-height: 1.6;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge.active {
    background: #eff6ec;
    color: #387143;
    border-color: #d7e9d1;
}

.badge.scheduled {
    background: #eef3fa;
    color: #4b6b92;
    border-color: #dde7f4;
}

.badge.overdue {
    background: #fcf2e8;
    color: #a25b28;
    border-color: #efdcc7;
}

.badge.returned {
    background: #f1f3ee;
    color: #737c6c;
    border-color: #e1e6da;
}

.alert {
    margin: 0 0 24px;
    padding: 15px 18px;
    border: 1px solid #eccdbe;
    border-left: 3px solid #bd6a48;
    border-radius: 6px;
    background: #fff7f1;
    color: #914829;
    font-size: 13px;
    line-height: 1.65;
}

.invoice-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.invoice-links a {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid #e8dfca;
    border-radius: 5px;
    background: #faf7ef;
    color: #84683a;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
}

.invoice-links a:hover {
    background: #f3ecdc;
    color: #6f542e;
}

.invoice-menu {
    position: relative;
}

.invoice-menu summary {
    padding: 5px 8px;
    border: 1px solid #e8dfca;
    border-radius: 5px;
    background: #faf7ef;
    color: #84683a;
    font-size: 11px;
    list-style: none;
    cursor: pointer;
}

.invoice-menu summary::-webkit-details-marker {
    display: none;
}

.invoice-menu summary span {
    padding: 1px 4px;
    margin-left: 4px;
    border-radius: 3px;
    background: #eae2ce;
}

.invoice-popover {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    z-index: 15;
    display: grid;
    gap: 2px;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 6px 18px #23352315;
}

.invoice-popover a,
.invoice-popover span {
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.invoice-popover a:hover {
    background: #f3f6ed;
}

/* Delivery photography */
.photo-section {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fcfcf9;
}

.photo-section h3 {
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
    color: #314a32;
}

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

.photo-grid figure {
    min-width: 0;
    margin: 0;
}

.photo-grid figure>a {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #e9eee3;
}

.photo-grid img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: opacity .15s;
}

.photo-grid a:hover img {
    opacity: .9;
}

.photo-grid figcaption {
    margin-top: 8px;
    color: #6d7965;
    font-size: 11px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.photo-delete-form {
    margin: 8px 0 0;
}

button.photo-delete-button {
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid #ecd9cf;
    border-radius: 4px;
    background: transparent;
    color: #9b5c42;
    font-size: 10px;
    font-weight: 500;
}

button.photo-delete-button:hover {
    border-color: #cf9a83;
    background: #fcf1e9;
    color: #844a31;
}

/* Login is composed with the same existing markup. */
body:has(.login) {
    background: #f1f3ed;
}

body:has(.login) header {
    padding-top: 48px;
}

body:has(.login) .brand {
    padding-bottom: 32px;
}

body:has(.login) header::after {
    content: '';
    display: block;
    width: 100%;
    height: 160px;
    margin-top: auto;
    border: 1px solid #ffffff20;
    border-radius: 80px 80px 0 0;
    border-bottom: 0;
}

body:has(.login) main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 65px);
}

body:has(.login) main>.alert {
    width: min(100%, 430px);
    margin: 0 auto 20px;
}

.login {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 39px;
    border-radius: 12px;
}

.login h1 {
    margin-bottom: 32px;
    font-size: 29px;
    letter-spacing: -.8px;
}

.login label {
    margin-bottom: 24px;
}

.login button {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
}

/* Smaller workspaces: horizontal navigation avoids an off-screen mobile rail. */
@media (min-width: 1900px) {
    main {
        margin-right: auto;
    }
}

@media (max-width: 1190px) {
    :root {
        --sidebar: 208px;
    }

    header {
        padding: 28px 13px 18px;
    }

    .brand {
        padding-left: 6px;
        gap: 9px;
        font-size: 13px;
    }

    .brand small {
        font-size: 7px;
    }

    nav a {
        gap: 10px;
        font-size: 12px;
        padding: 10px;
    }

    main {
        padding-left: 26px;
        padding-right: 26px;
    }

    .grid {
        gap: 11px;
        grid-template-columns: repeat(auto-fit, minmax(137px, 1fr));
    }

    .grid>.card {
        padding: 20px 16px;
    }

    .card {
        padding: 23px;
    }

    .money-strip>div {
        padding: 17px 14px;
    }

    .money-strip strong {
        font-size: 15px;
    }
}

@media (max-width: 960px) {
    :root {
        --sidebar: 0px;
    }

    header {
        position: relative;
        inset: auto;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 20px 24px 0;
        overflow: visible;
        border-right: 0;
    }

    .brand {
        flex: 1 1 auto;
        order: 0;
        padding: 0 0 18px;
        font-size: 14px;
    }

    .brand small {
        font-size: 8px;
    }

    .brand-icon {
        width: 33px;
        height: 36px;
        flex-basis: 33px;
        font-size: 22px;
    }

    header>div:last-child:not(.brand) {
        flex: 0 0 auto;
        order: 1;
        margin: 0 0 18px !important;
        padding: 0;
    }

    header button.secondary {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 11px;
    }

    nav {
        order: 2;
        flex: 1 0 100%;
        width: 100%;
        flex-direction: row;
        gap: 4px;
        padding: 11px 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    nav a {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 10px;
        font-size: 12px;
        gap: 8px;
    }

    nav a::before {
        width: 16px;
        height: 16px;
        flex-basis: 16px;
        mask-size: 16px 16px;
        -webkit-mask-size: 16px 16px;
    }

    main {
        width: 100%;
        max-width: none;
        min-height: calc(100vh - 195px);
        margin: 0;
        padding: 25px 24px 36px;
    }

    .topline {
        padding-bottom: 18px;
        margin-bottom: 28px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    }

    .two-col {
        grid-template-columns: minmax(0, 1fr);
    }

    .two-col>.card {
        margin: 0;
    }

    footer {
        margin: 0;
    }

    body:has(.login) header {
        padding: 24px;
    }

    body:has(.login) .brand {
        padding: 0;
    }

    body:has(.login) header::after {
        display: none;
    }

    body:has(.login) main {
        min-height: calc(100vh - 149px);
        padding: 36px 24px;
    }
}

@media (max-width: 600px) {
    header {
        padding: 18px 17px 0;
    }

    main {
        padding: 21px 16px 32px;
    }

    h1 {
        font-size: 28px;
        letter-spacing: -.9px;
    }

    h2 {
        font-size: 16px;
        margin-bottom: 20px;
    }

    main>h1 {
        margin-bottom: 24px;
    }

    .page-heading {
        gap: 17px;
        margin-bottom: 24px;
    }

    .eyebrow {
        margin-bottom: 8px;
        font-size: 9px;
    }

    .lead {
        font-size: 12px;
    }

    .topline {
        margin-bottom: 27px;
        font-size: 9px;
        letter-spacing: 1.3px;
    }

    .topline span:last-child {
        font-size: 11px;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 22px;
    }

    .grid>.card {
        min-height: 123px;
        padding: 18px;
    }

    .grid>.card:first-child:last-child {
        grid-column: 1 / -1;
    }

    .stat {
        font-size: 35px;
        margin-top: 19px;
    }

    .stat.smaller {
        font-size: 23px;
    }

    .card {
        margin-bottom: 20px;
        padding: 20px 17px;
        border-radius: 9px;
    }

    .row {
        grid-template-columns: minmax(0, 1fr);
    }

    label {
        margin-bottom: 19px;
    }

    input,
    select,
    textarea {
        min-height: 45px;
        font-size: 16px;
    }

    input[type='file'] {
        font-size: 11px;
    }

    button,
    .btn {
        min-height: 42px;
    }

    th,
    td {
        padding: 13px 10px;
    }

    th {
        font-size: 9px;
    }

    td {
        font-size: 12px;
    }

    .table-actions {
        min-width: 190px;
    }

    .money-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .money-strip>div {
        padding: 15px 13px;
    }

    .money-strip>div:nth-child(2) {
        border-right: 0;
    }

    .money-strip>div:nth-child(-n+2) {
        border-bottom: 1px solid #e0e6d9;
    }

    .money-strip strong {
        font-size: 15px;
    }

    .money-strip span {
        font-size: 10px;
    }

    .photo-section {
        padding: 18px 14px;
    }

    .photo-grid {
        gap: 16px 10px;
    }

    .photo-grid img {
        height: 128px;
    }

    .report-filter {
        gap: 15px 12px;
    }

    .report-filter label {
        flex-basis: calc(50% - 6px);
    }

    .report-filter>button {
        min-width: 100px;
    }

    .inline-form {
        gap: 8px;
    }

    .inline-form input {
        min-width: 145px;
    }

    .section-divider {
        margin: 27px 0;
    }

    .login {
        padding: 30px 25px;
    }

    body:has(.login) header {
        padding: 22px;
    }

    body:has(.login) main {
        padding: 30px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

@media print {
    :root {
        --sidebar: 0px;
        color: #000;
        background: #fff;
    }

    body {
        background: #fff;
    }

    header,
    footer,
    .topline,
    .back-link,
    .table-actions,
    .photo-delete-form,
    button,
    .btn,
    form {
        display: none !important;
    }

    main {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card {
        padding: 12px;
        border-color: #ccc;
        box-shadow: none;
        break-inside: avoid;
    }

    .grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .grid>.card:first-child {
        background: #fff;
        border-color: #ccc;
    }

    .grid>.card:first-child .stat,
    .grid>.card:first-child .muted {
        color: #000;
    }

    .scroll {
        overflow: visible;
    }

    table,
    .two-col table {
        min-width: 0;
    }

    th,
    td {
        padding: 8px 6px;
        font-size: 9px;
    }

    .two-col {
        grid-template-columns: minmax(0, 1fr);
    }
}