@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
    --ink: #17201f;
    --muted: #687371;
    --paper: #f4f3ee;
    --surface: #ffffff;
    --line: #d9ddd9;
    --sidebar: #000000;
    --sidebar-muted: #aeb8b5;
    --accent: #e54b2a;
    --accent-dark: #bf351b;
    --yellow: #f3be2f;
    --teal: #147d73;
    --blue: #2c63a5;
    --danger: #b92f2f;
    --shadow: 0 8px 28px rgba(26, 36, 34, .08);
    --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background-color: var(--paper); background-image: linear-gradient(rgba(23, 32, 31, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 32, 31, .025) 1px, transparent 1px); background-size: 28px 28px; font: 14px/1.5 'IBM Plex Sans', sans-serif; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0; line-height: 1.05; }
h1 { margin-bottom: 0; font-size: 30px; }
h2 { margin-bottom: 8px; font-size: 28px; }
h3 { margin-bottom: 6px; font-size: 21px; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 244px; flex-direction: column; padding: 24px 16px; color: #fff; background: var(--sidebar); border-right: 4px solid var(--accent); }
.brand, .auth-brand { display: flex; align-items: center; gap: 12px; }
.brand { justify-content: center; flex-direction: column; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.12); text-align: center; }
.brand-logo { display: block; flex: 0 0 auto; height: auto; object-fit: contain; }
.sidebar-brand-logo { width: 190px; max-width: 100%; }
.brand .sidebar-brand-phone { margin-top: 3px; color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .08em; }
.auth-brand { align-items: center; flex-direction: column; text-align: center; }
.auth-brand-logo { width: 320px; max-width: 100%; }
.brand strong, .auth-brand strong { display: block; font-size: 15px; }
.brand small, .auth-brand small { display: block; margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.main-nav { display: grid; gap: 5px; margin-top: 24px; }
.main-nav a { display: flex; min-height: 44px; align-items: center; gap: 12px; padding: 0 12px; color: var(--sidebar-muted); border-radius: var(--radius); font-weight: 500; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.main-nav a.active { color: #fff; background: var(--accent); box-shadow: inset 3px 0 0 var(--yellow); }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr 34px; align-items: center; gap: 9px; margin-top: auto; padding: 16px 4px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: var(--sidebar-muted); font-size: 11px; }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; color: var(--ink); background: var(--yellow); border-radius: 50%; font-weight: 700; }

.app-shell { min-height: 100vh; margin-left: 244px; }
.topbar { display: flex; min-height: 94px; align-items: center; gap: 16px; padding: 18px clamp(22px, 4vw, 58px); background: rgba(244,243,238,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar > div { margin-right: auto; }
.eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.page-content { max-width: 1500px; margin: 0 auto; padding: 32px clamp(22px, 4vw, 58px) 64px; }
.menu-button { display: none !important; }
.sidebar-backdrop { display: none; }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 600; transition: transform .15s, background .15s, border-color .15s; }
.button { min-height: 42px; padding: 0 16px; }
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--accent); box-shadow: 3px 3px 0 rgba(23,32,31,.16); }
.button.primary:hover { background: var(--accent-dark); }
.button.success { color: #fff; background: var(--teal); box-shadow: 3px 3px 0 rgba(23,32,31,.16); }
.button.success:hover { background: #0d665e; }
.button.note { color: #59420a; background: #fff6d6; border: 1px solid #e0b933; }
.button.note:hover { background: #ffefb8; }
.button.email { color: #fff; background: var(--blue); box-shadow: 3px 3px 0 rgba(23,32,31,.16); }
.button.email:hover { background: #214f85; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.button.secondary { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.button.text { color: var(--accent-dark); background: transparent; }
.button.full { width: 100%; }
.icon-button { width: 36px; height: 36px; padding: 0; color: inherit; background: transparent; }
.icon-button.danger { color: var(--danger); }
.table-actions { display: inline-flex; align-items: center; gap: 2px; }
.alert { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert.success { border-left-color: var(--teal); }
.alert.error { border-left-color: var(--danger); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.metric { display: flex; min-height: 132px; align-items: center; gap: 18px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.metric:hover { border-color: #b9c0bb; box-shadow: 0 12px 32px rgba(26, 36, 34, .13); transform: translateY(-2px); }
.metric:focus-visible { outline: 3px solid rgba(44, 99, 165, .25); outline-offset: 3px; }
.metric.accent { color: #fff; background: var(--ink); border-color: var(--ink); }
.metric.accent:hover { border-color: var(--accent); }
.metric-icon { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; color: var(--accent); background: #fce9e4; border-radius: 50%; }
.metric.accent .metric-icon { color: var(--ink); background: var(--yellow); }
.metric div > small, .metric div > span { display: block; color: var(--muted); }
.metric.accent div > small, .metric.accent div > span { color: #bdc6c3; }
.metric strong { display: block; margin: 1px 0; font: 700 34px/1 'Barlow Condensed', sans-serif; }
.metric div > span { font-size: 12px; }
.metric-link-icon { width: 20px; height: 20px; margin-left: auto; color: #9aa4a1; transition: color .15s, transform .15s; }
.metric.accent .metric-link-icon { color: #bdc6c3; }
.metric:hover .metric-link-icon { color: var(--accent); transform: translateX(3px); }
.content-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.empty-state { display: grid; min-height: 300px; place-items: center; align-content: center; padding: 36px; text-align: center; }
.empty-state > svg { width: 42px; height: 42px; margin-bottom: 12px; color: var(--accent); }
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { color: var(--muted); }
.schedule-list { padding: 0 24px; }
.schedule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.schedule-row:last-child { border-bottom: 0; }
.schedule-row-link { display: grid; min-width: 0; min-height: 78px; grid-template-columns: 3px 110px minmax(180px, 1fr) auto 22px; align-items: center; gap: 16px; }
.schedule-row-link > time { font-weight: 600; }
.schedule-complete-form { margin: 0; }
.schedule-complete-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; color: #11665d; background: #edf8f5; border: 1px solid #a7d6cc; border-radius: var(--radius); cursor: pointer; font-weight: 600; transition: color .15s, background .15s, border-color .15s, transform .15s; }
.schedule-complete-button:hover { color: #fff; background: var(--teal); border-color: var(--teal); transform: translateY(-1px); }
.schedule-complete-button:focus-visible { outline: 3px solid rgba(20,125,115,.2); outline-offset: 2px; }
.schedule-line { width: 3px; height: 38px; background: var(--accent); }
.schedule-customer strong, .schedule-customer small { display: block; }
.schedule-customer small { overflow: hidden; max-width: 600px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.vehicle-reg { display: inline-flex; width: max-content; min-height: 29px; align-items: center; padding: 2px 8px; color: #171717; background: #f6d94b; border: 1px solid #d4b815; border-radius: 3px; font-family: 'IBM Plex Sans', sans-serif; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge { display: inline-flex; width: max-content; align-items: center; padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-booked, .status-draft { color: #244e80; background: #e5effa; }
.status-in_progress, .status-sent { color: #835414; background: #fff1cf; }
.status-completed, .status-paid { color: #11665d; background: #dcf2ed; }
.status-cancelled { color: #833333; background: #fae3e3; }

label { display: grid; gap: 6px; color: #394442; font-size: 12px; font-weight: 600; }
label em { justify-self: end; margin-top: -22px; color: var(--accent); font-size: 9px; font-style: normal; letter-spacing: .08em; text-transform: uppercase; }
input, textarea, select { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid #c9ceca; border-radius: 4px; outline: 0; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,125,115,.12); }
.reg-input { font-weight: 700; text-transform: uppercase; }
.reg-lookup-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.reg-lookup-control .button { min-width: 104px; }
.reg-lookup-control .button:disabled { cursor: wait; opacity: .65; transform: none; }
.vehicle-lookup-message { display: none; margin-top: -7px; padding: 10px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.vehicle-lookup-message:not(:empty) { display: block; }
.vehicle-lookup-message.pending { color: #72500b; background: #fff4d6; border-left: 3px solid var(--yellow); }
.vehicle-lookup-message.success { color: #11665d; background: #dcf2ed; border-left: 3px solid var(--teal); }
.vehicle-lookup-message.error { color: #833333; background: #fae3e3; border-left: 3px solid var(--danger); }
.vehicle-details { padding: 18px; background: #f5f6f3; border: 1px solid var(--line); border-radius: var(--radius); }
.vehicle-details-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.vehicle-details-heading h3, .vehicle-details-heading p { margin-bottom: 0; }
.mot-history-panel { margin-top: 18px; padding: 18px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(26, 36, 34, .06); }
.mot-history-panel[hidden] { display: none; }
.mot-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.mot-history-heading h3, .mot-history-heading p { margin-bottom: 0; }
.mot-history-heading > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.mot-history-list { display: grid; max-height: 560px; gap: 10px; overflow-y: auto; padding-right: 4px; }
.mot-history-item { overflow: hidden; background: #fafaf8; border: 1px solid var(--line); border-left: 4px solid #8d9794; border-radius: 4px; }
.mot-history-item.result-passed { border-left-color: var(--teal); }
.mot-history-item.result-failed { border-left-color: var(--danger); }
.mot-history-item-heading { display: grid; grid-template-columns: 72px minmax(140px, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; }
.mot-history-item-heading strong, .mot-history-item-heading small { display: block; }
.mot-history-item-heading small { margin-top: 2px; color: var(--muted); }
.mot-result-badge, .mot-defect-type { display: inline-flex; width: max-content; align-items: center; justify-content: center; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.mot-result-badge { min-width: 62px; padding: 5px 8px; }
.mot-result-badge.passed { color: #11665d; background: #dcf2ed; }
.mot-result-badge.failed { color: #833333; background: #fae3e3; }
.mot-result-badge.unknown { color: #4f5c59; background: #e8ecea; }
.mot-history-expiry { color: var(--muted); font-size: 12px; font-weight: 600; }
.mot-defect-list { display: grid; gap: 8px; margin: 0; padding: 11px 14px 13px; background: #fff; border-top: 1px solid var(--line); list-style: none; }
.mot-defect-list li { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: start; gap: 10px; color: #45504e; font-size: 12px; }
.mot-defect-type { min-width: 70px; padding: 3px 6px; color: #4f5c59; background: #e8ecea; }
.mot-defect-type.defect-dangerous, .mot-defect-type.defect-major { color: #833333; background: #fae3e3; }
.mot-defect-type.defect-minor { color: #835414; background: #fff1cf; }
.mot-defect-type.defect-prs { color: #244e80; background: #e5effa; }
.mot-history-clear, .mot-history-empty { margin: 0; color: var(--muted); font-size: 12px; }
.mot-history-clear { padding: 0 14px 12px 102px; }
.mot-history-empty { padding: 18px; background: #fafaf8; border: 1px dashed var(--line); border-radius: 4px; text-align: center; }
.field-grid { display: grid; gap: 18px; }
.field-grid.two { grid-template-columns: repeat(2, 1fr); }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.four { grid-template-columns: repeat(4, 1fr); }
.span-two { grid-column: span 2; }
.span-three { grid-column: span 3; }
.booking-form, .invoice-editor { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 22px; }
.form-main { display: grid; gap: 18px; }
.form-section { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-section-heading { display: flex; gap: 14px; margin-bottom: 25px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-section-heading > span { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; color: #fff; background: var(--ink); border-radius: 50%; font: 600 16px 'Barlow Condensed', sans-serif; }
.form-section-heading h2, .form-section-heading p { margin-bottom: 2px; }
.form-section-heading p, .form-actions-panel p { color: var(--muted); }
.existing-customer-picker { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 12px; margin-bottom: 22px; padding: 14px; background: #eaf5f2; border: 1px solid #beddd7; border-radius: var(--radius); }
.existing-customer-icon { display: grid; width: 40px; height: 40px; place-items: center; color: #fff; background: var(--teal); border-radius: 4px; }
.existing-customer-picker label { color: #245c56; }
.form-actions-panel { position: sticky; top: 18px; display: grid; gap: 10px; padding: 22px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--yellow); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-actions-panel > div { margin-bottom: 10px; }
.button.mot-ready { color: #244e80; background: #edf5fd; border: 1px solid #9fc2e5; }
.button.mot-ready:hover { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.mot-ready.is-ready { color: #fff; background: var(--teal); border-color: var(--teal); box-shadow: 3px 3px 0 rgba(23,32,31,.16); }
.mot-ready-meta { margin: -4px 0 2px; color: var(--teal); font-size: 10px; font-weight: 600; text-align: center; }

body:has(.mot-checklist-dialog[open]) { overflow: hidden; }
.mot-checklist-dialog { width: min(1080px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; background: transparent; border: 0; border-radius: 10px; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.mot-checklist-dialog::backdrop { background: rgba(10,18,17,.68); backdrop-filter: blur(3px); }
.mot-checklist-shell { display: flex; max-height: calc(100dvh - 32px); flex-direction: column; background: var(--paper); }
.mot-checklist-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.mot-checklist-header h2, .mot-checklist-header p { margin-bottom: 0; }
.mot-checklist-header > div > p:last-child { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); }
.mot-checklist-header .icon-button { flex: 0 0 auto; background: #f4f5f2; border: 1px solid var(--line); }
.mot-checklist-body { min-height: 0; overflow-y: auto; padding: 20px 24px 26px; }
.mot-checklist-guidance { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; margin-bottom: 16px; padding: 13px 14px; color: #374644; background: #eaf5f2; border: 1px solid #beddd7; border-radius: var(--radius); }
.mot-checklist-guidance > svg { margin-top: 1px; color: var(--teal); }
.mot-checklist-guidance p { margin: 0; font-size: 12px; }
.mot-checklist-guidance a { color: #0e655d; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.mot-checklist-progress { position: sticky; z-index: 2; top: -20px; margin-bottom: 16px; padding: 14px 0 12px; background: var(--paper); }
.mot-checklist-progress > div { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.mot-checklist-progress strong { color: var(--ink); }
.mot-checklist-progress progress { display: block; width: 100%; height: 8px; overflow: hidden; appearance: none; background: #dfe4e0; border: 0; border-radius: 10px; }
.mot-checklist-progress progress::-webkit-progress-bar { background: #dfe4e0; border-radius: 10px; }
.mot-checklist-progress progress::-webkit-progress-value { background: var(--teal); border-radius: 10px; transition: width .2s; }
.mot-checklist-progress progress::-moz-progress-bar { background: var(--teal); border-radius: 10px; }
.mot-checklist-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; }
.mot-checklist-section { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(26,36,34,.04); }
.mot-checklist-section h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 13px 15px; background: #f8f8f5; border-bottom: 1px solid var(--line); font-size: 18px; }
.mot-checklist-section h3 span { color: var(--muted); font: 600 10px/1.2 'IBM Plex Sans', sans-serif; white-space: nowrap; }
.mot-checklist-items { display: grid; }
.mot-checklist-item { grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 10px; padding: 11px 13px; background: #fff; border-bottom: 1px solid #eceeeb; cursor: pointer; transition: background .15s; }
.mot-checklist-item:last-child { border-bottom: 0; }
.mot-checklist-item:hover { background: #fbfcfa; }
.mot-checklist-item:has(input:checked) { background: #f0f9f6; }
.mot-checklist-item input { width: 19px; height: 19px; min-height: 0; margin: 2px 0 0; padding: 0; accent-color: var(--teal); cursor: pointer; }
.mot-checklist-item span, .mot-checklist-item strong, .mot-checklist-item small { display: block; }
.mot-checklist-item strong { color: var(--ink); font-size: 12px; }
.mot-checklist-item small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.mot-checklist-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; background: #fff; border-top: 1px solid var(--line); }
.mot-checklist-footer .button { min-width: 170px; }
.mot-checklist-footer .button:disabled { color: #64706d; background: #e6e9e6; border-color: #d1d5d1; }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.filter-bar select { width: 180px; }
.filter-bar.is-live .filter-submit { display: none; }
.booking-view-tabs { display: flex; width: max-content; gap: 5px; margin-bottom: 14px; padding: 5px; background: #e7e9e5; border: 1px solid #d4d8d3; border-radius: var(--radius); }
.booking-view-tabs a { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 14px; color: #55605d; border-radius: 4px; font-weight: 600; }
.booking-view-tabs a:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.booking-view-tabs a.active { color: #fff; background: var(--ink); box-shadow: 0 3px 10px rgba(23,32,31,.16); }
.booking-view-tabs a:focus-visible { outline: 3px solid rgba(44,99,165,.25); outline-offset: 2px; }
.search-field { position: relative; flex: 1; }
.search-field svg { position: absolute; z-index: 1; top: 12px; left: 12px; color: var(--muted); }
.search-field input { padding-left: 40px; }
.table-section { overflow: hidden; }
[data-live-filter-result].is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); background: #f8f8f5; font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfcfa; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: var(--muted); }
.truncate-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-cell { padding: 40px; color: var(--muted); text-align: center; }

.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.calendar-toolbar h2 { margin: 0; font-size: 34px; }
.calendar-actions { display: flex; align-items: center; gap: 8px; }
.calendar-actions .icon-button { background: #fff; border: 1px solid var(--line); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); gap: 1px; }
.calendar-day-name { padding: 10px; color: #fff; background: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.calendar-day { position: relative; min-height: 150px; padding: 9px; background: #fff; }
.calendar-day.other-month { color: #9ba3a1; background: #f5f5f1; }
.calendar-day.closed { background-image: repeating-linear-gradient(135deg, transparent, transparent 8px, rgba(23,32,31,.025) 8px, rgba(23,32,31,.025) 16px); }
.day-header { display: flex; height: 25px; align-items: center; justify-content: space-between; font-weight: 600; }
.day-header svg { width: 15px; opacity: 0; color: var(--accent); }
.calendar-day:hover .day-header svg { opacity: 1; }
.calendar-day.today .day-header span { display: grid; width: 25px; height: 25px; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; }
.closed-label { position: absolute; top: 13px; left: 35px; color: #9a6256; font-size: 9px; text-transform: uppercase; }
.day-bookings { display: grid; gap: 5px; margin-top: 6px; }
.calendar-job { display: grid; grid-template-columns: auto 1fr; gap: 0 5px; overflow: hidden; padding: 5px 7px; background: #f3f5f4; border-left: 3px solid var(--blue); border-radius: 3px; font-size: 10px; }
.calendar-job time { color: var(--muted); }
.calendar-job strong { overflow: hidden; text-overflow: ellipsis; }
.calendar-job span { grid-column: 1 / -1; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.status-border-in_progress { border-left-color: var(--yellow); }
.status-border-completed { border-left-color: var(--teal); }
.status-border-cancelled { border-left-color: var(--danger); opacity: .65; }
.more-jobs { color: var(--accent-dark); font-size: 10px; font-weight: 600; }
.calendar-hint { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 12px; }

.detail-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); align-items: start; gap: 18px; }
.customer-profile { padding: 24px; }
.profile-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.profile-avatar { display: grid; width: 58px; height: 58px; place-items: center; color: #fff; background: var(--teal); border-radius: 50%; font: 700 26px 'Barlow Condensed', sans-serif; }
.profile-heading h2 { margin-bottom: 6px; }
.customer-profile dl { display: grid; gap: 15px; margin: 22px 0; }
.customer-profile dl div { display: grid; gap: 3px; }
.customer-profile dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.customer-profile dd { margin: 0; }
.customer-profile-actions { display: grid; gap: 9px; }
.history-list { padding: 0 22px; }
.history-list > a { display: grid; grid-template-columns: 90px minmax(0,1fr) auto 20px; align-items: center; gap: 14px; min-height: 76px; border-bottom: 1px solid var(--line); }
.history-list > a:last-child { border-bottom: 0; }
.history-list strong, .history-list small { display: block; }
.history-list small { color: var(--muted); }

.invoice-summary { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-bottom: 18px; padding: 18px 22px; color: #fff; background: var(--teal); border-radius: var(--radius); box-shadow: var(--shadow); }
.invoice-summary p { max-width: 620px; margin: 0; color: #d9efec; }
.invoice-summary .eyebrow { color: #bfe4df; }
.invoice-summary strong { font: 700 30px 'Barlow Condensed', sans-serif; }
.monthly-earnings { margin-bottom: 18px; overflow: hidden; }
.monthly-earnings .section-heading p:last-child { margin: 5px 0 0; color: var(--muted); }
.monthly-earnings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 20px 22px 22px; }
.monthly-earnings-card { padding: 17px 18px; background: #f0f7f5; border: 1px solid #cfe4df; border-radius: var(--radius); }
.monthly-earnings-card span, .monthly-earnings-card small { display: block; color: var(--muted); }
.monthly-earnings-card span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.monthly-earnings-card strong { display: block; margin: 4px 0 2px; color: var(--teal); font: 700 30px/1 'Barlow Condensed', sans-serif; }
.monthly-earnings-card small { font-size: 12px; }
.monthly-earnings-empty { margin: 0; padding: 22px; color: var(--muted); }
.invoice-customer-select { overflow: hidden; }
.customer-select-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 28px; }
.customer-select-form .button { min-width: 190px; }
.customer-search-fields { display: grid; grid-template-columns: minmax(230px, .7fr) minmax(300px, 1fr); gap: 12px; }
.customer-search-input { position: relative; display: block; }
.customer-search-input svg { position: absolute; top: 12px; left: 12px; color: var(--muted); pointer-events: none; }
.customer-search-input input { padding-left: 40px; }
.customer-result-count { color: var(--muted); font-weight: 400; }
.customer-result-count.no-results { color: var(--danger); }
.invoice-document { padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.invoice-form-fields { min-width: 0; margin: 0; }
.invoice-form-fields:disabled input, .invoice-form-fields:disabled textarea, .invoice-form-fields:disabled select { color: #56605e; background: #f1f2ef; border-color: #d7dbd7; cursor: not-allowed; opacity: 1; }
.invoice-form-fields:disabled [data-add-line], .invoice-form-fields:disabled [data-remove-line] { display: none; }
.invoice-lock-notice strong { margin-right: 4px; }
.paid-lock-status { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 11px 12px; color: #11665d; background: #dcf2ed; border: 1px solid #a9dacf; border-radius: var(--radius); }
.paid-lock-status svg { width: 24px; height: 24px; }
.paid-lock-status strong, .paid-lock-status small { display: block; }
.paid-lock-status small { color: #4b756f; }
.invoice-brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 22px; padding-bottom: 24px; border-bottom: 4px solid var(--ink); }
.garage-invoice-brand { display: flex; align-items: center; gap: 16px; }
.invoice-brand-logo { width: 150px; }
.garage-invoice-brand p, .garage-invoice-brand h2, .garage-invoice-brand small { margin: 0; }
.garage-invoice-brand p { color: var(--accent); font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.garage-invoice-brand h2 { margin: 2px 0; font-size: 30px; }
.garage-invoice-brand small { color: var(--muted); }
.invoice-customer-row { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.invoice-customer-row h3, .invoice-customer-row p { margin-bottom: 4px; }
.invoice-customer-row p { color: var(--muted); }
.garage-contact { max-width: 280px; text-align: right; }
.invoice-title-row { display: flex; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.invoice-title-row p { margin-bottom: 0; color: var(--muted); }
.invoice-id { display: grid; justify-items: end; align-content: start; gap: 5px; }
.invoice-id > span:first-child { font: 700 38px 'Barlow Condensed', sans-serif; }
.invoice-id > strong { color: var(--muted); }
.compact-fields { padding: 18px; background: #f5f6f3; border-radius: var(--radius); }
.invoice-lines { margin-top: 28px; }
.invoice-category { margin-top: 26px; padding: 20px; background: #fafaf7; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); }
.invoice-category.parts-category { border-top-color: var(--teal); }
.invoice-category-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.invoice-category-heading h3, .invoice-category-heading p { margin: 0; }
.category-icon { display: grid; width: 36px; height: 36px; place-items: center; color: #fff; background: var(--accent); border-radius: 4px; }
.parts-category .category-icon { background: var(--teal); }
.part-catalogue-picker { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; align-items: end; gap: 9px; margin-bottom: 12px; padding: 14px; background: #eaf5f2; border: 1px solid #beddd7; border-radius: var(--radius); }
.part-catalogue-picker .button { min-height: 42px; }
.invoice-line { display: grid; grid-template-columns: minmax(180px, 1fr) 75px 130px 90px 36px; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.invoice-line-head { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.money-input { position: relative; }
.money-input span { position: absolute; top: 11px; left: 10px; color: var(--muted); }
.money-input input { padding-left: 25px; }
.labour-category .money-input input[readonly] { color: #56605e; background: #f1f2ef; cursor: default; }
.invoice-bottom { display: grid; grid-template-columns: minmax(200px, 1fr) 280px; gap: 40px; margin-top: 30px; }
.invoice-notes { display: grid; gap: 14px; }
.invoice-notes textarea[readonly] { color: #56605e; background: #f1f2ef; cursor: default; }
.invoice-totals { margin: 0; }
.invoice-totals div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.invoice-totals dd { margin: 0; font-weight: 600; }
.invoice-totals .grand-total { padding-top: 15px; border-bottom: 0; font: 700 22px 'Barlow Condensed', sans-serif; }

.parts-catalogue-page .section-heading p:last-child { margin: 5px 0 0; color: var(--muted); }
.parts-add-form { display: grid; grid-template-columns: minmax(240px, 1fr) 210px auto; align-items: end; gap: 12px; padding: 24px; background: #f5f6f3; border-bottom: 1px solid var(--line); }
.parts-list-heading, .parts-list-row { display: grid; grid-template-columns: minmax(240px, 1fr) 210px 160px; align-items: center; gap: 12px; }
.parts-list-heading { padding: 12px 24px; color: var(--muted); background: #f8f8f5; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.parts-list-row { padding: 12px 24px; border-bottom: 1px solid var(--line); }
.parts-list-row:last-child { border-bottom: 0; }
.parts-list-row > label > span { display: none; }
.parts-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.parts-empty { min-height: 220px; }

.settings-nav { display: flex; gap: 6px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.settings-nav a { padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; }
.settings-section { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 30px; padding: 34px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.settings-section:last-child { border-bottom: 0; }
.settings-intro { display: flex; align-items: flex-start; gap: 13px; }
.settings-intro p { color: var(--muted); }
.settings-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; color: var(--accent); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.settings-form { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.settings-form > .button { margin-top: 20px; }
.settings-note { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.settings-note svg { color: var(--teal); }
.hours-list { display: grid; }
.hours-row { display: grid; grid-template-columns: minmax(130px, 1fr) 130px 24px 130px; align-items: end; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hours-row:last-child { border-bottom: 0; }
.hours-row label > span:not(.switch span) { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.hours-separator { align-self: center; color: var(--muted); text-align: center; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch > span { position: relative; width: 38px; height: 21px; flex: 0 0 auto; background: #b9c0bd; border-radius: 20px; }
.switch > span::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; content: ''; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(17px); }
.user-list { display: grid; }
.user-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 40px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row strong, .user-row small { display: block; }
.user-row small { color: var(--muted); }
.role-badge { color: #42504d; background: #edf0ed; }
.new-user { margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--ink); }
.new-user .button { align-self: end; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: #000; }
.auth-panel { width: min(500px, 100%); padding: 42px; color: #fff; background: #000; border: 1px solid #343434; border-top: 5px solid var(--accent); border-radius: var(--radius); box-shadow: 0 0 28px rgba(229,75,42,.36), 0 0 75px rgba(229,75,42,.28), 0 24px 110px rgba(255,99,35,.24); }
.auth-brand { margin-bottom: 38px; }
.auth-brand strong { color: #fff; }
.auth-brand small { color: #b8b8b8; }
.auth-copy { margin-bottom: 24px; text-align: center; }
.auth-copy h1 { margin-bottom: 8px; font-size: 38px; }
.auth-copy p:last-child { color: #c7c7c7; }
.form-stack { display: grid; gap: 17px; }
.auth-panel label { color: #fff; text-align: center; }
.auth-panel input { color: #fff; background: #151515; border-color: #4b4b4b; text-align: left; }
.auth-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229,75,42,.22); }
.auth-panel input:-webkit-autofill, .auth-panel input:-webkit-autofill:hover, .auth-panel input:-webkit-autofill:focus { -webkit-text-fill-color: #fff; box-shadow: 0 0 0 1000px #151515 inset; caret-color: #fff; }
.auth-panel .button.primary { background: var(--accent); box-shadow: none; }

.print-page { background: #e5e5e5; }
.print-invoice { position: relative; width: 210mm; min-height: 297mm; margin: 24px auto; padding: 18mm; background: #fff; box-shadow: var(--shadow); }
.print-invoice header { display: flex; justify-content: space-between; padding-bottom: 28px; border-bottom: 4px solid var(--ink); }
.print-invoice header h1 { margin: 2px 0 3px; }
.print-invoice header p { color: var(--muted); }
.print-garage-brand { display: grid; grid-template-columns: 150px 1fr; gap: 14px; max-width: 500px; }
.print-brand-logo { width: 150px; }
.print-garage-brand > div { align-self: center; }
.print-garage-brand small { color: var(--accent); font-size: 8px; font-weight: 700; letter-spacing: .12em; }
.print-garage-brand .print-brand-phone { display: block; margin-top: 5px; font-size: 12px; letter-spacing: .08em; }
.print-garage-brand .print-garage-contact { grid-column: 1 / -1; margin: 7px 0 0; }
.print-title { display: grid; justify-items: end; align-content: start; gap: 5px; }
.print-title > strong { font: 700 48px 'Barlow Condensed', sans-serif; }
.print-meta { display: grid; grid-template-columns: 1fr 270px; gap: 50px; padding: 32px 0; }
.print-meta small { color: var(--accent); font-weight: 700; letter-spacing: .1em; }
.print-meta p { color: var(--muted); }
.print-meta dl { margin: 0; }
.print-meta dl div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.print-meta dd { margin: 0; font-weight: 600; }
.print-item-section { margin-top: 20px; }
.print-item-section h3 { margin: 0; padding: 8px 12px; color: #fff; background: var(--ink); font-size: 17px; }
.print-bottom { display: grid; grid-template-columns: 1fr 260px; gap: 50px; margin-top: 30px; }
.print-notes { color: var(--muted); }
.print-notes strong { display: block; margin-bottom: 4px; color: var(--ink); }
.print-notes p { margin: 0 0 12px; }
.print-bottom dl { margin: 0; }
.print-bottom dl div { display: flex; justify-content: space-between; padding: 8px 0; }
.print-bottom dl div:last-child { margin-top: 5px; padding-top: 12px; border-top: 3px solid var(--ink); font: 700 22px 'Barlow Condensed', sans-serif; }
.print-bottom dd { margin: 0; }
.print-invoice footer { position: absolute; right: 18mm; bottom: 16mm; left: 18mm; padding-top: 10px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; }
.print-button { position: fixed; right: 25px; bottom: 25px; }

@media (max-width: 1120px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .booking-form, .invoice-editor { grid-template-columns: 1fr; }
    .form-actions-panel { position: static; grid-template-columns: repeat(3, 1fr); align-items: end; }
    .form-actions-panel > div { grid-column: 1 / -1; }
    .mot-ready-meta { display: none; }
    .calendar-grid { overflow-x: auto; }
    .calendar-day-name, .calendar-day { min-width: 110px; }
    .settings-section { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 760px) {
    body { overflow-x: hidden; }
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    body.menu-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); }
    body.menu-open .sidebar-backdrop { display: block; }
    .app-shell { margin-left: 0; }
    .topbar { position: sticky; top: 0; z-index: 15; min-height: 72px; padding: 11px 14px; }
    .topbar h1 { font-size: 24px; }
    .menu-button { display: inline-flex !important; flex: 0 0 auto; background: #fff; border: 1px solid var(--line); }
    .button { min-height: 44px; }
    .icon-button { width: 44px; height: 44px; }
    .top-action span { display: none; }
    .top-action { width: 44px; padding: 0; }
    .page-content { padding: 20px 14px 50px; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric { min-height: 115px; gap: 10px; padding: 14px; }
    .metric-icon { width: 36px; height: 36px; }
    .metric strong { font-size: 28px; }
    .schedule-list { padding: 0 14px; }
    .schedule-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 0; }
    .schedule-row-link { min-height: 0; grid-template-columns: 3px minmax(0, 1fr) 20px; gap: 9px; }
    .schedule-row-link .vehicle-reg { grid-column: 2; }
    .schedule-customer { grid-column: 2; }
    .schedule-row-link .badge { grid-column: 2; }
    .schedule-row-link > svg { grid-column: 3; grid-row: 1 / span 3; }
    .schedule-complete-button { width: 44px; min-height: 44px; padding: 0; }
    .schedule-complete-button span { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
    .schedule-line { grid-row: 1 / span 3; height: 100%; }
    .field-grid.two, .field-grid.three, .field-grid.four { grid-template-columns: 1fr; }
    .span-two, .span-three { grid-column: auto; }
    .vehicle-details { grid-column: auto; }
    .form-section, .invoice-document { padding: 18px; }
    .form-actions-panel { grid-template-columns: 1fr; }
    .form-actions-panel > div { grid-column: auto; }
    .mot-ready-meta { display: block; }
    .mot-checklist-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .mot-checklist-shell { max-height: calc(100dvh - 16px); }
    .mot-checklist-header { padding: 17px 16px 14px; }
    .mot-checklist-header > div > p:last-child { align-items: flex-start; flex-direction: column; gap: 6px; }
    .mot-checklist-body { padding: 14px 14px 20px; }
    .mot-checklist-progress { top: -14px; padding-top: 12px; }
    .mot-checklist-sections { grid-template-columns: 1fr; }
    .mot-checklist-footer { gap: 8px; padding: 12px 14px; }
    .mot-checklist-footer .button { min-width: 0; flex: 1; padding: 0 10px; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar select { width: 100%; }
    .booking-view-tabs { width: 100%; }
    .booking-view-tabs a { flex: 1; justify-content: center; text-align: center; }
    .calendar-toolbar { align-items: flex-start; }
    .calendar-toolbar h2 { font-size: 28px; }
    .calendar-grid { grid-template-columns: 1fr; overflow: visible; }
    .calendar-day-name, .calendar-day.other-month { display: none; }
    .calendar-day { min-width: 0; min-height: 78px; padding: 10px 12px; }
    .day-header { height: 30px; }
    .day-header::after { margin-left: 8px; color: var(--muted); content: attr(title); font-size: 11px; font-weight: 500; }
    .day-header svg { margin-left: auto; opacity: 1; }
    .closed-label { top: 17px; left: auto; right: 48px; }
    .calendar-job { grid-template-columns: 82px minmax(0, 1fr); min-height: 39px; align-items: center; font-size: 11px; }
    .calendar-job span { grid-column: 2; }
    .calendar-hint { line-height: 1.4; }
    .table-wrap { overflow: visible; }
    .table-section table, .table-section tbody { display: block; }
    .table-section thead { display: none; }
    .table-section tbody { padding: 10px; }
    .table-section tbody tr { display: block; margin-bottom: 10px; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
    .table-section tbody tr:last-child { margin-bottom: 0; }
    .table-section tbody td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; min-height: 42px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
    .table-section tbody td::before { color: var(--muted); content: attr(data-label); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
    .table-section tbody td > small { grid-column: 2; margin-top: -7px; }
    .table-section tbody td:last-child { justify-items: end; border-bottom: 0; }
    .table-section tbody td:last-child::before { content: ''; }
    .table-section .truncate-cell { max-width: none; white-space: normal; }
    .table-section .empty-cell { display: block; min-height: 0; padding: 25px 10px; border: 0; }
    .table-section .empty-cell::before { content: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .history-list > a { grid-template-columns: 78px 1fr 18px; }
    .history-list .badge { grid-column: 2; }
    .invoice-summary { align-items: flex-start; flex-direction: column; gap: 8px; }
    .customer-select-form { grid-template-columns: 1fr; padding: 18px; }
    .customer-select-form .button { width: 100%; min-width: 0; }
    .customer-search-fields { grid-template-columns: 1fr; }
    .invoice-brand-row, .invoice-customer-row { align-items: flex-start; flex-direction: column; }
    .garage-contact { max-width: none; text-align: left; }
    .garage-invoice-brand { align-items: flex-start; }
    .garage-invoice-brand h2 { font-size: 25px; }
    .invoice-title-row { flex-direction: column; }
    .invoice-id { justify-items: start; }
    .invoice-lines { margin-top: 20px; }
    .invoice-category { padding: 13px; }
    .part-catalogue-picker { grid-template-columns: 1fr; }
    .part-catalogue-picker .button { width: 100%; }
    .invoice-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 10px; margin-bottom: 12px; padding: 12px; background: #f8f8f5; border: 1px solid var(--line); border-radius: var(--radius); }
    .invoice-line > input:first-child { grid-column: 1 / -1; }
    .invoice-line > input[data-quantity] { grid-column: 1; }
    .invoice-line > .money-input { grid-column: 2; }
    .invoice-line > strong { grid-column: 1 / 3; }
    .invoice-line > .icon-button { grid-column: 3; grid-row: 2; justify-self: end; }
    .invoice-line-head { display: none; }
    .invoice-bottom { grid-template-columns: 1fr; gap: 20px; }
    .parts-add-form { grid-template-columns: 1fr; padding: 18px; }
    .parts-add-form .button { width: 100%; }
    .parts-list-heading { display: none; }
    .parts-list-row { grid-template-columns: 1fr 1fr; padding: 16px 18px; }
    .parts-list-row > label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
    .parts-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .settings-nav { overflow-x: auto; }
    .settings-nav a { white-space: nowrap; }
    .settings-form { padding: 17px; }
    .hours-row { grid-template-columns: 1fr 1fr; }
    .hours-row .switch { grid-column: 1 / -1; }
    .hours-separator { display: none; }
    .user-row { grid-template-columns: 38px minmax(0,1fr) 40px; }
    .user-row .role-badge { grid-column: 2; }
    .auth-panel { padding: 25px; }
    .reg-lookup-control { grid-template-columns: 1fr; }
    .reg-lookup-control .button { width: 100%; }
    .vehicle-details-heading { align-items: flex-start; flex-direction: column; }
    .mot-history-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
    .mot-history-item-heading { grid-template-columns: 68px minmax(0, 1fr); }
    .mot-history-expiry { grid-column: 2; }
    .mot-defect-list li { grid-template-columns: 1fr; gap: 4px; }
    .mot-history-clear { padding-left: 14px; }
}

@media (max-width: 430px) {
    .mot-checklist-dialog { width: 100vw; max-height: 100dvh; border-radius: 0; }
    .mot-checklist-shell { min-height: 100dvh; max-height: 100dvh; }
    .mot-checklist-footer { flex-direction: column; }
    .mot-checklist-footer .button { width: 100%; flex: 0 0 auto; }
    .auth-page { display: block; min-height: 100dvh; padding: 0; background-image: none; }
    .auth-panel { width: 100%; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); border-top: 0; border-radius: 0; box-shadow: none; }
    .auth-brand { align-items: center; gap: 10px; margin-bottom: 28px; }
    .auth-brand-logo { width: min(300px, 100%); }
    .auth-brand strong { font-size: 14px; line-height: 1.25; }
    .auth-copy h1 { font-size: 34px; }
    .form-stack { gap: 14px; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric { min-height: 96px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
}

@media print {
    @page { size: A4; margin: 0; }
    *, *::before, *::after { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .print-page { background: #fff; }
    .print-invoice { width: 210mm; height: 297mm; margin: 0; box-shadow: none; }
    .brand-logo { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .print-button { display: none; }
}

/* Operations, customer portal and reporting additions */
.main-nav { min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; }
.mini-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.status-arrived, .status-in_workshop, .status-waiting_parts, .status-out, .status-reserved, .status-recorded { color: #835414; background: #fff1cf; }
.status-ready, .status-collected, .status-approved, .status-available, .status-reviewed { color: #11665d; background: #dcf2ed; }
.status-declined, .status-cancelled, .status-failed { color: #922f2a; background: #fbe5e2; }
.status-converted { color: #4a3b82; background: #ebe7fb; }
.mini-metric-grid article { display: grid; gap: 5px; padding: 19px 21px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.mini-metric-grid article.warning { border-color: #efa33d; background: #fff9ec; }
.mini-metric-grid small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mini-metric-grid strong { font-family: 'Barlow Condensed', sans-serif; font-size: 29px; line-height: 1; }
.mini-metric-grid span { color: var(--muted); font-size: 12px; }

.customer-detail-stack { display: grid; gap: 22px; }
.vehicle-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 14px; }
.vehicle-card { display: grid; gap: 14px; padding: 18px; background: #fafaf7; border: 1px solid var(--line); border-radius: var(--radius); }
.vehicle-card h3 { margin: 10px 0 2px; font-size: 18px; }
.vehicle-card p { margin: 0; color: var(--muted); }
.vehicle-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.vehicle-card dl div { padding: 9px; background: #fff; border-radius: 7px; }
.vehicle-card dt { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.vehicle-card dd { margin: 3px 0 0; font-size: 12px; font-weight: 700; }
.vehicle-card-actions { display: flex; gap: 8px; }
.vehicle-reg-inline { display: inline-block; margin: 2px; }
.table-actions { display: flex; gap: 5px; }
.communication-list { display: grid; }
.communication-list article { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.communication-list article:last-child { border-bottom: 0; }
.communication-icon { display: grid; width: 36px; height: 36px; place-items: center; color: var(--teal); background: #e5f5f1; border-radius: 50%; }
.communication-icon svg { width: 17px; }
.communication-list strong, .communication-list small { display: block; }
.communication-list small { margin-top: 3px; color: var(--muted); }

.workshop-board { display: grid; grid-template-columns: repeat(6, minmax(225px, 1fr)); gap: 12px; padding-bottom: 10px; overflow-x: auto; }
.workshop-column { min-height: 375px; padding: 12px; background: #ebede9; border: 1px solid var(--line); border-radius: 12px; }
.workshop-column > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 3px 11px; }
.workshop-column > header h2 { margin: 0; font-size: 16px; }
.workshop-column > header span { display: grid; min-width: 26px; height: 26px; place-items: center; background: #fff; border-radius: 20px; font-weight: 800; }
.workshop-cards { display: grid; align-content: start; gap: 10px; }
.workshop-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 3px 10px rgb(23 32 31 / 5%); }
.workshop-card > a { display: block; padding: 13px; color: inherit; text-decoration: none; }
.workshop-card > a > div { display: flex; justify-content: space-between; align-items: center; }
.workshop-card time, .workshop-card small { color: var(--muted); font-size: 10px; }
.workshop-card h3 { margin: 11px 0 4px; font-size: 15px; }
.workshop-card p { display: -webkit-box; margin: 0 0 10px; overflow: hidden; color: var(--muted); font-size: 12px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.workshop-card form { padding: 8px; border-top: 1px solid var(--line); }
.workshop-card select { min-height: 34px; padding: 6px; font-size: 11px; }
.workshop-empty { padding: 30px 5px; color: var(--muted); text-align: center; }
.operations-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 18px; margin-top: 22px; align-items: start; }
.request-list article { display: flex; justify-content: space-between; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.request-list article > div { display: grid; gap: 5px; }
.request-list p { margin: 2px 0; }
.request-list form { display: flex; gap: 6px; align-items: center; }
.resource-list { display: flex; flex-wrap: wrap; gap: 8px; }
.resource-list span { display: inline-flex; gap: 7px; align-items: center; padding: 10px 12px; background: #f4f5f1; border-radius: 8px; font-weight: 700; }
.resource-list svg { width: 17px; }
.inline-create { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; align-items: end; }
.inline-create input, .inline-create select { flex: 1 1 130px; }
.loan-car-list { display: grid; gap: 8px; }
.loan-car-list article, .active-loan { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 11px; background: #f5f6f2; border-radius: 8px; }
.loan-car-list strong, .loan-car-list small, .active-loan strong, .active-loan small { display: block; }
.loan-car-list small, .active-loan small { color: var(--muted); }

.job-hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; padding: 22px 25px; color: #fff; background: var(--ink); border-radius: var(--radius); }
.job-hero h2 { margin: 12px 0 4px; font-size: 28px; }
.job-hero p { margin: 0; color: #c9d0cd; }
.job-hero > div:last-child { display: flex; gap: 10px; align-items: center; }
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.job-main { display: grid; gap: 22px; }
.job-sidebar { position: sticky; top: 18px; }
.job-sidebar .content-section { display: grid; gap: 10px; padding: 18px; }
.health-check-form { padding: 0 24px 24px; }
.health-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.health-check-grid article { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; padding: 12px; background: #f7f7f3; border: 1px solid var(--line); border-radius: 8px; }
.health-check-grid article > input { grid-column: 1 / -1; }
.health-check-grid small, .health-check-grid strong { display: block; }
.health-check-grid small { color: var(--muted); }
.health-status { font-weight: 800; }
.health-status.status-green { color: #08765e; background: #e2f6ef; }
.health-status.status-amber { color: #845100; background: #fff2c9; }
.health-status.status-red { color: #a02d25; background: #fee5e2; }
.form-button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.document-upload { display: grid; grid-template-columns: 180px minmax(250px, 1fr) auto; gap: 10px; align-items: end; padding: 0 24px 20px; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 9px; padding: 0 24px 24px; }
.document-grid a { display: grid; grid-template-columns: 35px 1fr; gap: 9px; align-items: center; padding: 11px; color: inherit; background: #f7f7f3; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.document-grid small { display: block; margin-top: 3px; color: var(--muted); }

.estimate-lines { display: grid; gap: 9px; margin: 20px 0 10px; }
.estimate-line { display: grid; grid-template-columns: 105px minmax(0, 1fr) 100px 150px 42px; gap: 9px; align-items: center; padding: 10px; background: #f6f7f3; border: 1px solid var(--line); border-radius: 8px; }

.inventory-add-form { grid-template-columns: 1.5fr repeat(5, minmax(105px, 1fr)) auto; }
.inventory-heading, .inventory-row { grid-template-columns: 1.5fr 1.2fr 1fr 1fr auto; }
.price-pair, .stock-pair { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px; }
.stock-warning { color: #af4b11 !important; font-weight: 800; }

.report-toolbar { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 18px; }
.report-toolbar h2 { margin: 2px 0 0; }
.reports-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.report-table-wrap { overflow-x: auto; }
.report-table-wrap table { width: 100%; border-collapse: collapse; }
.report-table-wrap th, .report-table-wrap td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.report-table-wrap th { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.aging-list { display: grid; gap: 9px; padding: 0 22px 22px; }
.aging-list article { display: grid; grid-template-columns: 1fr auto; padding: 12px; background: #f7f7f3; border-radius: 8px; }
.aging-list small { grid-column: 1 / -1; color: var(--muted); }
.recall-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 0 22px 22px; }
.recall-columns > section { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.recall-columns header { display: flex; justify-content: space-between; padding: 13px; background: #f3f4f0; }
.recall-columns header h3 { margin: 0; font-size: 14px; }
.recall-columns header span { font-weight: 900; }
.recall-columns article { display: grid; gap: 7px; padding: 13px; border-top: 1px solid var(--line); }
.recall-columns article > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.recall-columns article small, .recall-columns article > span { color: var(--muted); }
.recall-columns > section > p { padding: 20px 13px; color: var(--muted); }
.settings-public-link { display: flex; justify-content: space-between; gap: 10px; padding: 12px; background: #f5f5f1; border-radius: 8px; }
.settings-public-link a { display: flex; gap: 5px; align-items: center; overflow-wrap: anywhere; }
.settings-public-link svg { width: 15px; }

.public-page { min-height: 100vh; margin: 0; padding: 35px 16px; color: var(--ink); background: #f2f1eb; }
.public-panel, .portal-shell { width: min(780px, 100%); margin: 0 auto; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.public-panel h1, .portal-shell h1 { margin: 4px 0 10px; font-size: clamp(30px, 5vw, 45px); }
.public-logo { width: 190px; max-height: 90px; margin-bottom: 20px; object-fit: contain; object-position: left center; }
.public-form { margin-top: 24px; }
.public-panel footer, .portal-shell > footer { margin-top: 28px; padding-top: 18px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; }
.honeypot { position: absolute !important; left: -9999px !important; }
.public-success { margin: 25px 0; padding: 25px; color: #08765e; background: #e6f6f1; border-radius: 10px; text-align: center; }
.public-success svg { width: 40px; height: 40px; }
.approval-items, .public-health-list { display: grid; gap: 9px; margin: 22px 0; }
.approval-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; background: #f7f7f3; border: 1px solid var(--line); border-radius: 8px; }
.approval-item small { display: block; color: var(--muted); }
.approval-total { display: flex; justify-content: space-between; padding: 18px 0; border-top: 3px solid var(--ink); font-size: 20px; }
.public-actions { display: flex; gap: 9px; margin-top: 20px; }
.public-notes { margin: 15px 0; padding: 15px; background: #fff8e4; border-radius: 8px; }
.public-health-list article { display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.health-dot { width: 12px; height: 12px; border-radius: 50%; }
.health-green .health-dot { background: #14926f; }
.health-amber .health-dot { background: #e7a51e; }
.health-red .health-dot { background: #db493d; }
.public-health-list small, .public-health-list strong { display: block; }
.public-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.public-photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.portal-shell { width: min(1100px, 100%); }
.portal-header { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.portal-header .public-logo { margin: 0; }
.portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 25px; }
.portal-grid > section { padding: 18px; border: 1px solid var(--line); border-radius: 10px; }
.portal-list { display: grid; }
.portal-list article, .portal-list > a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; padding: 12px 0; color: inherit; border-bottom: 1px solid var(--line); text-decoration: none; }
.portal-list small { display: block; margin-top: 3px; color: var(--muted); }

@media (max-width: 1100px) {
    .operations-grid { grid-template-columns: 1fr 1fr; }
    .operations-grid > section:first-child { grid-column: 1 / -1; }
    .inventory-add-form { grid-template-columns: repeat(3, 1fr); }
    .inventory-add-form > label:first-of-type { grid-column: 1 / -1; }
    .inventory-row { grid-template-columns: 1.4fr 1fr 1fr; }
    .inventory-row > label:nth-of-type(4), .inventory-row .parts-row-actions { grid-column: auto; }
    .portal-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
    .operations-grid, .job-layout, .reports-grid, .recall-columns, .portal-grid { grid-template-columns: 1fr; }
    .operations-grid > section:first-child { grid-column: auto; }
    .job-hero, .job-hero > div:last-child, .report-toolbar, .portal-header { align-items: flex-start; flex-direction: column; }
    .job-hero { display: flex; }
    .job-sidebar { position: static; }
    .health-check-grid { grid-template-columns: 1fr; }
    .health-check-grid article { grid-template-columns: 1fr; }
    .health-check-grid article > input { grid-column: auto; }
    .document-upload, .estimate-line { grid-template-columns: 1fr; }
    .document-upload .button { width: 100%; }
    .inventory-add-form, .inventory-row { grid-template-columns: 1fr; }
    .portal-header { display: flex; }
    .request-list article { flex-direction: column; }
    .public-panel, .portal-shell { padding: 22px 17px; }
    .public-health-list article { grid-template-columns: 13px 1fr; }
    .public-health-list article label { grid-column: 2; }
    .public-photo-grid { grid-template-columns: 1fr 1fr; }
    .public-actions { flex-direction: column; }
}
