/* Custom variables matching layouts.auth-card */
:root {
    --ink: #1f2428;
    --muted: #5a626b;
    --line: #d9dee3;
    --brand: #175296;
    --brand-dark: #103b70;
    --bg: #f4f6f7;
    --white: #fff;
}

/* Filled primary actions throughout the dashboard. */
.fi-btn.fi-color-primary:not(.fi-outlined) {
    --bg: var(--brand) !important;
    --hover-bg: var(--brand-dark) !important;
    --text: var(--white) !important;
    --hover-text: var(--white) !important;
    background-color: var(--brand) !important;
    color: var(--white) !important;
    transition: background-color .2s ease, color .2s ease !important;
}

.fi-btn.fi-color-primary:not(.fi-outlined):hover {
    background-color: var(--brand-dark) !important;
    color: var(--white) !important;
}

.fi-btn.fi-color-primary:not(.fi-outlined) .fi-icon {
    color: currentColor !important;
}

.max-dashboard-stat .fi-wi-stats-overview-stat-content {
    position: relative;
}

.max-dashboard-stat .fi-wi-stats-overview-stat-label-ctn {
    padding-right: 2rem;
}

.max-dashboard-stat .fi-wi-stats-overview-stat-label-ctn > .fi-icon {
    position: absolute;
    top: 0;
    right: 0;
}

.max-dashboard-stat-lines {
    display: grid;
    gap: .15rem;
}

.max-dashboard-stat-lines span {
    display: block;
    line-height: 1.35;
}

.max-dashboard-stat-lines strong {
    font-weight: 600;
}

.max-order-form-actions.fi-sticky .fi-ac {
    width: max-content !important;
    max-width: calc(100vw - 2rem);
    margin-inline: 0 !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    transition:
        box-shadow .2s ease,
        background-color .2s ease !important;
}

.max-order-form-actions.fi-sticky .fi-ac::-webkit-scrollbar {
    display: none;
}

.max-order-form-actions.fi-sticky .fi-ac > * {
    flex: 0 0 auto;
}

