/* FlowClean CRM brand styles
   Brand: FlowClean Services
   Primary accent: #00ABF0 (water blue), Charcoal: #0f172a, Success: #20BD5A
*/

:root {
    --brand-500: #00abf0;
    --brand-600: #0091cc;
    --brand-700: #006d99;
    --brand-50: #e6f7fe;
    --charcoal: #0f172a;
    --success: #20bd5a;
}

html, body { height: 100%; }
body {
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f6f8fb;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}
html.nav-open,
html.nav-open body {
    overflow: hidden;
    touch-action: none;
}
[x-cloak] { display: none !important; }

/* Mobile sidebar overlay must sit above page content and remain tappable */
.app-sidebar-overlay {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.app-sidebar {
    max-width: min(18rem, 86vw);
    background: #0a1120;
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.28);
}
@media (min-width: 1024px) {
    .app-sidebar {
        max-width: none;
        box-shadow: none;
    }
}

h1, h2, h3, h4, h5, .font-display {
    font-family: 'Montserrat', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

/* Brand utility shortcuts */
.bg-brand     { background-color: var(--brand-500); }
.bg-brand-dk  { background-color: var(--brand-700); }
.text-brand   { color: var(--brand-500); }
.border-brand { border-color: var(--brand-500); }

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.04);
}

.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.1rem; border-radius: 12px;
    font-weight: 600; font-size: 0.875rem; line-height: 1;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--brand-500); color: #fff; }
