/*
 * Bodyshop design system — global tokens, self-hosted fonts, base typography.
 * Bootstrap 5 is imported before this (in app.js); these rules layer the brand on top.
 * Page-specific layout lives in its own file (e.g. auth.css).
 */

@font-face {
    font-family: 'Bebas Neue';
    src: url("../fonts/bebas-neue-400-kCS-Go6.woff2") format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Archivo';
    src: url("../fonts/archivo-400-6zzj1o8.woff2") format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Archivo';
    src: url("../fonts/archivo-600-som1JOa.woff2") format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Archivo';
    src: url("../fonts/archivo-700-NpNxM9d.woff2") format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Workshop palette */
    --bs-ink: #15171a;          /* tyre black / backdrop */
    --bs-ink-2: #0e0f11;        /* deepest */
    --bs-steel: #21252b;        /* raised panel */
    --bs-steel-2: #2b3037;
    --bs-hi-vis: #00de91;       /* signature accent */
    --bs-hi-vis-press: #00bd7b;
    --bs-paper: #fcfbf9;        /* card */
    --bs-line: #c9ced6;         /* hairline */
    --bs-muted: #6b7280;
    --bs-text: #1d2126;

    --bs-font-display: 'Bebas Neue', 'Arial Narrow', system-ui, sans-serif;
    --bs-font-ui: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'JetBrains Mono', monospace;

    --bs-body-font-family: var(--bs-font-ui);
}

body {
    font-family: var(--bs-font-ui);
    color: var(--bs-text);
}

/* A reusable workshop micro-label: monospace, uppercase, tracked — the WIP/reg-number voice. */
.eyebrow {
    font-family: var(--bs-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--bs-muted);
}

/* ---- Authenticated app shell ---- */
.shell { display: flex; min-height: 100vh; }
.shell__main { flex: 1; min-width: 0; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    background: var(--bs-ink);
    color: #eef1f5;
    border-inline-end: 3px solid var(--bs-hi-vis);
    display: flex;
    flex-direction: column;
}