@media (max-width: 47.999rem) {
    .max-order-form-actions.fi-sticky .fi-ac {
        right: 1rem;
        left: 1rem;
        width: auto !important;
        max-width: none;
        border-radius: .75rem;
        padding: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .max-order-form-actions.fi-sticky .fi-ac {
        transition: none !important;
    }
}

.max-outstanding-amount {
    color: #b42318;
    font-size: 1.2rem;
}

.max-completion-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.max-completion-summary span {
    display: grid;
    gap: 4px;
    border: 1px solid #d9e1ea;
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}

.max-completion-summary strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.max-signature-pad {
    display: grid;
    gap: 12px;
    width: 100%;
}

.max-signature-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.max-signature-canvas-frame {
    position: relative;
    overflow: hidden;
    min-height: 300px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.max-signature-canvas {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 300px;
    background: transparent;
    cursor: crosshair;
    touch-action: none;
}

.max-signature-canvas:focus-visible {
    outline: 4px solid rgba(23, 82, 150, .2);
    outline-offset: -6px;
}

.max-signature-button {
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 0 16px;
    background: #fff;
    color: #263445;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

.max-signature-button:hover {
    border-color: #175296;
    background: #eef5fc;
    color: #175296;
}

.max-signature-fullscreen-button,
.max-signature-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: grid;
    width: 40px;
    min-height: 40px;
    padding: 0;
    border-color: #d1d5db;
    place-items: center;
    color: #4b5563;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.max-signature-fullscreen-button svg,
.max-signature-close-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.max-signature-close-button {
    z-index: 4;
    border-color: #bfccd9;
    background: #fff;
    color: #111827;
}

.max-signature-close-button:hover {
    border-color: #175296;
    background: #eef5fc;
    color: #175296;
}

.max-signature-done-button {
    border-color: #175296;
    background: #175296;
    color: #fff;
}

.max-signature-done-button:hover {
    background: #103b70;
    color: #fff;
}

.max-signature-pad.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
    height: 100vh;
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: #f4f7fa;
}

.max-signature-pad.is-fullscreen .max-signature-canvas-frame {
    min-height: 0;
    border-width: 1px;
    border-radius: 8px;
}

.max-signature-pad.is-fullscreen .max-signature-canvas {
    height: 100%;
}

.max-signature-pad.is-fullscreen .max-signature-actions {
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .max-completion-summary {
        grid-template-columns: 1fr 1fr;
    }

    .max-signature-canvas-frame {
        min-height: 260px;
    }

    .max-signature-canvas {
        height: 260px;
    }

    .max-signature-pad.is-fullscreen .max-signature-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .max-signature-pad.is-fullscreen .max-signature-button {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .max-signature-pad.is-fullscreen .max-signature-close-button {
        width: 40px;
        min-height: 40px;
        padding: 0;
    }
}

/* Admin e-mail preview page. */
.email-preview-page {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.email-preview-toolbar,
.email-preview-stage {
    border: 1px solid #d9e1ea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(31, 36, 40, .06);
}

.email-preview-toolbar {
    display: flex;
    justify-content: center;
    padding: 22px 24px;
}

.email-preview-select {
    display: grid;
    width: min(100%, 420px);
    gap: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.email-preview-select select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #b8c5d3;
    border-radius: 9px;
    padding: 0 38px 0 12px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
}

.email-preview-select select:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(23, 82, 150, .16);
}

.email-preview-stage {
    margin-top: 22px;
    padding: 24px;
}

.email-preview-browser {
    overflow: hidden;
    border: 1px solid #cfd9e4;
    border-radius: 12px;
    background: #eef3f8;
}

.email-preview-browser iframe {
    display: block;
    width: 100%;
    min-height: 780px;
    border: 0;
    background: #eef3f8;
}

@media (max-width: 760px) {
    .email-preview-stage,
    .email-preview-toolbar {
        padding: 18px;
    }

    .email-preview-browser iframe {
        min-height: 680px;
    }
}

/* Planning calendar. */
.planning-calendar {
    width: 100%;
}

.planning-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #d9e1ea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 36, 40, .05);
}

.planning-area-filter {
    display: grid;
    gap: 5px;
    margin-left: auto;
    color: #52616f;
    font-size: 12px;
    font-weight: 800;
}

.planning-area-filter select {
    min-width: 190px;
    min-height: 38px;
    padding: 7px 34px 7px 10px;
    border: 1px solid #d7e1ec;
    border-radius: 8px;
    background: #fff;
    color: #172033;
}

.planning-unplanned {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #d7e1ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 36, 40, .05);
}

.planning-unplanned > header h2 {
    margin: 0;
    color: #172033;
    font-size: 18px;
}

.planning-unplanned > header p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
}

.planning-unplanned-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.planning-area-card {
    min-width: 0;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}

.planning-area-card h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #dce5ee;
    color: #172033;
    font-size: 14px;
}

.planning-area-card h3 span {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #175296;
    color: #fff;
    text-align: center;
    font-size: 12px;
}

.planning-area-card > div {
    display: grid;
    gap: 1px;
}

.planning-area-card a {
    display: grid;
    gap: 2px;
    padding: 9px 12px;
    color: #334155;
    text-decoration: none;
}

.planning-area-card a + a {
    border-top: 1px solid #e5ebf1;
}

.planning-area-card a:hover {
    background: #eef5fb;
}

.planning-area-card a strong,
.planning-area-card a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.planning-area-card a strong {
    color: #172033;
    font-size: 12px;
}

.planning-area-card a span,
.planning-area-more,
.planning-unplanned-empty {
    color: #64748b;
    font-size: 11px;
}

.planning-area-more {
    padding: 9px 12px;
    border-top: 1px solid #e5ebf1;
    font-weight: 800;
}

.planning-period {
    display: flex;
    align-items: center;
    gap: 8px;
}

.planning-period button,
.planning-view-switch button {
    min-height: 38px;
    border: 1px solid #c8d3df;
    border-radius: 8px;
    padding: 0 13px;
    background: #fff;
    color: var(--ink);
    font-weight: 750;
    cursor: pointer;
}

.planning-period button:first-child,
.planning-period button:nth-child(3) {
    width: 38px;
    padding: 0;
    color: var(--brand);
    font-size: 24px;
    line-height: 1;
}

.planning-period button:hover,
.planning-view-switch button:hover {
    border-color: var(--brand);
    background: #eef5fc;
    color: var(--brand);
}

.planning-period h2 {
    margin: 0 0 0 10px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 850;
}

.planning-view-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 10px;
    background: #edf2f7;
}

.planning-view-switch button {
    border: 0;
    background: transparent;
}