.btn-primary:hover { background: var(--brand-600); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,171,240,0.25); }
.btn-dark { background: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-outline { background: #fff; color: #0f172a; border-color: #e5e7eb; }
.btn-outline:hover { border-color: var(--brand-500); color: var(--brand-600); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #19a149; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Sidebar */
.sidebar-brand-link {
    display: block;
    line-height: 0;
}
.sidebar-logo-img {
    display: block;
    width: 100%;
    max-width: 11.5rem;
    height: auto;
}
.sidebar-brand-name {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.15;
    color: #fff;
    letter-spacing: -0.01em;
}
.sidebar-brand-sub {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #33bff7;
}
.sidebar-logo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    background: var(--brand-500);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 171, 240, 0.28);
}
.sidebar-logo-mark {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    color: #fff;
    letter-spacing: -0.04em;
    position: relative;
}
.sidebar-logo-mark::after {
    content: "";
    display: block;
    width: 0.85rem;
    height: 2px;
    margin: 0.12rem auto 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
}
.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.sidebar-nav-item { margin: 0; }
.sidebar-nav-list > .sidebar-nav-item + .sidebar-nav-item {
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: 48px;
    padding: 0.8rem 0.95rem;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-link:focus-visible {
    outline: 2px solid rgba(0, 171, 240, 0.85);
    outline-offset: 2px;
}
.sidebar-link.active {
    background: var(--brand-500);
    color: #fff;
    font-weight: 600;
    box-shadow: none;
}
.sidebar-link.section-active {
    background: rgba(0, 171, 240, 0.12);
    color: #fff;
}
.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.75;
}
.sidebar-chevron {
    width: 16px !important;
    height: 16px !important;
    margin-left: auto;
    opacity: 0.85;
    transition: transform 0.2s ease;
}
.sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}
.sidebar-submenu {
    list-style: none;
    margin: 0.1rem 0 0.45rem 0.95rem;
    padding: 0.1rem 0 0.15rem 0.75rem;
    border-left: 2px solid rgba(148, 163, 184, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.sidebar-sublink {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    color: rgba(226, 232, 240, 0.78);
    font-weight: 500;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.sidebar-sublink:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-sublink:focus-visible {
    outline: 2px solid rgba(0, 171, 240, 0.85);
    outline-offset: 2px;
}
.sidebar-sublink.active {
    background: var(--brand-500);
    color: #fff;
    box-shadow: none;
}
.sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.sidebar-signout {
    color: rgba(255, 255, 255, 0.92);
}

/* Inputs styled by @tailwindcss/forms — keep consistent radius */
input, select, textarea { border-radius: 12px !important; }
input:focus, select:focus, textarea:focus {
    --tw-ring-color: var(--brand-500) !important;
    border-color: var(--brand-500) !important;
}

/* Table */
.table-modern { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-modern thead th {
    text-align: left; padding: 0.8rem 1rem; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; font-weight: 700;
    background: #f8fafc; border-bottom: 1px solid #e5e7eb;
}
.table-modern tbody td {
    padding: 0.95rem 1rem; font-size: 0.9rem;
    border-top: 1px solid #f1f5f9;
}
.table-modern tbody tr:hover { background: #f8fafc; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Calendar (legacy + new month UI) */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day {
    background: #fff; border-radius: 10px; padding: 8px;
    min-height: 110px; border: 1px solid #f1f5f9;
    display: flex; flex-direction: column; gap: 4px;
}
.calendar-day.muted { background: #f8fafc; color: #94a3b8; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--brand-500); }
.calendar-event {
    font-size: 11px; padding: 2px 6px; border-radius: 6px;
    background: var(--brand-50); color: var(--brand-700);
    font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer; text-decoration: none; display: block;
}
.calendar-event.completed { background: #dcfce7; color: #166534; }
.calendar-event.overdue { background: #fee2e2; color: #991b1b; }

/* Calendar view toggle (hero) */
.cal-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
}
.cal-view-toggle__btn {
    padding: 0.4rem 0.9rem;
    border-radius: 9px;
    font-size: 0.875rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.cal-view-toggle__btn:hover { background: rgba(255, 255, 255, 0.12); }
.cal-view-toggle__btn.is-active {
    background: #fff;
    color: var(--brand-700);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* Filter bar */
.cal-filters { padding: 0.9rem 1rem; }
.cal-filters__row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.65rem;
}
.cal-filters__spacer { flex: 1 1 0.5rem; min-width: 0.5rem; }
.cal-filters__hint {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: #64748b;
}
.cal-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 0.45rem 0.85rem 0.45rem 0.7rem;
    min-width: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cal-filter:hover { border-color: #cbd5e1; }
.cal-filter__icon {
    color: var(--brand-600);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.cal-filter__icon svg { width: 0.95rem; height: 0.95rem; }
.cal-filter__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.cal-filter__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.cal-filter__select {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.1rem 1.35rem 0 0 !important;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    max-width: 150px;
    border-radius: 0 !important;
    margin: 0;
    line-height: 1.3;
}
.cal-filter__select:focus { outline: none; --tw-ring-shadow: none !important; }

/* Month board */
.cal-board__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}
.cal-board__title {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: #0f172a;
    min-width: 9.5rem;
    text-align: center;
}
.cal-board__nav-btn {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #475569;
    display: grid;
    place-items: center;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cal-board__nav-btn:hover {
    background: var(--brand-50);
    border-color: var(--brand-200);
    color: var(--brand-700);
}
.cal-board__body { padding: 0.85rem 1rem 1rem; }
.cal-dow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 0.35rem;
}
.cal-dow__cell {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: #94a3b8;
    padding: 0.35rem 0.5rem;
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    background: #e5e7eb;
}
.cal-day {
    background: #fff;
    min-height: 138px;
    padding: 0.55rem 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-right: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    position: relative;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-muted { background: #f8fafc; }
.cal-day.is-muted .cal-day__num { color: #94a3b8; }
.cal-day.is-selected {
    box-shadow: inset 0 0 0 2px var(--brand-500);
    background: #f0faff;
    z-index: 1;
}
.cal-day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 1px rgba(0, 171, 240, 0.35);
}
.cal-day.is-drop-target.is-drop-over,
[data-cal-drop-date].is-drop-over {
    background: #e0f2fe !important;
    box-shadow: inset 0 0 0 2px var(--brand-500);
    z-index: 2;
}
body.cal-route-dragging {
    cursor: grabbing;
}
body.cal-route-dragging .cal-day.is-drop-target {
    background: #f8fbff;
}
.cal-event.is-draggable,
.cal-side-job.is-draggable,
[data-cal-route].is-draggable {
    cursor: grab;
    touch-action: none;
}
.cal-event.is-dragging,
.cal-side-job.is-dragging,
[data-cal-route].is-dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.cal-event.is-saving,
[data-cal-route].is-saving {
    opacity: 0.65;
    pointer-events: none;
}
.cal-day__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.15rem;
}
.cal-day__num {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
}
.cal-day__num.is-active,
.cal-day.is-selected .cal-day__num,
.cal-day.is-today .cal-day__num {
    background: var(--brand-500);
    color: #fff;
}
.cal-day__add {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: #cbd5e1;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.cal-day:hover .cal-day__add,
.cal-day.is-selected .cal-day__add { opacity: 1; }
.cal-day__add:hover { background: var(--brand-50); color: var(--brand-600); }
.cal-day__events { display: flex; flex-direction: column; gap: 0.3rem; min-height: 0; }
.cal-day__more {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    padding: 0 2px;
}
.cal-day__more:hover { color: var(--brand-600); }

.cal-event {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border-radius: 10px;
    padding: 0.4rem 0.45rem 1.35rem;
    background: #f0f9ff;
    border: 1px solid #dbeafe;
    position: relative;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cal-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}
.cal-event--completed { background: #ecfdf5; border-color: #bbf7d0; }
.cal-event--overdue { background: #fef2f2; border-color: #fecaca; }
.cal-event--cancelled { background: #f8fafc; border-color: #e2e8f0; opacity: 0.75; }
.cal-event--route {
    background: #e0f2fe;
    border-color: #7dd3fc;
    display: block;
    text-decoration: none;
    color: inherit;
}
.cal-event--route:hover { background: #bae6fd; border-color: #38bdf8; }
.cal-event__badge--route {
    background: #0284c7;
    color: #fff;
}

/* Set-route view modal */
.set-route-view-panel {
    width: min(1100px, calc(100vw - 1.5rem));
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.set-route-view-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.95fr);
    gap: 0;
    min-height: 0;
    flex: 1;
}
.set-route-view-panel.is-comparing {
    width: min(1200px, calc(100vw - 1.5rem));
}
.set-route-view-panel.is-comparing .set-route-view-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.85fr);
}
.set-route-view-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(70vh, 560px);
    overflow: hidden;
    border-right: 1px solid #e5e7eb;
}
.set-route-view-list {
    overflow-y: auto;
    max-height: none;
    flex: 1 1 auto;
    border-right: 0;
}
.set-route-view-unassigned {
    overflow-y: auto;
    flex: 1 1 auto;
    border-top: 1px solid #fed7aa;
    background: #fffbeb;
}
.set-route-view-unassigned.hidden { display: none; }
.set-route-side-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0369a1;
    background: #f0f9ff;
    border-bottom: 1px solid #e0f2fe;
    position: sticky;
    top: 0;
    z-index: 1;
}
.set-route-side-heading span {
    font-variant-numeric: tabular-nums;
    color: #0284c7;
}
.set-route-side-heading--unassigned {
    color: #9a3412;
    background: #ffedd5;
    border-bottom-color: #fed7aa;
}
.set-route-side-heading--unassigned span { color: #c2410c; }
.set-route-view-map {
    min-height: 320px;
    height: min(70vh, 560px);
    background: #f1f5f9;
}
.set-route-review-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #fed7aa;
    background: #fff7ed;
}
.set-route-review-bar.hidden { display: none; }
.set-route-review-bar__copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1 1 16rem;
}
.set-route-review-bar__copy strong {
    color: #9a3412;
    font-size: 0.9rem;
}
.set-route-review-bar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}
.set-route-compare-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #bae6fd;
    background: #f0f9ff;
}
.set-route-compare-bar.hidden { display: none; }
.set-route-view-compare-table {
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}
.set-route-view-compare-table.hidden { display: none; }
.set-route-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.set-route-compare-table th {
    text-align: left;
    padding: 0.55rem 0.75rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.set-route-compare-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
}
.set-route-compare-table tr.is-current {
    background: #f0f9ff;
}
.set-route-compare-table tr.is-current td {
    font-weight: 600;
}
.set-route-compare-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    vertical-align: middle;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
}
.set-route-compare-name {
    font-weight: 700;
    color: #0f172a;
}
.set-route-compare-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.68rem;
    font-weight: 800;
}
.set-route-map-label--compare span {
    border-width: 2px;
}
.set-route-job {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}
.set-route-job--unassigned {
    border-bottom-color: #ffedd5;
    background: #fffbeb;
}
.set-route-job--unassigned.is-pending {
    background: #ffedd5;
    box-shadow: inset 3px 0 0 #f97316;
}
.set-route-job__num {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.set-route-job__num--unassigned {
    background: #ffedd5;
    color: #c2410c;
}
.set-route-job.is-pending .set-route-job__num--unassigned {
    background: #f97316;
    color: #fff;
}
.set-route-job__title { font-weight: 700; color: #0f172a; }
.set-route-job__start {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}
.set-route-job__addr { font-size: 0.8rem; color: #475569; margin-top: 0.15rem; }
.set-route-job__timing {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.set-route-job__meta { font-size: 0.75rem; color: #64748b; margin-top: 0.2rem; }
.set-route-map-label span {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #0ea5e9;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.set-route-map-label--unassigned span {
    background: #f97316;
}
.set-route-map-label--unassigned.is-pending span {
    background: #ea580c;
}
@media (max-width: 900px) {
    .set-route-view-grid { grid-template-columns: 1fr; }
    .set-route-view-side {
        max-height: 42vh;
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }
    .set-route-view-map { height: 40vh; min-height: 240px; }
}
.cal-event__time {
    font-size: 10px;
    font-weight: 800;
    color: var(--brand-600);
    line-height: 1.2;
}
.cal-event__name {
    font-size: 11px;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    line-height: 1.25;
}
.cal-event__meta,
.cal-event__area {
    font-size: 9px;
    color: #64748b;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.cal-event__badge {
    position: absolute;
    left: 0.35rem;
    bottom: 0.3rem;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
}
.cal-event--completed .cal-event__badge,
.cal-event__badge--completed { background: #dcfce7; color: #166534; }
.cal-event--overdue .cal-event__badge,
.cal-event__badge--overdue { background: #fee2e2; color: #991b1b; }
.cal-event__badge--scheduled { background: #dbeafe; color: #1d4ed8; }
.cal-event__badge--cancelled { background: #e2e8f0; color: #475569; }

/* Sidebar */
.cal-side {
    display: flex;
    flex-direction: column;
}
.cal-side__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #f1f5f9;
}
.cal-side__title {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    line-height: 1.25;
    color: #0f172a;
}
.cal-side__pill {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid #cceffd;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}
.cal-side__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    padding: 0.9rem 1rem;
}
.cal-stat {
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 0.7rem 0.4rem;
    text-align: center;
}
.cal-stat__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    margin: 0 auto 0.35rem;
    display: grid;
    place-items: center;
}
.cal-stat__icon svg { width: 0.95rem; height: 0.95rem; }
.cal-stat__label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 800;
}
.cal-stat__value {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    margin-top: 0.15rem;
    color: #0f172a;
}

.cal-side__jobs { padding: 0 1rem 1rem; }
.cal-side__jobs--empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}
.cal-side__section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.65rem;
}
.cal-side__empty {
    text-align: center;
    font-size: 0.875rem;
    color: #94a3b8;
    padding: 2rem 0.5rem;
}
.cal-side__day-off {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px dashed #e2e8f0;
    border-radius: 16px;
    margin-top: 0.25rem;
}
.cal-side__day-off-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0284c7;
    display: grid;
    place-items: center;
    margin-bottom: 0.85rem;
}
.cal-side__day-off-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}
.cal-side__day-off-title {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: #0f172a;
}
.cal-side__day-off-text {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: #64748b;
}
.cal-side-job {
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 0.9rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.cal-side-job__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}
.cal-side-job__heading {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
}
.cal-side-job__time {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--brand-600);
}
.cal-side-job__name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}
.cal-side-job__service {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}
.cal-side-job__addr {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-side-job__meta {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}
.cal-side-job__price {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: #0f172a;
}
.cal-side-job__meta .cal-event__badge {
    position: static;
}
.cal-side-job__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e5e7eb;
}
.cal-side-job__actions a,
.cal-side-job__actions button:not(.cal-side-job__done) {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-700);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.cal-side-job__actions a:hover,
.cal-side-job__actions button:not(.cal-side-job__done):hover { text-decoration: underline; }
.cal-side-job__done {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--success);
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: 0.4rem 0.75rem;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.cal-side-job__done:hover { background: #19a149; }

.cal-side__alerts {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.cal-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
}
.cal-alert__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.cal-alert__link {
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.15rem;
}
.cal-alert__link:hover { text-decoration: underline; }
.cal-alert__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}
.cal-alert--success { background: #ecfdf5; color: #166534; }
.cal-alert--success .cal-alert__icon { background: #bbf7d0; color: #166534; }
.cal-alert--success .cal-alert__link { color: #166534; }
.cal-alert--danger { background: #fef2f2; color: #991b1b; }
.cal-alert--danger .cal-alert__icon { background: #fecaca; color: #991b1b; }
.cal-alert--danger .cal-alert__link { color: #991b1b; }

/* Calendar route work modal */
.route-work {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.route-work[hidden] { display: none !important; }
.route-work__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
.route-work__panel {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: min(92vh, 900px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: routeWorkPop 0.2s ease-out;
}
@keyframes routeWorkPop {
    from { transform: translateY(12px) scale(0.98); opacity: 0.85; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.route-work__head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem 1.35rem 1rem;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(135deg, #f0f9ff 0%, #fff 70%);
    flex-shrink: 0;
}
.route-work__brand {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
    flex: 1;
}
.route-work__brand-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    background: #e0f2fe;
    color: #0284c7;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.route-work__brand-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}
.route-work__eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0284c7;
}
.route-work__title {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.45rem;
    color: #0f172a;
    margin-top: 0.15rem;
    line-height: 1.25;
}
.route-work__meta {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #64748b;
}
.route-work__close {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    cursor: pointer;
}
.route-work__close:hover { background: #f8fafc; }
.route-work__progress {
    padding: 0.85rem 1.35rem;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
    flex-shrink: 0;
}
.route-work__progress-bar {
    height: 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.route-work__progress-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #00abf0, #0284c7);
    border-radius: 999px;
}
.route-work__progress-text {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}
.route-work__state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: #64748b;
    text-align: center;
    min-height: 220px;
}
.route-work__state--error { color: #991b1b; }
.route-work__list {
    flex: 1;
    overflow: auto;
    padding: 1.1rem 1.25rem 1.35rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    align-content: start;
    background: #f8fafc;
}
@media (min-width: 768px) {
    .route-work__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        padding: 1.2rem 1.35rem 1.5rem;
    }
}
.route-work__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    font-size: 0.95rem;
    padding: 2.5rem 1rem;
}
.route-work__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.25rem;
    border-top: 1px solid #eef2f7;
    background: #fff;
    flex-shrink: 0;
}
.route-work__full-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.route-work__foot-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}
.route-work__foot-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.route-work-stop {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem 1.05rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}
.route-work-stop:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.route-work-stop.is-completed {
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.route-work-stop.is-not_completed {
    border-color: #fecaca;
    background: #fef2f2;
}
.route-work-stop.is-saving { opacity: 0.6; pointer-events: none; }
.route-work-stop__top {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
}
.route-work-stop__seq {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    background: #0284c7;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
}
.route-work-stop.is-completed .route-work-stop__seq { background: #16a34a; }
.route-work-stop.is-not_completed .route-work-stop__seq { background: #dc2626; }
.route-work-stop__name {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
    font-size: 1.05rem;
    padding-top: 0.15rem;
}
.route-work-stop__row {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.4rem;
}
.route-work-stop__ico {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: #0284c7;
}
.route-work-stop__addr,
.route-work-stop__bits,
.route-work-stop__contact {
    font-size: 0.84rem;
    color: #64748b;
}
.route-work-stop__addr-link {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #0284c7;
    text-decoration: none;
    line-height: 1.35;
}
.route-work-stop__addr-link:hover { text-decoration: underline; }
.route-work-stop__maps {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0369a1;
    text-decoration: none;
}
.route-work-stop__maps:hover { text-decoration: underline; }
.route-work-stop__ext {
    width: 0.85rem;
    height: 0.85rem;
}
.route-work-stop__phone { color: #0284c7; font-weight: 600; font-size: 0.84rem; text-decoration: none; }
.route-work-stop__phone:hover { text-decoration: underline; }
.route-work-stop__warn {
    margin-top: 0.45rem;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 800;
    color: #b45309;
    background: #ffedd5;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}
.route-work-stop__access {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #475569;
    white-space: pre-line;
}
.route-work-stop__badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    background: #e2e8f0;
    color: #475569;
}
.route-work-stop.is-completed .route-work-stop__badge { background: #dcfce7; color: #166534; }
.route-work-stop.is-not_completed .route-work-stop__badge { background: #fee2e2; color: #991b1b; }
.route-work-stop.is-open .route-work-stop__badge { background: #dbeafe; color: #1d4ed8; }
.route-work-stop__note-label {
    display: block;
    margin-top: 0.85rem;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.route-work-stop__note-hint { font-weight: 600; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.route-work-stop__note {
    width: 100%;
    margin-top: 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 2.6rem;
    background: #fff;
}
.route-work-stop__note:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.route-work-stop__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.7rem;
}
.route-work-stop__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.route-work-stop__note-readonly {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px dashed #e2e8f0;
}
.route-work-stop__note-readonly p {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #334155;
    white-space: pre-line;
}
.route-work-stop__readonly-hint {
    margin-top: 0.65rem;
    font-size: 0.78rem;
    color: #94a3b8;
}
@media (max-width: 640px) {
    .route-work {
        padding: 0;
        align-items: stretch;
    }
    .route-work__panel {
        width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* Job preview modal */
.job-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}
@media (min-width: 640px) {
    .job-modal {
        align-items: center;
        padding: 1.5rem;
    }
}
.job-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
.job-modal__panel {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.28);
}
.job-modal__close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 0;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.job-modal__close:hover { background: #f8fafc; }
.job-modal__loading,
.job-modal__error {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #64748b;
}
.job-modal__spinner {
    margin: 0 auto 0.85rem;
    border-color: rgba(0, 171, 240, 0.25);
    border-top-color: var(--brand-500);
}
.job-modal__hero {
    background: linear-gradient(135deg, #0091cc 0%, #00abf0 45%, #006d99 100%);
    color: #fff;
    padding: 1.35rem 1.35rem 1.2rem;
    border-radius: 20px 20px 0 0;
}
.job-modal__pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.job-modal__pill.is-scheduled,
.job-modal__pill.is-in_progress { background: #dbeafe; color: #1d4ed8; }
.job-modal__pill.is-completed,
.job-modal__pill.is-paid { background: #dcfce7; color: #166534; }
.job-modal__pill.is-overdue,
.job-modal__pill.is-unpaid { background: #fee2e2; color: #991b1b; }
.job-modal__pill.is-partial { background: #ffedd5; color: #c2410c; }
.job-modal__pill.is-recurring { background: rgba(255, 255, 255, 0.22); color: #fff; }
.job-modal__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid #f1f5f9;
}
.job-modal__metrics > div {
    padding: 0.9rem 1rem;
    border-right: 1px solid #f1f5f9;
}
.job-modal__metrics > div:last-child { border-right: 0; }
.job-modal__metric-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.job-modal__metric-value {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    margin-top: 0.2rem;
    color: #0f172a;
}
.job-modal__body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.job-modal__block {
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    background: #fafbfc;
}
.job-modal__block-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}
.job-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.25rem 1.25rem;
    align-items: center;
}

@media (max-width: 1280px) {
    .cal-event__area { display: none; }
}
@media (max-width: 1024px) {
    .cal-day { min-height: 100px; }
    .cal-event__meta { display: none; }
}
@media (max-width: 768px) {
    .calendar-day { min-height: 70px; padding: 4px; }
    .calendar-event { font-size: 10px; }
    .cal-month-grid { border-radius: 12px; }
    .cal-day { min-height: 88px; padding: 0.4rem; }
    .cal-event { padding: 0.3rem 0.35rem 1.15rem; }
    .cal-filter__select { max-width: 110px; }
    .cal-board__title { font-size: 1.1rem; min-width: 8rem; }
    .cal-side-job__heading { flex-direction: column; align-items: flex-start; gap: 0.1rem; }

    .cal-filters { padding: 0.75rem; }
    .cal-filters__row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }
    .cal-filters__spacer { display: none; }
    .cal-filter {
        width: 100%;
        min-width: 0;
    }
    .cal-filter__select { max-width: none; width: 100%; }
    .cal-filters__row > .btn,
    .cal-filters__row > a.btn {
        grid-column: 1 / -1;
        justify-content: center;
    }
    .cal-board__body { padding: 0.55rem 0.45rem 0.65rem; }
    .cal-dow__cell { font-size: 10px; padding: 0.25rem 0.15rem; }
    .dash-hero__bg { padding-left: 1rem !important; padding-right: 1rem !important; }
    .dash-hero .btn { padding: 0.55rem 0.85rem; }
    .cal-view-toggle { width: 100%; justify-content: stretch; }
    .cal-view-toggle__btn { flex: 1; text-align: center; padding: 0.45rem 0.5rem; }
}

/* Mobile-friendly tap targets + overflow safety */
@media (max-width: 768px) {
    .btn { padding: 0.75rem 1.1rem; font-size: 0.95rem; }
    .card { border-radius: 14px; }
    main .grid { gap: 0.85rem; }
    .table-modern { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .overflow-x-auto { -webkit-overflow-scrolling: touch; }
}

/* Spinner */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Client portal (proposals & contracts) */
.client-header {
    background: #0f172a;
    color: #fff;
    border-bottom: 3px solid #00abf0;
}
.client-header a { color: #99dffb; }
.client-header a:hover { color: #fff; }
.client-header .client-logo {
    display: block;
    height: 72px;
    width: auto;
    max-width: min(320px, 78vw);
    object-fit: contain;
}
.client-header .client-ref-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #99dffb;
    font-weight: 600;
}
.client-header .client-ref-value {
    font-family: ui-monospace, monospace;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}
@media (min-width: 640px) {
    .client-header .client-logo { height: 80px; max-width: 360px; }
}

/* Dashboard hero */
.dash-hero__bg {
    background: linear-gradient(135deg, #0091cc 0%, #00abf0 45%, #006d99 100%);
}
.dash-hero__art {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.dash-hero__svg {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: min(420px, 55%);
    height: auto;
    color: #fff;
    opacity: 0.95;
}
@media (max-width: 768px) {
    .dash-hero__svg { opacity: 0.35; width: 70%; right: -40px; }
}

/* Print styles for quote PDFs / invoices */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}

/* ── Routes page (mobile-first cleaner workflow) ─────────── */
.route-page {
    max-width: 100%;
    overflow-x: clip;
}
.route-page .card,
.route-page .route-stop,
.route-page input,
.route-page select,
.route-page textarea {
    max-width: 100%;
}
.route-page a:focus-visible,
.route-page button:focus-visible,
.route-page input:focus-visible,
.route-page select:focus-visible,
.route-page textarea:focus-visible,
.route-page .btn:focus-visible {
    outline: 3px solid rgba(0, 171, 240, 0.55);
    outline-offset: 2px;
}

.route-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .route-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
}
@media (min-width: 1280px) {
    .route-summary-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
.route-summary-card {
    min-height: 5.5rem;
    min-width: 0;
}
.route-summary-card .font-display {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.route-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.route-alert--warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.route-alert--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.route-alert--success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.route-alert--info {
    background: #e6f7fe;
    border-color: #99dffb;
    color: #006d99;
}
.route-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0, 109, 153, 0.25);
    border-top-color: #006d99;
    border-radius: 50%;
    animation: route-spin 0.7s linear infinite;
    flex-shrink: 0;
    margin-top: 0.15rem;
}
@keyframes route-spin {
    to { transform: rotate(360deg); }
}

.route-stop {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem 1rem;
    align-items: start;
    padding: 1rem;
    min-width: 0;
}
.route-stop--locked {
    background: rgba(251, 191, 36, 0.12);
}
.route-stop.is-dragging {
    opacity: 0.55;
    box-shadow: inset 0 0 0 2px var(--brand-500);
}
.route-stop-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.route-stop-number {
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: var(--brand-500);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0, 171, 240, 0.28);
}
.route-stop-order {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}
.route-order-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
    justify-content: center;
    padding: 0.45rem !important;
    white-space: normal;
}
.drag-handle {
    touch-action: none;
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #64748b;
    cursor: grab;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

.route-stop-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.route-stop-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.75rem;
}
.route-stop-title {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
    flex: 1 1 10rem;
}
.route-stop-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.route-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    border: 1px solid transparent;
}
.route-badge--dog {
    background: #fbbf24;
    color: #78350f;
    border-color: #f59e0b;
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.route-badge--locked {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}
.route-badge--fixed {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: #99dffb;
}
.route-badge--invalid {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.route-note {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.65rem 0.8rem;
    white-space: normal;
    overflow-wrap: anywhere;
}
.route-note--access {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fdba74;
}
.route-note--gate {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}
.route-note__label {
    font-weight: 800;
}

.route-address {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.route-times {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.route-time-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    min-width: 0;
}
.route-time-card__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.15rem;
}
.route-time-card__value {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.1;
    color: #0f172a;
}
.route-stop-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.route-stop-meta > div {
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    min-width: 0;
}
.route-stop-meta > div > div {
    overflow-wrap: anywhere;
}

.route-delay {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.route-delay--early,
.route-delay--waiting {
    background: #e6f7fe;
    color: #006d99;
    border-color: #99dffb;
}
.route-delay--ontime {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.route-delay--atrisk {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fdba74;
}
.route-delay--late,
.route-delay--delayed {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.route-delay--unknown {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}
.route-live-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.route-workflow {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 100%;
}
.route-workflow__primary .btn,
.route-primary-action {
    width: 100%;
    min-height: 3.15rem;
    justify-content: center;
    font-size: 1rem !important;
    padding: 0.9rem 1.1rem !important;
    white-space: normal;
    text-align: center;
}
.route-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.route-secondary-actions .btn {
    flex: 1 1 calc(33.333% - 0.45rem);
    min-width: 5.5rem;
    min-height: 2.75rem;
    justify-content: center;
    white-space: normal;
    text-align: center;
}
.route-skip-action {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
}
.route-stop-error {
    display: none;
    margin-top: 0.35rem;
}
.route-stop-error.is-visible {
    display: flex;
}
.route-stop-price {
    font-family: Montserrat, system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
}

.route-btn-spinner {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    margin-right: 0.4rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: route-spin 0.7s linear infinite;
    vertical-align: -2px;
}
.btn-outline .route-btn-spinner,
.btn-dark .route-btn-spinner {
    border-color: rgba(15, 23, 42, 0.2);
    border-top-color: #0f172a;
}

/* Skip modal — phone friendly */
#route-skip-modal:not(.hidden) {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
#route-skip-modal .route-skip-panel {
    width: min(28rem, 100%);
    max-height: min(92vh, 40rem);
    overflow: auto;
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding: 1.25rem;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) {
    #route-skip-modal:not(.hidden) {
        align-items: center;
        padding: 1rem;
    }
    #route-skip-modal .route-skip-panel {
        border-radius: 16px;
        margin: 0 auto;
    }
}

/* Calendar: realign future routes confirm */
.route-realign-modal:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.route-realign-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}
.route-realign-modal__panel {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding: 1.25rem;
}
@media (min-width: 640px) {
    .route-realign-modal:not(.hidden) {
        align-items: center;
        padding: 1rem;
    }
    .route-realign-modal__panel {
        border-radius: 16px;
    }
}

@media (max-width: 767px) {
    .route-toolbar,
    .route-controls-actions {
        width: 100%;
    }
    .route-toolbar .btn,
    .route-controls-actions .btn {
        min-height: 2.75rem;
        white-space: normal;
        text-align: center;
    }
    .route-nav-date {
        font-size: 1rem;
        margin-left: 0 !important;
        width: 100%;
    }
    .route-stop {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .route-stop-rail {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }
    .route-stop-order {
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
        flex: 1 1 auto;
    }
    .route-stop-number {
        width: 3.25rem;
        height: 3.25rem;
        font-size: 1.4rem;
    }
    .route-times {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .route-time-card__value {
        font-size: 1.45rem;
    }
    .route-secondary-actions .btn {
        flex: 1 1 calc(50% - 0.45rem);
    }
    .duration-panel .btn,
    .duration-preset {
        min-height: 2.5rem;
    }
    /* Prefer move buttons over drag on phones; keep handle available but quieter */
    .drag-handle {
        order: 99;
        opacity: 0.75;
    }
}

@media (min-width: 768px) {
    .route-stop {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 1.25rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .route-stop-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(12rem, 15rem);
        gap: 1rem 1.25rem;
        align-items: start;
    }
    .route-stop-main {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    .route-stop-aside {
        min-width: 0;
    }
    .route-workflow {
        max-width: none;
        margin-left: 0;
    }
    .route-stop-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Route Builder — stepped modal on portal/routes.php
   ========================================================================== */

.rb-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}
.rb-modal.hidden { display: none; }
.rb-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.rb-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    margin: 0.75rem auto 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    background: #fff;
}
.rb-modal[data-rb-step="2"] .rb-modal__dialog,
.rb-modal[data-rb-step="3"] .rb-modal__dialog,
.rb-modal[data-rb-step="4"] .rb-modal__dialog {
    width: min(1120px, 100%);
}
.rb-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.25rem 1.35rem 1rem;
    border-bottom: 1px solid #eef2f7;
}
.rb-modal__title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}
.rb-modal__icon {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--brand-50);
    color: var(--brand-600);
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.rb-modal__icon svg {
    width: 1.2rem;
    height: 1.2rem;
}
.rb-modal__title {
    font-family: var(--font-display, inherit);
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin: 0;
}
.rb-modal__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.35;
}
.rb-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 0.65rem;
    color: #64748b;
}
.rb-modal__body {
    overflow-y: auto;
    padding: 1.15rem 1.35rem 1.25rem;
    flex: 1;
    min-height: 0;
    background: #fff;
}
.rb-modal__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.95rem 1.35rem;
    border-top: 1px solid #eef2f7;
    background: #fff;
}
.rb-modal__footer-spacer { flex: 1; min-width: 0.5rem; }
.rb-modal__next::after {
    content: '›';
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1;
    margin-left: 0.1rem;
}
.rb-modal__back::before {
    content: '‹';
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1;
    margin-right: 0.1rem;
}

.rb-section-head--order {
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.95rem;
}
.rb-order-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.rb-order-toolbar .btn {
    gap: 0.35rem;
}
.rb-order-toolbar svg {
    flex-shrink: 0;
}

.rb-order-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid #bae6fd;
    background: #f0f9ff;
}
.rb-order-banner.hidden { display: none; }
.rb-order-banner__text {
    color: #0369a1;
    font-size: 0.9rem;
    line-height: 1.4;
    min-width: 0;
    flex: 1 1 16rem;
}
.rb-order-banner__text strong {
    color: #0c4a6e;
}
.rb-order-banner__hint {
    color: #0284c7;
    font-weight: 500;
}
.rb-order-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.rb-order-banner__actions .btn {
    gap: 0.35rem;
}

.route-builder-stop-list {
    gap: 0.55rem;
    max-height: 36rem;
}

.rb-order-stop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #e5eaf1;
    border-radius: 0.85rem;
    background: #fff;
    min-width: 0;
}
.rb-order-stop.is-dragging {
    opacity: 0.55;
    box-shadow: inset 0 0 0 2px var(--brand-500);
}
.rb-order-stop.is-drag-over {
    box-shadow: inset 0 0 0 2px #7dd3fc;
    background: #f8fcff;
}
.rb-order-stop__handle {
    color: #94a3b8;
    cursor: grab;
    font-size: 1rem;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
    letter-spacing: -0.05em;
}
.rb-order-stop__handle:active { cursor: grabbing; }
.rb-order-stop__time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.6rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.55rem;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.rb-order-stop__body {
    min-width: 0;
    flex: 1 1 auto;
}
.rb-order-stop__title {
    color: #0f172a;
    font-size: 0.92rem;
    line-height: 1.35;
}
.rb-order-stop__title strong {
    font-weight: 800;
}
.rb-order-stop__postcode {
    color: #64748b;
    font-weight: 500;
}
.rb-order-stop__freq {
    color: var(--brand-600);
    font-weight: 600;
}
.rb-order-stop__meta {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.35;
}
.rb-order-remove {
    flex-shrink: 0;
    gap: 0.3rem;
    color: #64748b;
}
@media (max-width: 640px) {
    .rb-order-stop {
        flex-wrap: wrap;
    }
    .rb-order-remove {
        margin-left: auto;
    }
}

.rb-order-timing {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 1.15rem;
    padding: 0;
    border-radius: 0.9rem;
    background: #fff;
    border: 1px solid #e5eaf1;
    overflow: hidden;
}
.rb-order-timing__item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.95rem 1.1rem;
    position: relative;
}
.rb-order-timing__item + .rb-order-timing__item {
    border-left: 1px solid #e8eef5;
}
.rb-order-timing__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}
.rb-order-timing__label svg {
    color: var(--brand-500);
    flex-shrink: 0;
}
.rb-order-timing__value {
    font-family: var(--font-display, inherit);
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
@media (max-width: 640px) {
    .rb-order-timing {
        grid-template-columns: 1fr;
    }
    .rb-order-timing__item + .rb-order-timing__item {
        border-left: 0;
        border-top: 1px solid #e8eef5;
    }
    .rb-order-timing__value { font-size: 1.15rem; }
}

.rb-wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    padding: 0.95rem 1.35rem 1.05rem;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}
.rb-wizard-connector { display: none; }
.rb-wizard-step {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e8eef5;
    border-radius: 0.85rem;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    position: relative;
    min-width: 0;
    width: 100%;
}
.rb-wizard-step:disabled {
    opacity: 1;
    cursor: not-allowed;
    color: #94a3b8;
}
.rb-wizard-step.is-active {
    border-color: #7dd3fc;
    background: #e0f2fe;
    color: var(--brand-700);
    box-shadow: 0 0 0 1px rgba(0, 171, 240, 0.12);
}
.rb-wizard-step.is-done {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}
.rb-wizard-step__num {
    display: inline-flex;
    width: 1.7rem;
    height: 1.7rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
    border: 0;
}
.rb-wizard-step.is-active .rb-wizard-step__num {
    background: var(--brand-500);
    color: #fff;
}
.rb-wizard-step.is-done .rb-wizard-step__num {
    background: #16a34a;
    color: #fff;
    font-size: 0.78rem;
}
.rb-wizard-step.is-done .rb-wizard-step__num::before {
    content: none;
}
.rb-wizard-step__label {
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}
.rb-wizard-step.is-active .rb-wizard-step__label {
    color: var(--brand-700);
    font-weight: 700;
}
.rb-wizard-step.is-done .rb-wizard-step__label {
    color: #166534;
    font-weight: 700;
}
.rb-wizard-step.is-active .rb-wizard-step__label::after {
    display: none;
}
.rb-wizard-step__check {
    display: none;
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    margin-left: auto;
    color: #16a34a;
}
.rb-wizard-step.is-done .rb-wizard-step__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rb-wizard-step.is-done .rb-wizard-step__check::before {
    content: '✓';
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
}
@media (max-width: 640px) {
    .rb-wizard-steps { padding: 0.75rem 0.85rem 0.85rem; gap: 0.35rem; }
    .rb-wizard-step { padding: 0.45rem 0.5rem; font-size: 0.72rem; }
    .rb-wizard-step__num { width: 1.45rem; height: 1.45rem; font-size: 0.7rem; }
    .rb-wizard-step__label { display: none; }
    .rb-wizard-step.is-done .rb-wizard-step__check { display: inline-flex; }
}

.rb-step-panel.hidden { display: none; }
.rb-step-grid { display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 1024px) {
    .rb-step-grid--jobs {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
        gap: 1.35rem;
        align-items: start;
    }
    .rb-step-grid--save {
        display: grid;
        grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.15fr);
        gap: 1.35rem;
        align-items: start;
    }
}

.rb-map-mount {
    min-height: 18rem;
}
.rb-map-mount:empty::before {
    content: 'Loading map…';
    display: block;
    color: #6b7280;
    font-size: 0.875rem;
    padding: 2rem 0;
    text-align: center;
}

.rb-area--details {
    border: 1px solid #e5eaf1;
    border-radius: 0.9rem;
    padding: 1.15rem 1.2rem 1.25rem;
    background: #fff;
}
.rb-area__heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.1rem;
}
.rb-area__heading-icon {
    display: inline-flex;
    width: 1.65rem;
    height: 1.65rem;
    align-items: center;
    justify-content: center;
    color: var(--brand-500);
    flex-shrink: 0;
}
.rb-area__heading-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}
.rb-area__heading-title {
    font-family: var(--font-display, inherit);
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.rb-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 1.15rem;
}
@media (min-width: 640px) {
    .rb-details-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.rb-details-grid__full {
    grid-column: 1 / -1;
}
.rb-field-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.4rem;
}
.rb-field-hint {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.4;
}
.rb-area--details input,
.rb-area--details select,
.rb-area--details textarea {
    border-color: #e2e8f0 !important;
    background: #fff;
}
.rb-area--details textarea {
    min-height: 5.5rem;
    resize: vertical;
}

.route-builder-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.route-builder-divider {
    width: 1px;
    align-self: stretch;
    background: #e5e7eb;
    margin: 0 0.25rem;
    display: none;
}
@media (min-width: 640px) {
    .route-builder-divider { display: inline-block; }
}

.route-builder-grid {
    display: block;
}
.rb-area { min-width: 0; }

.route-builder-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.75rem;
    margin-bottom: 0.85rem;
}
@media (min-width: 640px) {
    .route-builder-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .route-builder-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.rb-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.rb-section-title {
    font-family: var(--font-display, inherit);
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.rb-section-meta {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}
.rb-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}
.rb-bulk-actions__count {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}
.rb-input-icon {
    position: relative;
}
.rb-input-icon__svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #94a3b8;
    pointer-events: none;
}
.rb-input-icon input {
    padding-left: 2.15rem !important;
}

.route-builder-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid #e8eef5;
    border-radius: 0.9rem;
    overflow: hidden;
    background: #fff;
}
.route-builder-summary > div {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.95rem;
    border-radius: 0;
    background: #fff;
    font-size: 0.9rem;
    border-bottom: 1px solid #eef2f7;
}
.route-builder-summary > div:last-child {
    border-bottom: 0;
}
.route-builder-summary dt {
    color: #64748b;
    font-weight: 600;
    margin: 0;
}
.route-builder-summary dd {
    font-weight: 800;
    color: #0f172a;
    text-align: right;
    margin: 0;
}
.route-builder-summary__highlight {
    background: #f0f9ff;
    box-shadow: none;
}
.route-builder-summary__highlight dt {
    color: var(--brand-700);
}
.route-builder-summary__highlight dd {
    color: var(--brand-700);
    font-size: 1rem;
}
.rb-sum-icon {
    display: inline-flex;
    width: 1.85rem;
    height: 1.85rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.45rem;
    background: #e0f2fe;
    color: var(--brand-600);
    flex-shrink: 0;
}
.rb-sum-icon svg {
    width: 1rem;
    height: 1rem;
}
.rb-save-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.95rem;
}
.rb-modal[data-rb-step="4"] .rb-map {
    height: 26rem;
}
.rb-modal[data-rb-step="4"] .rb-map-mount {
    min-height: 26rem;
}
.rb-modal[data-rb-step="4"] .rb-map-legend {
    display: none;
}
.rb-modal__save {
    gap: 0.4rem;
}

.route-builder-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    border: 1px dashed #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.route-builder-job-list,
.route-builder-stop-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 34rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.rb-job-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    min-width: 0;
}
.rb-job-card--selected {
    flex-direction: column;
    align-items: stretch;
}
.rb-job-card.is-dragging { opacity: 0.5; box-shadow: inset 0 0 0 2px var(--brand-500); }
.rb-job-card.rb-drop-before { box-shadow: inset 0 3px 0 0 var(--brand-500); }
.rb-job-card.rb-drop-after { box-shadow: inset 0 -3px 0 0 var(--brand-500); }

.rb-job-card__main {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    min-width: 0;
    flex: 1 1 auto;
}
.rb-job-card__body { min-width: 0; flex: 1 1 auto; }
.rb-job-card__title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.3;
}
.rb-job-card__addr {
    font-size: 0.825rem;
    color: #64748b;
    overflow-wrap: anywhere;
    margin-top: 0.1rem;
}
.rb-job-card__meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}
.rb-job-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.rb-job-card__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}
.rb-job-card--selected .rb-job-card__actions {
    justify-content: space-between;
    width: 100%;
}
.rb-job-add-btn {
    min-width: 3.5rem;
    justify-content: center;
}

.rb-job-avatar {
    display: inline-flex;
    width: 2.35rem;
    height: 2.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.rb-job-avatar--blue { background: #dbeafe; color: #1d4ed8; }
.rb-job-avatar--violet { background: #ede9fe; color: #6d28d9; }
.rb-job-avatar--teal { background: #ccfbf1; color: #0f766e; }
.rb-job-avatar--amber { background: #fef3c7; color: #b45309; }
.rb-job-avatar--rose { background: #ffe4e6; color: #be123c; }
.rb-job-avatar--indigo { background: #e0e7ff; color: #4338ca; }

.rb-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
}
.rb-badge--warn { background: #fffbeb; color: #92400e; }
.rb-badge--danger { background: #fef2f2; color: #991b1b; }
.rb-badge--frequency {
    background: #dcfce7;
    color: #166534;
}

.rb-stop-number {
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: #c2410c;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rb-move-btns { display: flex; gap: 0.3rem; }
.rb-move-btns .btn { padding: 0.35rem 0.5rem; min-width: 2.25rem; justify-content: center; }

.rb-job-check {
    margin-top: 0.55rem;
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    accent-color: var(--brand-500);
}

.rb-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--brand-700);
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

/* Map */
.rb-map {
    position: relative;
    width: 100%;
    height: 22rem;
    border-radius: 14px;
    overflow: hidden;
    background: #eef2f7;
    border: 1px solid #e5e7eb;
}
.rb-map .leaflet-container {
    width: 100%;
    height: 100%;
    font: inherit;
}
@media (min-width: 1024px) {
    .rb-map { height: 28rem; }
}
.rb-modal[data-rb-step="2"] .rb-map-legend {
    display: none;
}
.rb-modal[data-rb-step="2"] .rb-map-mount {
    min-height: 28rem;
}
.rb-map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    background: #eef2f7;
}
.rb-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    list-style: none;
    padding: 0;
    font-size: 0.78rem;
    color: #475569;
}
.rb-map-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.rb-legend-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.rb-legend-swatch--available { background: #64748b; }
.rb-legend-swatch--selected { background: #c2410c; }
.rb-legend-swatch--start { background: #16a34a; border-radius: 4px; }
.rb-legend-swatch--end { background: #1d4ed8; border-radius: 4px; }
.rb-legend-swatch--invalid { background: #dc2626; }

.rb-info-window { font-size: 0.85rem; line-height: 1.4; max-width: 220px; }
.rb-info-window strong { display: block; margin-bottom: 2px; }

.rb-job-planning {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #f8fafc;
}
.rb-job-planning label {
    display: grid;
    gap: 0.2rem;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}
.rb-job-planning select {
    min-width: 12rem;
    font-size: 0.8rem;
    text-transform: none;
}
.rb-job-planning input {
    width: 5.25rem;
    font-size: 0.8rem;
}

.rb-recommendation-step {
    display: grid;
    grid-template-columns: 1.25rem 4.25rem minmax(0, 1fr) auto;
    gap: 0.5rem 0.75rem;
    align-items: start;
    padding: 0.45rem 0.35rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: grab;
    touch-action: none;
}
.rb-recommendation-step.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
    background: #e0f2fe;
    border-color: #7dd3fc;
}
.rb-recommendation-step.is-drag-over {
    border-color: #38bdf8;
    background: #f0f9ff;
}
.rb-recommendation-handle {
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.4;
    letter-spacing: -0.12em;
    user-select: none;
    padding-top: 0.35rem;
}
.rb-recommendation-body {
    min-width: 0;
}
.rb-recommendation-remove {
    white-space: nowrap;
    align-self: center;
    cursor: pointer;
}
.rb-recommendation-time {
    display: inline-flex;
    justify-content: center;
    padding: 0.2rem 0.45rem;
    border-radius: 0.4rem;
    background: #fff;
    border: 1px solid #bae6fd;
    color: #075985;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
    .route-builder-job-list,
    .route-builder-stop-list {
        max-height: 22rem;
    }
    .rb-area--map, .rb-area--summary {
        position: static;
        top: auto;
    }
}