.sidebar__brand {
    font-family: var(--bs-font-display);
    font-size: 1.7rem;
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar__logo { display: block; height: 48px; width: auto; }
.appbar__logo { display: block; height: 30px; width: auto; }
@media (max-width: 860px) { .sidebar__logo { height: 40px; } }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.sidebar__group { padding: 0.35rem 0; }
.sidebar__group + .sidebar__group { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.sidebar__label {
    font-family: var(--bs-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.6rem;
    color: #6b7486;
    padding: 0.5rem 1.35rem 0.3rem;
}
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.35rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #aeb6c2;
    text-decoration: none;
    border-inline-start: 3px solid transparent;
}
.sidebar__nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.sidebar__nav a.is-active { color: #fff; border-inline-start-color: var(--bs-hi-vis); background: rgba(0, 222, 145, 0.10); }

.sidebar__foot {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.9rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.sidebar__bell {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: #aeb6c2; text-decoration: none;
}
.sidebar__bell:hover, .sidebar__bell.is-active { color: #fff; }
.sidebar__badge {
    background: var(--bs-hi-vis); color: var(--bs-ink-2);
    font-family: var(--bs-font-mono); font-size: 0.66rem; font-weight: 700;
    border-radius: 999px; padding: 0.05rem 0.4rem; line-height: 1.4;
}
.sidebar__email { font-family: var(--bs-font-mono); font-size: 0.72rem; letter-spacing: 0.05em; color: #7e879a; word-break: break-all; }
.sidebar__signout {
    align-self: flex-start;
    font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--bs-hi-vis); text-decoration: none;
    border: 1.5px solid rgba(0, 222, 145, 0.45); border-radius: 8px; padding: 0.3rem 0.65rem;
}
.sidebar__signout:hover { background: rgba(0, 222, 145, 0.12); }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: auto; height: auto; position: static;
        flex-direction: row; align-items: center; flex-wrap: wrap;
        border-inline-end: none; border-bottom: 3px solid var(--bs-hi-vis);
        padding: 0 0.5rem;
    }
    .sidebar__brand { border-bottom: none; padding: 0.8rem 1rem; }
    .sidebar__nav { display: flex; flex: 1 1 100%; order: 3; overflow-x: auto; padding: 0; }
    .sidebar__group { display: flex; align-items: center; padding: 0; }
    .sidebar__group + .sidebar__group { border-top: none; }
    .sidebar__label { display: none; }
    .sidebar__nav a { border-inline-start: none; border-bottom: 2px solid transparent; padding: 0.6rem 0.7rem; white-space: nowrap; }
    .sidebar__nav a.is-active { border-inline-start: none; background: transparent; border-bottom-color: var(--bs-hi-vis); }
    .sidebar__foot { border-top: none; flex-direction: row; align-items: center; gap: 0.7rem; margin-inline-start: auto; padding: 0.5rem 0.75rem; }
    .sidebar__email { display: none; }
}

/* Notifications list */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; border-bottom: 1px solid #eef0f3; }
.notif:last-child { border-bottom: none; }
.notif--unread { background: #fffaf0; }
.notif__main { display: flex; align-items: center; gap: 0.7rem; }
.notif__when { font-family: var(--bs-font-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--bs-muted); white-space: nowrap; }

.app__main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.25rem 2rem;
}

.page-title {
    font-weight: 700;
    font-size: 1.7rem;
    letter-spacing: -0.01em;
    margin: 0.25rem 0 1.25rem;
}

/* App surface (auth/marketing pages cover this with their own backgrounds) */
body { background: #f5f6f8; }

/* Toolbar: title on the left, actions on the right */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.toolbar .page-title { margin: 0.25rem 0 0; }

/* Buttons */
.btn {
    display: inline-block;
    font-family: var(--bs-font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1.5px solid transparent;
    border-radius: 9px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.04s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--bs-hi-vis); color: var(--bs-ink-2); }
.btn--primary:hover { background: var(--bs-hi-vis-press); }
.btn--ghost { background: #fff; border-color: var(--bs-line); color: var(--bs-text); }
.btn--ghost:hover { border-color: #9aa2b0; }
.btn--danger { background: #fff; border-color: #f0b4b4; color: #b3261e; }
.btn--danger:hover { background: #fdecec; }
.btn--sm { padding: 0.4rem 0.65rem; font-size: 0.82rem; }

/* Panel / card */
.panel { background: #fff; border: 1px solid var(--bs-line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }

/* Data table */
/* Horizontal-scroll container for wide tables: a data-dense table stays usable on a phone by
   scrolling sideways inside its panel instead of widening the whole page. The inset shadows hint
   that there's more table to the side; they fade as you reach each edge. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    background:
        linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center / 28px 100% no-repeat,
        linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right center / 28px 100% no-repeat,
        radial-gradient(farthest-side at 0 50%, rgba(16,24,40,0.10), rgba(0,0,0,0)) left center / 12px 100% no-repeat,
        radial-gradient(farthest-side at 100% 50%, rgba(16,24,40,0.10), rgba(0,0,0,0)) right center / 12px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
}
/* Only force the table to its natural (unwrapped) width — and thus sideways scrolling — on
   tablet-and-smaller. Above this, the table returns to width:100% and shows every column in the
   panel with no scroll. (860px is the app's primary breakpoint — see the sidebar/two-col rules.) */
@media (max-width: 860px) {
    .table-scroll .data-table { min-width: max-content; }
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: start;
    font-family: var(--bs-font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-muted);
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--bs-line);
}
.data-table tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table__reg { font-family: var(--bs-font-mono); font-weight: 600; letter-spacing: 0.03em; }
.data-table__actions { text-align: end; white-space: nowrap; display: flex; gap: 0.4rem; justify-content: flex-end; }

/* Empty state */
.empty-state { padding: 3rem 1.5rem; text-align: center; color: var(--bs-muted); }

/* Board tiles (live work situation) */
.board-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.board-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--bs-line);
    border-radius: 14px;
    padding: 1.25rem 1.3rem;
    transition: border-color 0.12s ease, transform 0.04s ease, box-shadow 0.12s ease;
}
.board-tile:hover { border-color: var(--bs-hi-vis); box-shadow: 0 6px 18px -10px rgba(16,24,40,0.2); }
.board-tile__count { font-family: var(--bs-font-display); font-size: 2.6rem; line-height: 1; color: var(--bs-ink); }
.board-tile__count--zero { color: #c2c8d0; }
.board-tile__label { font-weight: 600; margin-top: 0.35rem; }
.board-tile__hint { font-family: var(--bs-font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bs-muted); margin-top: 0.5rem; }
/* Compact per-status pipeline tiles. Red-RAG statuses (e.g. Awaiting Parts) flag in red. */
.board-tile--status { padding: 0.85rem 1rem; }
.board-tile--status .board-tile__count { font-size: 1.9rem; }
.board-tile--status .board-tile__label { font-size: 0.9rem; margin-top: 0.2rem; }
.board-tile--red .board-tile__count,
.board-tile--red .board-tile__label { color: #b3261e; }
@media (max-width: 860px) { .board-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .board-grid { grid-template-columns: 1fr; } }

/* ---- Dashboard: LIVE WORK SITUATION ---- */
.kpi-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.1rem;
}
.kpi-stat {
    background: #fff;
    border: 1px solid var(--bs-line);
    border-radius: 14px;
    padding: 1.05rem 1.2rem;
}
.kpi-stat--hero { background: var(--bs-ink); border-color: var(--bs-ink); }
.kpi-stat--hero .kpi-stat__n { color: var(--bs-hi-vis); }
.kpi-stat--hero .kpi-stat__label { color: #aeb6c2; }
.kpi-stat__n {
    font-family: var(--bs-font-display);
    font-size: 2.9rem;
    line-height: 0.95;
    letter-spacing: 0.01em;
    color: var(--bs-ink);
}
.kpi-stat__n--green { color: #1a7f3c; }
.kpi-stat__n--amber { color: #e8a400; }
.kpi-stat__n--red { color: #b3261e; }
.kpi-stat__n--neutral { color: var(--bs-muted); }
.kpi-stat__n--value { font-size: 2.2rem; }
.kpi-stat__label {
    font-family: var(--bs-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.64rem;
    color: var(--bs-muted);
    margin-top: 0.4rem;
}

/* Revenue strip (page-load only; never broadcast) */
.kpi-revenue { display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 1.1rem; }
.kpi-revenue__n { font-family: var(--bs-font-display); font-size: 2.1rem; line-height: 1; color: var(--bs-ink); }
.kpi-revenue__l { font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.64rem; color: var(--bs-muted); }

/* Signature: the proportional status board (hazard-tape RAG split) */
.kpi-board {
    display: flex;
    height: 16px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.6rem;
    background: #eef0f3;
    box-shadow: inset 0 0 0 1px var(--bs-line);
}
.kpi-board__seg { height: 100%; }
.kpi-board__seg--green { background: #1a7f3c; }
.kpi-board__seg--amber { background: #ffb81c; }
.kpi-board__seg--red { background: #b3261e; }
.kpi-board__seg--neutral { background: #98a2b3; }
.kpi-board__seg--empty { background: #eef0f3; }

.kpi-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.1rem; align-items: start; }
.kpi-side { display: flex; flex-direction: column; gap: 1.1rem; }
.kpi-panel { padding: 1.25rem 1.4rem; }
.kpi-empty { color: var(--bs-muted); font-size: 0.9rem; margin: 0; }

.kpi-pipeline { list-style: none; margin: 0; padding: 0; }
.kpi-pipeline__row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eef0f3;
}
.kpi-pipeline__row:last-child { border-bottom: none; }
/* RAG indicator: colour only — the status label is carried on title/aria-label, not shown. */
.kpi-pipeline__rag { flex: 0 0 auto; width: 0.85rem; height: 0.85rem; border-radius: 50%; }
.kpi-pipeline__rag--green { background: #1a7f3c; }
.kpi-pipeline__rag--amber { background: #9a6700; }
.kpi-pipeline__rag--red { background: #b3261e; }
.kpi-pipeline__rag--neutral { background: #4b5563; }
.kpi-pipeline__label { flex: 1; font-weight: 600; }
.kpi-pipeline__count {
    font-family: var(--bs-font-display);
    font-size: 1.5rem;
    line-height: 1;
    color: var(--bs-ink);
    min-width: 1.5ch;
    text-align: end;
}

.kpi-mix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.kpi-mix__cell { text-align: center; border: 1px solid var(--bs-line); border-radius: 10px; padding: 0.75rem 0.5rem; }
.kpi-mix__n { font-family: var(--bs-font-display); font-size: 2rem; line-height: 1; color: var(--bs-ink); }
.kpi-mix__l { font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.6rem; color: var(--bs-muted); margin-top: 0.3rem; }

.kpi-leaders { margin-top: 0.25rem; }
.kpi-leaders thead th { padding: 0.5rem 0.6rem; }
.kpi-leaders tbody td { padding: 0.55rem 0.6rem; }

@media (max-width: 860px) { .kpi-cols { grid-template-columns: 1fr; } }

/* Status badges */
.badge-flag {
    display: inline-block;
    font-family: var(--bs-font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    margin-inline-end: 0.3rem;
}
.badge-flag--stop { background: #fdecec; color: #b3261e; border: 1px solid #f3b4b4; }
.badge-flag--credit { background: #fff4e0; color: #9a6700; border: 1px solid #f3d9a8; }
.badge-flag--ok { background: #e9f6ee; color: #1a7f3c; border: 1px solid #b7e0c4; }
.badge-flag--pending { background: #fff4e0; color: #9a6700; border: 1px solid #f3d9a8; }
.badge-flag--authorised { background: #e9f6ee; color: #1a7f3c; border: 1px solid #b7e0c4; }
.badge-flag--declined { background: #fdecec; color: #b3261e; border: 1px solid #f3b4b4; }
/* RAG status colours */
.badge-flag--green { background: #e9f6ee; color: #1a7f3c; border: 1px solid #b7e0c4; }
.badge-flag--amber { background: #fff4e0; color: #9a6700; border: 1px solid #f3d9a8; }
.badge-flag--red { background: #fdecec; color: #b3261e; border: 1px solid #f3b4b4; }
.badge-flag--neutral { background: #eef0f3; color: #4b5563; border: 1px solid #d7dbe0; }

/* Status pill (larger, for headers) */
.status-pill {
    display: inline-block;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}
.status-pill--green { background: #1a7f3c; color: #fff; }
.status-pill--amber { background: #ffb81c; color: var(--bs-ink-2); }
.status-pill--red { background: #b3261e; color: #fff; }
.status-pill--neutral { background: #4b5563; color: #fff; }

/* Detail header + grid */
.detail-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.5rem; margin: 0; }
.detail-grid dt { font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.64rem; color: var(--bs-muted); }
.detail-grid dd { margin: 0.15rem 0 0; font-size: 0.98rem; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } .detail-grid { grid-template-columns: 1fr 1fr; } }

/* Status-change form (inline) */
.status-form { display: flex; flex-direction: column; gap: 0.6rem; }
.status-form select, .status-form input, .status-form textarea {
    width: 100%; font-family: var(--bs-font-ui); font-size: 0.92rem; padding: 0.55rem 0.7rem;
    border: 1.5px solid var(--bs-line); border-radius: 9px; background: #fff;
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem; padding-inline-start: 1.4rem; border-inline-start: 2px solid var(--bs-line); }
.timeline li:last-child { border-inline-start-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: ''; position: absolute; inset-inline-start: -6px; top: 3px; width: 10px; height: 10px;
    border-radius: 50%; background: var(--bs-hi-vis); box-shadow: 0 0 0 3px rgba(0,222,145,0.18);
}
.timeline__when { font-family: var(--bs-font-mono); font-size: 0.66rem; letter-spacing: 0.08em; color: var(--bs-muted); }
.timeline__what { font-size: 0.95rem; margin-top: 0.15rem; }
.timeline__note { color: var(--bs-muted); font-size: 0.88rem; }

/* Checkbox row */
.check-row { display: flex; align-items: center; gap: 0.5rem; }
.check-row input { width: auto; }
.check-row label { font-family: var(--bs-font-ui); text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--bs-text); }
label.check-row { font-family: var(--bs-font-ui); text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--bs-text); cursor: pointer; padding: 0.2rem 0; }

/* Access-group form */
.section-heading { font-size: 1rem; font-weight: 700; margin: 0 0 0.75rem; color: var(--bs-text); }
.section-intro { margin: 0; color: var(--bs-muted); font-size: 0.9rem; }
.toolbar--section { margin-top: 2rem; }
.data-table__num { text-align: end; font-variant-numeric: tabular-nums; }
.status-link { text-decoration: none; }

/* Client-side table search + sort (table_controller.js) */
.table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.table-tools__search {
    width: min(420px, 100%);
    font-family: var(--bs-font-ui);
    font-size: 0.92rem;
    color: var(--bs-text);
    padding: 0.6rem 0.9rem 0.6rem 2.4rem;
    border: 1.5px solid var(--bs-line);
    border-radius: 10px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa1ab' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cline x1='10.5' y1='10.5' x2='15' y2='15'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.8rem center;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.table-tools__search::placeholder { color: #aab0bb; }
.table-tools__search:focus {
    outline: none;
    border-color: var(--bs-hi-vis);
    box-shadow: 0 0 0 4px rgba(0, 222, 145, 0.18);
}
.table-tools__count {
    font-family: var(--bs-font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-muted);
    white-space: nowrap;
}
.data-table th.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th.is-sortable::after { content: '↕'; opacity: 0.35; margin-inline-start: 0.4em; font-size: 0.85em; }
.data-table th.is-sorted-asc::after { content: '↑'; opacity: 0.9; }
.data-table th.is-sorted-desc::after { content: '↓'; opacity: 0.9; }
.perm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.perm-area { border: 1px solid var(--bs-line); border-radius: 10px; padding: 0.75rem 0.9rem; margin: 0; min-width: 0; }
.perm-area legend {
    font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em;
    font-size: 0.66rem; color: var(--bs-muted); padding: 0 0.35rem;
}
.member-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem 1rem; margin-bottom: 0.5rem; }

@media (max-width: 720px) { .perm-grid { grid-template-columns: 1fr 1fr; } .member-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .perm-grid { grid-template-columns: 1fr; } }

/* Forms */
.form-card { max-width: 720px; padding: 1.75rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-grid label { font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.68rem; color: var(--bs-muted); }
.form-grid input, .form-grid textarea, .form-grid select {
    width: 100%;
    font-family: var(--bs-font-ui);
    font-size: 0.95rem;
    padding: 0.6rem 0.7rem;
    border: 1.5px solid var(--bs-line);
    border-radius: 9px;
    background: #fff;
    color: var(--bs-text);
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus {
    outline: none;
    border-color: var(--bs-hi-vis);
    box-shadow: 0 0 0 4px rgba(0,222,145,0.18);
}
/* Checkboxes and radios are not text fields: undo the full-width / bordered text-input sizing above
   so they render at their native size and sit inline with their labels (see .checkbox-field and
   .radio-list__item, which lay out the row). */
.form-grid input[type="checkbox"], .form-grid input[type="radio"] {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
/* Prefixed input: a prefix addon (e.g. a currency symbol) joined to the start of a text input.
   Named to avoid Bootstrap's own .input-group (which sets flex-wrap: wrap and would wrap the field). */
.prefixed-input { display: flex; flex-wrap: nowrap; align-items: stretch; }
.prefixed-input__prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 0.7rem;
    font-family: var(--bs-font-ui);
    font-size: 0.95rem;
    color: var(--bs-muted);
    background: #f4f6f8;
    border: 1.5px solid var(--bs-line);
    border-right: 0;
    border-radius: 9px 0 0 9px;
    white-space: nowrap;
}
.form-grid .prefixed-input input { flex: 1 1 auto; min-width: 0; border-radius: 0 9px 9px 0; }
/* Reset native select chrome so dropdowns match the text inputs, then draw our own chevron. */
.form-grid select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.2rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.7rem;
}
.form-grid select:disabled {
    background-color: #f4f6f8;
    color: var(--bs-muted);
    cursor: not-allowed;
}

/* Address blocks (main / billing / delivery): the fieldset is a plain grid cell, and its
   "Same as main address" toggle is a left-aligned checkbox + label row — overriding both the
   uppercase field-label styling and the width:100% input rule that would otherwise stretch and
   centre the checkbox. */
.form-grid .address-block { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-grid .checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--bs-font-ui);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.92rem;
    color: var(--bs-text);
    cursor: pointer;
    margin-bottom: 0.9rem;
}
.form-grid .checkbox-field input[type="checkbox"] {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

/* Select2 (searchable dropdowns) restyled to match the form inputs. */
.form-grid .select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
    height: auto;
    min-height: calc(1.4em + 1.2rem + 3px);
    display: flex;
    align-items: center;
    padding: 0.1rem 2rem 0.1rem 0.7rem;
    border: 1.5px solid var(--bs-line);
    border-radius: 9px;
    background: #fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding: 0;
    margin: 0;
    line-height: 1.4;
    color: var(--bs-text);
    font-family: var(--bs-font-ui);
    font-size: 0.95rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #aab0bb; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute;
    top: 0;
    right: 0.6rem;
    height: 100%;
    display: flex;
    align-items: center;
}
.select2-container--disabled .select2-selection--single { background-color: #f4f6f8; cursor: not-allowed; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--bs-hi-vis);
    box-shadow: 0 0 0 4px rgba(0, 222, 145, 0.18);
}
.select2-dropdown {
    border: 1.5px solid var(--bs-line);
    border-radius: 9px;
    font-family: var(--bs-font-ui);
    font-size: 0.92rem;
}
.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--bs-line);
    border-radius: 7px;
    padding: 0.45rem 0.6rem;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--bs-hi-vis);
    color: var(--bs-ink-2);
}
.select2-container--default .select2-results__option--selected { background: #eef0f3; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.form-error {
    margin: 0 0 1.1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 9px;
    background: #fdecec;
    border: 1px solid #f3b4b4;
    color: #8f1d1d;
    font-size: 0.9rem;
}

.form-success {
    margin: 0 0 1.1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 9px;
    background: #e8f8f1;
    border: 1px solid #9fe3c7;
    color: #0f6b48;
    font-size: 0.9rem;
}

@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

/* DataTables (vehicles list) — align the generated search box, info and pagination with the
 * app theme on the white panel. DataTables 2.x emits dt-* class names. */
.dt-container { margin-top: 0.1rem; }
.dt-container .dt-layout-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.dt-container .dt-search { margin-bottom: 0.75rem; margin-inline-start: auto; }
.dt-container .dt-search label { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--bs-muted); font-size: 0.85rem; }
.dt-container .dt-search input {
    border: 1px solid var(--bs-line);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    font: inherit;
    color: var(--bs-text);
}
.dt-container .dt-search input:focus {
    outline: none;
    border-color: var(--bs-hi-vis);
    box-shadow: 0 0 0 3px rgba(0, 222, 145, 0.18);
}
.dt-container .dt-info { color: var(--bs-muted); font-size: 0.85rem; padding-top: 0.85rem; }
.dt-container .dt-paging { padding-top: 0.6rem; }
.dt-container .dt-paging .dt-paging-button {
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    border: 1px solid transparent;
    color: var(--bs-text);
}
.dt-container .dt-paging .dt-paging-button.current,
.dt-container .dt-paging .dt-paging-button.current:hover {
    background: var(--bs-hi-vis);
    border-color: var(--bs-hi-vis);
    color: var(--bs-ink-2);
}
.dt-container .dt-paging .dt-paging-button:hover:not(.current):not(.disabled) {
    background: #f2f4f7;
    border-color: var(--bs-line);
}
.dt-container .dt-paging .dt-paging-button.disabled { color: var(--bs-muted); opacity: 0.5; }

/* Real-time new-message toasts (bottom-right), Mercure-appended into #toasts. */
.toasts { position: fixed; inset-block-end: 1rem; inset-inline-end: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 1080; max-width: 340px; }
.toast {
    display: flex; align-items: flex-start; gap: 0.5rem;
    background: #15171a; color: #fff; border-radius: 12px; padding: 0.7rem 0.85rem;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
    opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease;
}
.toast--in { opacity: 1; transform: translateY(0); }
.toast--out { opacity: 0; transform: translateY(8px); }
.toast__body { display: flex; flex-direction: column; gap: 0.15rem; color: #fff; text-decoration: none; flex: 1; }
.toast__title { font-size: 0.85rem; font-weight: 600; }
.toast__meta { font-size: 0.78rem; color: #b9c0c9; }
.toast__close { background: none; border: 0; color: #b9c0c9; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 0.15rem; }
.toast__close:hover { color: #fff; }

/* Message view + crew quick-message buttons */
.message-body { white-space: pre-wrap; margin: 0.5rem 0 0; }
.message-photo { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--bs-line); margin-top: 0.5rem; }
.crew-message-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.notif__chip { font-size: 0.7rem; color: var(--bs-muted); }

/* Filter bar (Jobs / Vehicles list filters) */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.filter-bar__field { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-bar__field label {
    font-family: var(--bs-font-mono); text-transform: uppercase; letter-spacing: 0.1em;
    font-size: 0.66rem; color: var(--bs-muted);
}
.filter-bar__field select, .filter-bar__field input {
    font-family: var(--bs-font-ui); font-size: 0.9rem; color: var(--bs-text);
    padding: 0.5rem 0.65rem; border: 1.5px solid var(--bs-line); border-radius: 10px;
    background-color: #fff; min-width: 9.5rem;
}
.filter-bar__field select:focus, .filter-bar__field input:focus { outline: none; border-color: var(--bs-hi-vis); box-shadow: 0 0 0 4px rgba(0, 222, 145, 0.18); }
.filter-bar__actions { display: flex; gap: 0.5rem; margin-inline-start: auto; align-self: flex-end; }
@media (max-width: 720px) { .filter-bar__actions { margin-inline-start: 0; } }

/* Padded settings card that spans wider than the default 720px form — e.g. the Manufacturers grid,
   which needs the room for its two-column list of makes. */
.form-card--wide { max-width: 960px; }

/* Inline filter/search control living in a .toolbar (e.g. Manufacturers settings): matches the
   look of the list filter-bar inputs and grows to fill the row. */
.toolbar--filter { align-items: center; gap: 0.5rem; }
.toolbar-search {
    flex: 1 1 12rem;
    font-family: var(--bs-font-ui); font-size: 0.9rem; color: var(--bs-text);
    padding: 0.5rem 0.65rem; border: 1.5px solid var(--bs-line); border-radius: 10px;
    background-color: #fff;
}
.toolbar-search::placeholder { color: #6f7886; }
.toolbar-search:focus { outline: none; border-color: var(--bs-hi-vis); box-shadow: 0 0 0 4px rgba(0, 222, 145, 0.18); }

/* Countdown widget — per-phase remaining time ticker */
.countdown__time { font-size: 1.5rem; font-weight: 600; }
.countdown--over { color: var(--bs-danger); }

/* ---- Mobile spacing: reclaim horizontal room on small screens ---- */
@media (max-width: 720px) {
    .app__main { padding: 1.25rem 1rem; }
    /* Full-width primary actions read better than a stranded button on a phone. */
    .toolbar { align-items: stretch; }
}
@media (max-width: 480px) {
    .app__main { padding: 1rem 0.85rem; }
}

/* Wizard vehicle picker — a vertical list of selectable rows (estimate/job step 2). */
.radio-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.35rem; }
.radio-list__item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem 0.8rem; border: 1px solid var(--bs-line); border-radius: 9px; cursor: pointer;
}
.radio-list__item:hover { border-color: var(--bs-hi-vis); background: #fafbfc; }

/* Customer typeahead (estimate/job wizard step 1) — native fetch-driven results list. */
.typeahead { position: relative; }
.typeahead__results {
    position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 2px);
    margin: 0; padding: 0.25rem; list-style: none;
    background: #fff; border: 1px solid var(--bs-line); border-radius: 9px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.10); max-height: 16rem; overflow-y: auto;
}
.typeahead__item { padding: 0.5rem 0.7rem; border-radius: 6px; cursor: pointer; }
.typeahead__item:hover { background: rgba(0, 222, 145, 0.10); }

/* Customer document drag-and-drop uploader. Degrades to a normal file input + button without JS. */
.dropzone { border: 2px dashed var(--bs-line, #ccc); border-radius: 8px; padding: 1.25rem; text-align: center; margin-top: 1rem; }
.dropzone--over { border-color: var(--bs-primary, #2b6cb0); background: rgba(43, 108, 176, 0.06); }
.dropzone__prompt { margin: 0 0 0.75rem; color: var(--bs-secondary, #555); }
.dropzone__fallback { margin-top: 0.75rem; }
.dropzone__bar { height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.dropzone__bar > span { display: block; height: 100%; width: 0; background: var(--bs-primary, #2b6cb0); transition: width 0.15s; }
.dropzone__error { color: var(--bs-danger, #c0392b); }