.planning-view-switch button.is-active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(23, 82, 150, .2);
}

.planning-grid-wrap {
    overflow-x: auto;
    border: 1px solid #d9e1ea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(31, 36, 40, .05);
}

.planning-weekdays,
.planning-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    min-width: 980px;
}

.planning-weekdays {
    border-bottom: 1px solid #d9e1ea;
    background: #f7f9fb;
}

.planning-weekdays div {
    padding: 11px 12px;
    color: #64748b;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .05em;
    text-align: center;
    text-transform: uppercase;
}

.planning-day {
    min-height: 150px;
    padding: 10px;
    border-right: 1px solid #e3e9ef;
    border-bottom: 1px solid #e3e9ef;
    background: #fff;
}

.planning-grid.is-week .planning-day {
    min-height: 520px;
}

.planning-day:nth-child(7n) {
    border-right: 0;
}

.planning-day.is-outside {
    background: #f8fafc;
}

.planning-day.is-outside > header,
.planning-day.is-outside .planning-order {
    opacity: .55;
}

.planning-day > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    margin-bottom: 7px;
    color: #64748b;
    font-size: 12px;
}

.planning-day > header strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--ink);
    font-size: 13px;
}

.planning-day.is-today {
    background: #f5f9fe;
    box-shadow: inset 0 0 0 2px rgba(23, 82, 150, .28);
}

.planning-day.is-today > header strong {
    background: var(--brand);
    color: #fff;
}

.planning-day-orders {
    display: grid;
    gap: 6px;
}

.planning-order {
    display: grid;
    gap: 2px;
    overflow: hidden;
    border-left: 4px solid #64748b;
    border-radius: 7px;
    padding: 7px 8px;
    background: #eef2f6;
    color: #334155;
    font-size: 11px;
    line-height: 1.35;
    text-decoration: none;
}

.planning-order:hover {
    filter: brightness(.97);
    box-shadow: 0 4px 10px rgba(31, 36, 40, .08);
}

.planning-order strong,
.planning-order span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.planning-order strong {
    color: #172033;
    font-size: 12px;
}

.planning-order-time {
    font-weight: 850;
}

.planning-order-scheduled {
    border-left-color: #175296;
    background: #eaf2fb;
}

.planning-order-in_progress {
    border-left-color: #d97706;
    background: #fff5df;
}

.planning-order-waiting_for_parts {
    border-left-color: #7c3aed;
    background: #f3edff;
}

.planning-order-completed {
    border-left-color: #15803d;
    background: #eaf7ef;
}

.planning-order-cancelled {
    border-left-color: #b42318;
    background: #fff0ef;
}

.planning-order-new {
    border-left-color: #64748b;
    background: #eef2f6;
}

.planning-empty {
    padding: 8px 0;
    color: #94a3b8;
    font-size: 11px;
    text-align: center;
}

/* Clear status choices on the order form. */
.order-status-picker .fi-fo-toggle-buttons-btn-ctn {
    min-width: 0;
}

.order-status-picker .fi-btn {
    width: 100%;
    min-height: 46px;
    border: 1px solid;
    border-radius: 9px;
    font-weight: 800;
    justify-content: center;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.order-status-picker input + .fi-btn {
    border-color: #d5dde6;
    background: #fff !important;
    color: #334155 !important;
}

.order-status-picker input + .fi-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc !important;
}

.order-status-picker input[value="new"]:checked + .fi-btn {
    border-color: #475569;
    background: #475569 !important;
    color: #fff !important;
}

.order-status-picker input[value="quote_sent"]:checked + .fi-btn {
    border-color: #d97706;
    background: #d97706 !important;
    color: #fff !important;
}

.order-status-picker input[value="quote_accepted"]:checked + .fi-btn {
    border-color: #0f766e;
    background: #0f766e !important;
    color: #fff !important;
}

.order-status-picker input[value="scheduled"]:checked + .fi-btn {
    border-color: #175296;
    background: #175296 !important;
    color: #fff !important;
}

.order-status-picker input[value="in_progress"]:checked + .fi-btn {
    border-color: #b76300;
    background: #b76300 !important;
    color: #fff !important;
}

.order-status-picker input[value="waiting_for_parts"]:checked + .fi-btn {
    border-color: #6d28d9;
    background: #6d28d9 !important;
    color: #fff !important;
}

.order-status-picker input[value="completed"]:checked + .fi-btn {
    border-color: #15803d;
    background: #15803d !important;
    color: #fff !important;
}

.order-status-picker input[value="cancelled"]:checked + .fi-btn {
    border-color: #b42318;
    background: #b42318 !important;
    color: #fff !important;
}

.order-status-picker input:focus-visible + .fi-btn {
    outline: 3px solid rgba(23, 82, 150, .2);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .planning-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .planning-period {
        flex-wrap: wrap;
    }

    .planning-period h2 {
        width: 100%;
        margin: 8px 0 0;
    }

    .planning-view-switch {
        align-self: flex-start;
    }

    .planning-area-filter {
        width: 100%;
        margin-left: 0;
    }

    .planning-area-filter select {
        width: 100%;
    }
}

/* Background & Body Font */
.fi-simple-layout {
    background: var(--bg) !important;
    font-family: Arial, sans-serif !important;
    color: var(--ink) !important;

    /* Brand blue for login page components (buttons, focus rings, checkboxes and links). */
    --primary-50: 239 246 255 !important;
    --primary-100: 219 234 254 !important;
    --primary-200: 191 219 254 !important;
    --primary-300: 147 197 253 !important;
    --primary-400: 59 130 246 !important;
    --primary-500: 23 82 150 !important;
    --primary-600: 23 82 150 !important;
    --primary-700: 16 59 112 !important;
    --primary-800: 15 47 87 !important;
    --primary-900: 13 39 72 !important;
    --primary-950: 8 25 48 !important;

    /* Also support hex primary colors if Tailwind expects hex */
    --color-primary-50: #eff6ff !important;
    --color-primary-100: #dbeafe !important;
    --color-primary-200: #bfdbfe !important;
    --color-primary-300: #93c5fd !important;
    --color-primary-400: #3b82f6 !important;
    --color-primary-500: var(--brand) !important;
    --color-primary-600: var(--brand-dark) !important;
    --color-primary-700: var(--brand-dark) !important;
}

/* Centered Main Card */
.fi-simple-main {
    background: var(--white) !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 34px !important;
    box-shadow: 0 14px 34px rgba(31, 36, 40, .06) !important;
    width: 100% !important;
    max-width: 448px !important;
}

/* Header & Logo styling */
.fi-simple-header {
    margin-bottom: 24px !important;
}

.fi-simple-header .fi-logo {
    display: block !important;
    width: 260px !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto 26px !important;
    object-fit: contain !important;
}

/* Heading (Title) */
.fi-simple-header-heading {
    margin: 0 !important;
    font-size: 26px !important;
    font-weight: bold !important;
    line-height: 1.25 !important;
    text-align: center !important;
    color: var(--ink) !important;
}

/* Subheading (Description) */
.fi-simple-header-subheading {
    margin: 12px 0 0 !important;
    color: var(--muted) !important;
    line-height: 1.6 !important;
    text-align: center !important;
}

/* Text Inputs (Email & Password) */
.fi-simple-layout input[type="email"],
.fi-simple-layout input[type="password"],
.fi-simple-layout input[type="text"] {
    width: 100% !important;
    min-height: 46px !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    padding: 0 12px !important;
    font-size: 16px !important;
    box-shadow: none !important;
    background-color: var(--white) !important;
    color: var(--ink) !important;
}

.fi-simple-layout input[type="email"]:focus,
.fi-simple-layout input[type="password"]:focus,
.fi-simple-layout input[type="text"]:focus {
    outline: 2px solid rgba(23, 82, 150, .22) !important;
    border-color: var(--brand) !important;
    box-shadow: none !important;
    --tw-ring-offset-width: 0px !important;
    --tw-ring-width: 0px !important;
    --tw-ring-color: transparent !important;
}

/* Login remember-me checkbox. */
.fi-simple-layout input[type="checkbox"].fi-checkbox-input {
    appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px !important;
    border: 1px solid #9ca3af !important;
    border-radius: 4px !important;
    background-color: var(--white) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 12px 12px !important;
    cursor: pointer !important;
}

.fi-simple-layout input[type="checkbox"].fi-checkbox-input:checked {
    border-color: var(--brand) !important;
    background-color: var(--brand) !important;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.fi-simple-layout input[type="checkbox"].fi-checkbox-input:focus-visible {
    outline: 3px solid rgba(23, 82, 150, .2) !important;
    outline-offset: 2px !important;
}

/* Labels */
.fi-simple-layout label {
    font-weight: 800 !important;
    color: var(--ink) !important;
}

/* Submit Action Button */
.fi-simple-layout button[type="submit"],
.fi-simple-layout .fi-btn {
    min-height: 46px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--brand) !important;
    color: var(--white) !important;
    font-weight: 900 !important;
    font-size: 16px !important;
    cursor: pointer !important;
    box-shadow: none !important;
    width: 100% !important;
    padding: 0 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.fi-simple-layout button[type="submit"]:hover,
.fi-simple-layout .fi-btn:hover {
    background: var(--brand-dark) !important;
}

/* Text links (e.g., Back to Login, Forgot Password, etc.) */
.fi-simple-layout a {
    color: var(--brand) !important;
    font-weight: 700 !important;
}

.fi-simple-layout a:hover {
    color: var(--brand-dark) !important;
    text-decoration: underline !important;
}

[x-cloak] {
    display: none !important;
}

.fi-ta-selection-indicator {
    display: none !important;
}

/* Order attachments tab. */
.max-attachments-table .fi-ta-content-grid {
    gap: 10px !important;
}

.max-attachments-table .fi-ta-record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
    min-width: 0;
    border: 1px solid #d9e1ea !important;
    border-radius: 9px !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}

.max-attachments-table .fi-ta-record:hover {
    border-color: rgba(23, 82, 150, .35) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08) !important;
}

.max-attachments-table .fi-ta-record-content-ctn {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-width: 0;
}

.max-attachments-table .fi-ta-record-content-ctn > div:first-child,
.max-attachments-table .fi-ta-record-content {
    display: block;
    width: 100%;
    min-width: 0;
    text-align: left;
}

.max-attachments-table button.fi-ta-record-content {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.max-attachments-table .fi-ta-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 8px 10px 8px 4px !important;
}

.max-attachments-table .fi-ta-actions .fi-icon-btn {
    border-radius: 8px !important;
}

.max-attachment-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    min-height: 82px;
    padding: 8px 2px 8px 8px;
    color: #111827;
}

.max-attachment-card__preview {
    display: flex;
    flex: 0 0 80px;
    width: 80px;
    height: 64px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #edf1f5;
    border-radius: 7px;
    background: #f6f8fb;
}

.max-attachment-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.max-attachment-card__placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #64748b;
}

.max-attachment-card__placeholder-icon {
    width: 32px;
    height: 32px;
}

.max-attachment-card__body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.max-attachment-card__title {
    min-width: 0;
    overflow: hidden;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-attachment-card__description {
    overflow: hidden;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-attachment-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.max-attachment-card__meta span + span::before {
    content: "·";
    margin: 0 7px;
}

.max-attachment-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.max-attachment-modal__stage {
    width: 100%;
}

.max-attachment-modal__stage--image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.max-attachment-modal__image {
    max-width: 100%;
    max-height: 76vh;
    border-radius: 8px;
    object-fit: contain;
}

.max-attachment-modal__pdf {
    width: 100%;
    height: 72vh;
    min-height: 460px;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.max-attachment-modal__fallback {
    color: #64748b;
    font-size: 13px;
}

.dark .max-attachments-table .fi-ta-record {
    border-color: #263445 !important;
    background: #111827 !important;
}

.dark .max-attachments-table .fi-ta-record:hover {
    border-color: rgba(96, 165, 250, .45) !important;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .28) !important;
}

.dark .max-attachment-card,
.dark .max-attachment-card__title {
    color: #f9fafb;
}

.dark .max-attachment-card__preview,
.dark .max-attachment-modal__stage {
    border-color: #263445;
    background: #0b1120;
}

.dark .max-attachment-modal__fallback {
    color: #94a3b8;
}

.dark .max-attachment-card__description,
.dark .max-attachment-card__meta {
    color: #94a3b8;
}

.dark .max-attachment-modal__pdf {
    border-color: #263445;
}

@media (max-width: 760px) {
    .max-attachment-card__preview {
        flex-basis: 72px;
        width: 72px;
        height: 58px;
    }

    .max-attachment-modal__pdf {
        min-height: 360px;
    }

    .max-attachments-table .fi-ta-record {
        grid-template-columns: minmax(0, 1fr);
    }

    .max-attachments-table .fi-ta-record-content-ctn {
        grid-template-columns: minmax(0, 1fr);
    }

    .max-attachments-table .fi-ta-actions {
        justify-content: flex-end !important;
        padding: 0 10px 8px !important;
    }
}

.max-unsaved-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(2px);
}

.max-unsaved-dialog {
    width: 100%;
    max-width: 520px;
    padding: 28px;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.max-unsaved-title {
    margin: 0;
    color: #111827;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.3;
}

.max-unsaved-description {
    margin: 10px 0 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

.max-unsaved-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
}

.max-unsaved-button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.max-unsaved-button-back {
    background: transparent;
    color: #4b5563;
}

.max-unsaved-button-back:hover {
    background: #f3f4f6;
}

.max-unsaved-button-discard {
    border-color: #d1d5db;
    background: #fff;
    color: #374151;
}

.max-unsaved-button-discard:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.max-unsaved-button-save {
    background: #175296;
    color: #fff;
}

.max-unsaved-button-save:hover {
    background: #123f74;
}

@media (max-width: 560px) {
    .max-unsaved-dialog {
        padding: 22px;
    }

    .max-unsaved-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .max-unsaved-button {
        width: 100%;
    }
}

.max-order-chat-shell {
    overflow: hidden;
    margin-bottom: 6rem;
    scroll-margin-bottom: 6rem;
    border: 1px solid #dce3eb;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgb(15 23 42 / 5%);
}

.max-order-chat-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 3.75rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e5eaf0;
}

.max-order-chat-header h2 {
    margin: 0;
    color: #17212b;
    font-size: 1rem;
    font-weight: 750;
}

.max-order-chat-header-icon {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border-radius: 50%;
    background: #e8f1fb;
    color: #175296;
}

.max-order-chat-header-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.max-order-chat-layout {
    background: #fff;
}

.max-order-chat-messages {
    display: flex;
    min-height: 11rem;
    max-height: 34rem;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 1.15rem;
    background: #fff;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.max-order-chat-load-more {
    text-align: center;
}

.max-order-chat-load-more button {
    border: 0;
    color: #52616f;
    font-size: 0.75rem;
    font-weight: 650;
}

.max-order-chat-empty {
    display: flex;
    flex: 1;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
    min-height: 11rem;
    color: #8a98a7;
    font-size: 0.82rem;
}

.max-order-chat-empty svg {
    width: 2rem;
    height: 2rem;
}

.max-order-chat-thread {
    display: flex;
    flex-direction: column;
}

.max-order-chat-conversation-group {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.max-order-chat-conversation-group + .max-order-chat-conversation-group {
    border-top: 1px solid #dce4ec;
}

.max-order-chat-message-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.75rem;
    scroll-margin-top: 5rem;
}

.max-order-chat-message-row.max-order-chat-message-row-own {
    justify-content: flex-start;
}

.max-order-chat-avatar {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    place-items: center;
    border: 1px solid #c7d5e3;
    border-radius: 50%;
    background: #edf4fb;
    color: #175296;
    font-size: 0.72rem;
    font-weight: 800;
}

.max-order-chat-message-row-own .max-order-chat-avatar {
    border-color: #175296;
    background: #175296;
    color: #fff;
}

.max-order-chat-message-stack {
    display: flex;
    width: min(100%, 62rem);
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
}

.max-order-chat-message-row-own .max-order-chat-message-stack {
    align-items: flex-start;
    margin-right: 0;
    margin-left: 0;
}

.max-order-chat-message-meta {
    display: flex;
    width: auto;
    max-width: 100%;
    align-items: baseline;
    gap: 0.45rem;
    margin: 0 0 0.3rem;
    color: #8492a1;
    font-size: 0.72rem;
}

.max-order-chat-message-meta strong {
    color: #344557;
    font-size: 0.78rem;
    font-weight: 750;
}

.max-order-chat-message-meta time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0;
    color: #65788b;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    white-space: nowrap;
}

.max-order-chat-message-meta time svg {
    width: 0.78rem;
    height: 0.78rem;
    flex: 0 0 0.78rem;
}

.max-order-chat-own-label {
    display: inline-flex;
    align-items: center;
    min-height: 1.1rem;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    background: #e8f1fb;
    color: #175296;
    font-size: 0.62rem;
    font-weight: 750;
}

.max-order-chat-bubble {
    width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    color: #17212b;
    font-size: 0.88rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.max-order-chat-message-row-own .max-order-chat-bubble {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #17212b;
}

.max-order-chat-bubble p {
    margin-block: 0;
}

.max-order-chat-bubble [data-type='mention'] {
    border-radius: 0.3rem;
    background: #e2effd;
    color: #175296;
    padding: 0.06rem 0.25rem;
    font-weight: 750;
}

.max-order-chat-message-row-own .max-order-chat-bubble [data-type='mention'] {
    background: #e2effd;
    color: #175296;
}

.max-order-chat-message-highlighted {
    border-radius: 0.55rem;
    background: #eef6ff;
    outline: 3px solid rgb(23 82 150 / 20%);
    outline-offset: 4px;
}

.max-order-chat-reply-quote {
    display: flex;
    max-width: 100%;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.25rem;
    padding: 0.35rem 0.55rem;
    border-left: 2px solid #8ea8c2;
    color: #657687;
    font-size: 0.68rem;
    text-decoration: none;
}

.max-order-chat-reply-quote span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-order-chat-reply-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.4rem 0 0;
    border: 0;
    color: #718096;
    font-size: 0.68rem;
    font-weight: 650;
}

.max-order-chat-reply-button svg {
    width: 0.8rem;
    height: 0.8rem;
}

.max-order-chat-reply-button:hover {
    color: #175296;
}

.max-order-chat-thread-controls {
    display: flex;
    width: min(calc(100% - 3.1rem), 46rem);
    flex-direction: column;
    overflow: hidden;
    margin: 0.7rem 0 0 3.1rem;
    border: 1px solid #d4dee9;
    border-radius: 0.8rem;
    background: #f8fafc;
}

.max-order-chat-thread-controls.is-expanded {
    box-shadow: 0 1px 3px rgb(15 23 42 / 6%);
}

.max-order-chat-thread-heading {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    background: #edf3f8;
    color: #52697f;
    font-size: 0.72rem;
}

.max-order-chat-thread-heading > svg {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 0.9rem;
}

.max-order-chat-thread-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
    padding: 0.2rem 0.3rem;
    border: 0;
    color: #175296;
    font-size: 0.68rem;
    font-weight: 700;
}

.max-order-chat-thread-toggle:hover {
    color: #175296;
}

.max-order-chat-thread-toggle .max-order-chat-thread-chevron {
    width: 0.8rem;
    height: 0.8rem;
    flex: 0 0 0.8rem;
    transition: transform .15s ease;
}

.max-order-chat-thread-toggle .max-order-chat-thread-chevron.is-expanded {
    transform: rotate(180deg);
}

.max-order-chat-thread-replies {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.85rem;
    border-top: 1px solid #d4dee9;
    background: #fff;
}

.max-order-chat-thread-earlier-replies {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.max-order-chat-message-row-reply .max-order-chat-message-stack {
    width: min(100%, 58rem);
}

.max-order-chat-message-row-reply .max-order-chat-avatar {
    width: 1.85rem;
    height: 1.85rem;
    flex-basis: 1.85rem;
    font-size: 0.62rem;
}

.max-order-chat-composer {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e5eaf0;
    background: #f8fafc;
}

.max-order-chat-replying {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.6rem 0.45rem 0.7rem;
    border-left: 3px solid #175296;
    border-radius: 0.35rem;
    background: #f0f5fa;
}

.max-order-chat-replying div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.max-order-chat-replying strong,
.max-order-chat-replying span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-order-chat-replying strong {
    color: #175296;
    font-size: 0.72rem;
}

.max-order-chat-replying span {
    color: #657687;
    font-size: 0.68rem;
}

.max-order-chat-replying button {
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 1.75rem;
    place-items: center;
    border-radius: 50%;
    color: #657687;
}

.max-order-chat-replying button:hover {
    background: #e1e9f1;
    color: #17212b;
}

.max-order-chat-replying svg {
    width: 1rem;
    height: 1rem;
}

.max-order-chat-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
}

.max-order-chat-compose-field {
    min-width: 0;
    flex: 1;
}

.max-order-chat-compose-field .fi-fo-field-wrp {
    gap: 0;
}

.max-order-chat-compose-field .fi-fo-rich-editor {
    overflow: hidden;
    border-radius: 0.55rem;
    background: #fff;
}

.max-order-chat-compose-field .fi-fo-rich-editor-content {
    min-height: 3.5rem;
    max-height: 8rem;
    padding-block: 0.62rem;
    overflow-y: auto;
}

.max-order-chat-send {
    display: inline-flex;
    width: auto;
    height: 3.5rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 0.5rem;
    padding: 0 1rem;
    background: #175296;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 750;
    box-shadow: 0 2px 5px rgb(23 82 150 / 25%);
    transition: background-color .15s ease, transform .15s ease;
}

.max-order-chat-send:hover {
    background: #123f74;
    transform: translateY(-1px);
}

.max-order-chat-send:disabled {
    cursor: wait;
    opacity: 0.55;
}

.max-order-chat-send svg {
    width: 1.15rem;
    height: 1.15rem;
}

@media (max-width: 640px) {
    .max-order-chat-shell {
        margin-bottom: calc(7rem + env(safe-area-inset-bottom));
        scroll-margin-bottom: calc(7rem + env(safe-area-inset-bottom));
    }

    .max-order-chat-header {
        min-height: 3.25rem;
        padding: 0.6rem 0.75rem;
    }

    .max-order-chat-header-icon {
        width: 2rem;
        height: 2rem;
    }

    .max-order-chat-messages {
        min-height: 10rem;
        max-height: none;
        overflow-y: visible;
        padding: 0 0.75rem;
        overscroll-behavior: auto;
    }

    .max-order-chat-message-stack {
        width: calc(100% - 2.5rem);
    }

    .max-order-chat-avatar {
        width: 2rem;
        height: 2rem;
        flex-basis: 2rem;
    }

    .max-order-chat-thread-controls {
        width: calc(100% - 1rem);
        margin-left: 1rem;
    }

    .max-order-chat-bubble {
        padding: 0;
        font-size: 0.82rem;
    }

    .max-order-chat-composer {
        padding: 0.7rem 0.75rem;
    }

    .max-order-chat-send {
        width: 3rem;
        height: 3rem;
        flex-basis: 3rem;
        border-radius: 50%;
        padding: 0;
    }

    .max-order-chat-send span {
        display: none;
    }

    .max-order-chat-compose-field .fi-fo-rich-editor-content {
        min-height: 3rem;
    }

    .max-order-chat-message-meta {
        flex-wrap: wrap;
        column-gap: 0.35rem;
    }

    .max-order-chat-message-meta time {
        margin-left: 0;
        font-size: 0.66rem;
    }
}
.max-order-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.max-order-region-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d7dee7;
    border-radius: 999px;
    padding: 6px 12px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
}

.max-region-primary { color: #1d4ed8; background-color: #dbeafe; }
.max-region-info { color: #075985; background-color: #e0f2fe; }
.max-region-success { color: #166534; background-color: #dcfce7; }
.max-region-warning { color: #92400e; background-color: #fef3c7; }
.max-region-danger { color: #991b1b; background-color: #fee2e2; }
.max-region-gray { color: #374151; background-color: #f3f4f6; }

.max-work-regions-header {
    margin-bottom: 1rem;
}

.max-work-regions-header h2 {
    color: var(--gray-950);
    font-size: 1.125rem;
    font-weight: 700;
}

.max-work-regions-header p {
    margin-top: .25rem;
    color: var(--gray-500);
    font-size: .875rem;
}

.max-work-regions-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

.max-work-region-card {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    border-radius: .75rem;
    background: var(--gray-50);
    box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}

.max-work-region-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    color: inherit;
    text-decoration: none;
}

.max-work-region-summary span {
    display: grid;
    gap: .2rem;
}

.max-work-region-summary strong { font-size: 1rem; }
.max-work-region-summary small { opacity: .75; font-size: .75rem; }
.max-work-region-summary b { font-size: 1.75rem; line-height: 1; }

.max-work-region-postcodes {
    display: grid;
    border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    background: var(--gray-50);
}

.max-work-region-postcodes a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
    font-size: .8125rem;
    text-decoration: none;
}

.max-work-region-postcodes a:hover { background: var(--gray-100); }
.max-work-region-postcodes small { color: var(--gray-500); }
.max-work-region-empty { padding: .8rem 1rem; color: var(--gray-500); font-size: .8125rem; }

.max-work-region-card > button {
    width: 100%;
    padding: .65rem 1rem;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: .75rem;
    font-weight: 600;
    text-align: left;
}

@media (min-width: 640px) {
    .max-work-regions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .max-work-regions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
