* { box-sizing: border-box; }

html, body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--st-bg);
}

/* Splash screen */
.st-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    color: var(--st-muted);
    font-size: 14px;
}

/* Sidebar — fixed to the left edge of the viewport */
.st-sidebar {
    background: var(--st-white);
    border-right: 1px solid var(--st-border);
    width: 240px;
    min-width: 240px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;        /* fallback for engines without dvh */
    height: 100dvh;       /* honors Safari's dynamic toolbar on iPad/iOS */
    overflow: hidden;     /* only the inner nav list scrolls; logo + user footer stay pinned */
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* Scrollable nav list between the pinned logo and the pinned user footer. */
.st-sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;        /* let this flex child shrink so it scrolls instead of pushing the footer off-screen */
    overflow-y: auto;
}

.st-sidebar-logo {
    display: flex;
    flex-shrink: 0;       /* stays pinned at the top; never compressed by a long nav list */
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--st-text);
    text-decoration: none;
    border-bottom: 1px solid #F1F5F9;
    margin-bottom: 8px;
}

.st-sidebar-section {
    padding: 16px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.st-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 1px 8px;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.st-nav-item:hover {
    background: #F1F5F9;
    color: var(--st-text);
}

/* Reset browser <button> defaults so it looks identical to <a> nav items */
button.st-nav-item {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    width: calc(100% - 16px);
    border: none;
    background: none;
    text-align: left;
    box-sizing: border-box;
    justify-content: flex-start;
}

.st-nav-item.active {
    background: var(--st-primary-light);
    color: var(--st-primary);
}

/* Sub-nav links: page tabs shown indented under their sidebar entry (sub-nav mode) */
.st-nav-subitem {
    margin-left: 22px;
    padding-left: 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--st-muted);
    border-left: 1px solid var(--st-border);
    border-radius: 0 8px 8px 0;
}
.st-nav-subitem .mud-icon-root { font-size: 18px; }
.st-mobile-menu-item.st-nav-subitem { margin-left: 16px; }

/* Nav row: link + optional expand/collapse chevron for sub-nav groups */
.st-nav-row { display: flex; align-items: center; }
.st-nav-row > .st-nav-item { flex: 1; min-width: 0; }
.st-mobile-row { display: flex; align-items: center; }
.st-mobile-row > .st-mobile-menu-item { flex: 1; min-width: 0; }

.st-nav-chevron {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-subtle);
    display: flex;
    align-items: center;
    padding: 4px;
    margin-right: 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.st-nav-chevron:hover { background: #F1F5F9; color: #475569; }
.st-nav-chevron .mud-icon-root { font-size: 18px; }

/* User-settings menu trigger (sidebar footer): make the card span the menu width */
.st-user-menu { width: 100%; display: block; }

.st-nav-badge {
    margin-left: auto;
    background: var(--st-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.st-sidebar-footer {
    flex-shrink: 0;       /* pinned below the scrollable nav list, always visible */
    background: var(--st-white);
    padding: 8px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0); /* keep user card clear of the iOS home indicator */
    border-top: 1px solid #F1F5F9;
}

/* User card at bottom of sidebar */
.st-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 0 0;
    border-top: 1px solid #F1F5F9;
    cursor: pointer;
    border-radius: 0 0 0 0;
    transition: background 0.15s;
}
.st-user-card:hover { background: var(--st-bg); }

.st-user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: var(--st-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
}

.st-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.st-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--st-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-user-tenant {
    font-size: 11px;
    color: var(--st-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The account menu's activator (the user card) must fill the sidebar width;
   MudMenu otherwise shrinks its activator wrapper to the content. */
.st-sidebar-footer .mud-menu,
.st-sidebar-footer .mud-menu > .mud-menu-activator {
    display: block;
    width: 100%;
}

/* Account menu opened from the user card (matches the card's visual language) */
.st-user-menu-popover {
    border-radius: 12px;
    border: 1px solid var(--st-border);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    /* Fill most of the 240px sidebar with an even ~8px inset each side. width
       !important overrides MudMenu FullWidth; the negative margin pulls the
       popover left from MudBlazor's default 24px anchor offset to ~8px. */
    width: 224px !important;
    margin-left: -16px;
    box-sizing: border-box;
}
.st-user-menu.mud-list {
    padding: 6px;
}
.st-user-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
}
.st-user-menu-header .st-user-name {
    font-size: 14px;
}
.st-user-menu-email {
    font-size: 12px;
    color: var(--st-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.st-user-menu-divider.mud-divider {
    margin: 4px 0;
    border-color: #F1F5F9;
}
.st-impersonation-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 8px 4px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #FEF3C7;
    color: #92400E;
    font-size: 12px;
    line-height: 1.35;
}
.st-user-menu-section {
    padding: 6px 10px 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
}
.st-user-menu .mud-list-item {
    border-radius: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
    color: var(--st-text);
}
.st-user-menu .mud-list-item:hover {
    background: var(--st-bg);
}
.st-user-menu .mud-list-item-icon {
    min-width: 32px;
    color: var(--st-muted);
}
.st-user-menu .mud-list-item-text {
    font-size: 13px;
    font-weight: 500;
}

/* ── Department filter (sidebar footer, above the user card) ───────────────── */
.st-deptfilter-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0;
    cursor: pointer;
    transition: background 0.15s;
}
.st-deptfilter-card:hover { background: #F8FAFC; }
.st-deptfilter-lead { color: #64748B; flex-shrink: 0; }
.st-deptfilter-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.st-deptfilter-label-caption {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94A3B8;
}
.st-deptfilter-label {
    font-size: 13px;
    font-weight: 600;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.st-deptfilter-chevron { color: #94A3B8; flex-shrink: 0; }

/* The activator must fill the sidebar width (MudMenu otherwise shrinks to content). */
.st-sidebar-footer .st-deptfilter-card { width: 100%; box-sizing: border-box; }

.st-deptfilter-popover {
    border-radius: 12px;
    border: 1px solid #E8EDF5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    width: 240px !important;
    margin-left: -16px;
    box-sizing: border-box;
}
/* Customer-portal header filter — same rows as the department filter, but anchored under the
   header instead of the sidebar (the popover is portaled, so this must stay global). */
.st-cportal-filter-popover {
    border-radius: 12px;
    border: 1px solid #E8EDF5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    width: 260px !important;
    box-sizing: border-box;
}

.st-deptfilter-menu.mud-list { padding: 6px; }
.st-deptfilter-panel { display: flex; flex-direction: column; }
.st-deptfilter-search {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    margin-bottom: 6px;
    outline: none;
}
.st-deptfilter-search:focus { border-color: #4A76F9; }
.st-deptfilter-list { max-height: 320px; overflow-y: auto; }
.st-deptfilter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    border-radius: 8px;
    padding: 8px 8px;
    cursor: pointer;
    color: #1E293B;
    font-size: 13px;
    font-weight: 500;
}
.st-deptfilter-item:hover { background: #F8FAFC; }
.st-deptfilter-check {
    width: 18px;
    min-width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4A76F9;
}
.st-deptfilter-check .mud-icon-root { font-size: 16px; }
.st-deptfilter-dot { width: 10px; min-width: 10px; height: 10px; border-radius: 50%; background: #94A3B8; }
.st-deptfilter-dot--all {
    background: linear-gradient(135deg, #4A76F9 0%, #22C55E 50%, #F59E0B 100%);
}
.st-deptfilter-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-deptfilter-inactive { font-size: 10px; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.03em; }
.st-deptfilter-divider { height: 1px; background: #F1F5F9; margin: 4px 0; }
.st-deptfilter-empty { padding: 10px 8px; font-size: 12px; color: #94A3B8; }

/* ── Team filter with search (Tasks → adhoc filter bar) ───────────────────────
   The menu popover is portaled to the popover provider, so a scoped .razor.css
   can't reach it — these rules have to stay global. */
.st-teamfilter-field .mud-input-slot { cursor: pointer; }
.st-teamfilter-popover {
    min-width: 220px;
    border-radius: 12px;
    border: 1px solid #E8EDF5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    box-sizing: border-box;
}
.st-teamfilter-menu.mud-list { padding: 6px; }
.st-teamfilter-panel { display: flex; flex-direction: column; }
.st-teamfilter-search {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    margin-bottom: 6px;
    outline: none;
}
.st-teamfilter-search:focus { border-color: #4A76F9; }
.st-teamfilter-list { max-height: 320px; overflow-y: auto; }
.st-teamfilter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #1E293B;
    font-size: 13px;
    font-weight: 500;
}
.st-teamfilter-item:hover { background: #F8FAFC; }
.st-teamfilter-box { font-size: 18px; flex-shrink: 0; color: #94A3B8; }
.st-teamfilter-box--on { color: #4A76F9; }
.st-teamfilter-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-teamfilter-empty { padding: 10px 8px; font-size: 12px; color: #94A3B8; }
/* "Showing the first N, type to narrow", under a picker list that was cut off. */
.st-teamfilter-hint { padding: 6px 8px; font-size: 11px; color: var(--st-subtle); }
.st-teamfilter-clear {
    margin-top: 4px;
    border: none;
    border-top: 1px solid #F1F5F9;
    background: none;
    padding: 8px;
    width: 100%;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #4A76F9;
    cursor: pointer;
    border-radius: 0 0 8px 8px;
}
.st-teamfilter-clear:hover { background: #F8FAFC; }

/* ── Filter popover (Tasks and the asset panel's Points mode) ─────────────────
   Everything except the search box lives in this one dropdown. Portaled to the
   popover provider like the team filter above, so the rules have to stay global;
   the lists inside reuse the .st-teamfilter-* rows so both look the same. */
.st-taskfilter-popover {
    width: 320px;
    max-width: calc(100vw - 32px);
    border-radius: var(--st-radius-md);
    border: 1px solid var(--st-border);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    box-sizing: border-box;
}
.st-taskfilter-menu.mud-list { padding: 12px; max-height: 70vh; overflow-y: auto; }
.st-taskfilter-panel { display: flex; flex-direction: column; gap: 14px; }
.st-taskfilter-section { display: flex; flex-direction: column; gap: 6px; }
.st-taskfilter-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--st-subtle);
}
.st-taskfilter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-taskfilter-toggle {
    border: 1px solid var(--st-border);
    background: var(--st-white);
    border-radius: var(--st-radius-full);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--st-text);
    cursor: pointer;
}
.st-taskfilter-toggle:hover { background: var(--st-bg); }
.st-taskfilter-toggle--on {
    border-color: var(--st-primary);
    background: var(--st-primary-light);
    color: var(--st-primary);
    font-weight: 600;
}
.st-taskfilter-dates { display: flex; gap: 8px; }
.st-taskfilter-date {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 6px 8px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--st-text);
    outline: none;
}
.st-taskfilter-date:focus { border-color: var(--st-primary); }
/* Collapsed picker row: label on the left, current selection on the right. */
.st-taskfilter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--st-border);
    background: var(--st-white);
    border-radius: var(--st-radius);
    padding: 7px 10px;
    text-align: left;
    font-size: 13px;
    color: var(--st-text);
    cursor: pointer;
}
.st-taskfilter-row:hover { background: var(--st-bg); }
.st-taskfilter-row-label { font-weight: 600; white-space: nowrap; }
.st-taskfilter-row-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    color: var(--st-muted);
}
.st-taskfilter-chevron { font-size: 18px; color: var(--st-subtle); flex-shrink: 0; }
.st-taskfilter-switch { margin: 0; }
/* Shorter than the stand-alone team dropdown is: the list is one section of many here. */
.st-taskfilter-list { max-height: 180px; }
.st-taskfilter-footer { border-top: 1px solid var(--st-border-light); padding-top: 10px; }
.st-taskfilter-clearall {
    border: none;
    background: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-primary);
    cursor: pointer;
}
.st-taskfilter-clearall:hover { text-decoration: underline; }

/* The asset panel's per-axis dropdowns: the same popover, narrower, because each one holds a
   single list rather than every filter the page has. Portaled like the rest, so global. */
.st-samdrop-popover { width: 264px; }
.st-samdrop-popover .st-taskfilter-list { max-height: 260px; }
/* The colour the type's pins are drawn in, so the dropdown reads like the map. */
.st-samdrop-swatch {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex-shrink: 0;
}
/* The Zone and Area dropdowns are the overview as well as the filter, so each row carries its own
   standing: overdue, due, and the register it is part of. Tabular figures so the columns line up
   down the list rather than jittering with the digit widths. */
.st-samdrop-counts {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.st-samdrop-num.overdue { color: var(--st-error); }
.st-samdrop-num.due { color: #D97706; }
.st-samdrop-num.total { color: var(--st-subtle); font-weight: 600; }
.st-samdrop-num.zero { color: #CBD5E1; font-weight: 600; }

.st-notif-badge {
    margin-left: auto;
    background: var(--st-error);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Main content — offset by sidebar width, page content centered within */
.st-main {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.st-topbar {
    background: var(--st-white);
    border-bottom: 1px solid var(--st-border);
    height: 56px;
    display: flex;
    align-items: stretch;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.st-topbar-inner {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    scrollbar-width: none;
}
.st-topbar-inner::-webkit-scrollbar { display: none; }

.st-page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--st-text);
    flex: 1;
}

.st-content {
    padding: 24px;
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* Status badges: a soft pill with a leading 6px dot in the text colour (approved design).
   The StStatusBadge component renders the same pill with token-based tones
   (.st-status--success etc. in design-system.css). Customer-refusal markers are solid
   markers, not statuses, so they skip the dot. */
.st-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
    white-space: nowrap;
}
.st-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.st-status.st-refusal::before,
.st-status.st-refusal-moved::before { content: none; }

.st-status.draft     { background: #F1F5F9; color: var(--st-muted); }
.st-status.scheduled { background: #EFF6FF; color: #3B82F6; }
.st-status.inprogress{ background: #FFF7ED; color: var(--st-warning); }
.st-status.completed { background: #F0FDF4; color: var(--st-success); }
.st-status.cancelled { background: #FEF2F2; color: var(--st-error); }
.st-status.archived  { background: #F3F4F6; color: #9CA3AF; }

/* ── Mobile top bar (hidden on desktop) ───────────────────────────── */
.st-mobile-topbar {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
    height: 56px; background: var(--st-white);
    border-bottom: 1px solid var(--st-border);
    align-items: center; justify-content: space-between;
    padding: 0 16px;
}
.st-mobile-hamburger {
    background: none; border: none; cursor: pointer;
    padding: 8px; color: var(--st-text); display: flex; align-items: center;
}
.st-mobile-logo { display: flex; align-items: center; }
.st-mobile-overlay {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(0,0,0,0.4);
}
.st-mobile-menu {
    position: fixed; top: 56px; left: 0; right: 0; z-index: 1300;
    background: var(--st-white); border-bottom: 1px solid var(--st-border);
    max-height: calc(100vh - 56px); overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 8px 0;
}
.st-mobile-menu-section {
    font-size: 10px; font-weight: 700; color: var(--st-subtle);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 12px 20px 4px;
}
.st-mobile-menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; color: #475569; font-size: 14px; font-weight: 500;
    text-decoration: none; border: none; background: none;
    cursor: pointer; width: 100%; text-align: left;
}
.st-mobile-menu-item:hover { background: var(--st-bg); }
.st-mobile-menu-item.active { color: var(--st-primary); background: var(--st-primary-light); }
.st-mobile-menu-footer {
    border-top: 1px solid var(--st-border); margin-top: 8px; padding-top: 8px;
}

/* ── Scrollable strip with arrows ─────────────────────────────────── */
.st-scroll-container {
    position: relative;
    display: flex;
    align-items: stretch;
}
.st-scroll-content {
    overflow-x: auto; flex: 1;
    scrollbar-width: none;
    display: flex; align-items: center;
}
.st-scroll-content::-webkit-scrollbar { display: none; }
.st-scroll-arrow {
    position: absolute; top: 0; bottom: 0; z-index: 10;
    width: 32px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(to right, var(--st-white) 60%, transparent);
    border: none; cursor: pointer; color: #475569;
    padding: 0;
}
.st-scroll-arrow:hover { color: var(--st-text); }
.st-scroll-left { left: 0; }
.st-scroll-right { right: 0; background: linear-gradient(to left, var(--st-white) 60%, transparent); }

/* Responsive */
@media (max-width: 768px) {
    .st-sidebar { display: none !important; }
    .st-main { margin-left: 0 !important; padding-top: 56px; }
    .st-mobile-topbar { display: flex; }
    .st-topbar-inner {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap; white-space: nowrap;
        scrollbar-width: none; padding: 0 12px; gap: 8px;
    }
    .st-topbar-inner::-webkit-scrollbar { display: none; }
    .cust-tab-strip-inner {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap; white-space: nowrap;
        scrollbar-width: none; padding: 0 12px; gap: 16px;
    }
    .cust-tab-strip-inner::-webkit-scrollbar { display: none; }
    .st-content { padding: 16px; }
}

/* ── Dashboard ──────────────────────────────────────────────────────── */

/* White section card */
.dash-section {
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    padding: 20px;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Day / Week / Month toggle */
.dash-period-toggle {
    display: flex;
    background: #F1F5F9;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.dpt-btn {
    background: transparent;
    border: none;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--st-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.dpt-btn:hover { background: #E2E8F0; color: var(--st-text); }
.dpt-btn.active { background: var(--st-white); color: var(--st-text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* KPI grid — 4 equal columns */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 1024px) { .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .dash-kpi-grid { grid-template-columns: 1fr; } }

.dash-kpi-card {
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: 16px 18px 18px;
}

.dash-kpi-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dash-kpi-abbr {
    font-size: 11px;
    font-weight: 700;
    color: var(--st-primary);
    letter-spacing: 0.06em;
    background: var(--st-primary-light);
    padding: 2px 7px;
    border-radius: 4px;
}

.dash-kpi-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.dash-kpi-badge.badge-blue   { background: var(--st-primary-light); color: var(--st-primary); }
.dash-kpi-badge.badge-green  { background: #F0FDF4; color: var(--st-success); }
.dash-kpi-badge.badge-orange { background: #FFF7ED; color: var(--st-warning); }
.dash-kpi-badge.badge-grey   { background: #F1F5F9; color: var(--st-muted); }

.dash-kpi-desc {
    font-size: 12px;
    color: var(--st-subtle);
    margin-bottom: 6px;
}

.dash-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--st-text);
    line-height: 1.1;
}

/* Three-column layout */
.dash-three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) { .dash-three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .dash-three-col { grid-template-columns: 1fr; } }

/* Panel (each column card) */
.dash-panel {
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dash-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #F1F5F9;
    flex-shrink: 0;
}

.dash-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--st-text);
}

.dash-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

/* Task row */
.dash-task-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--st-bg);
    cursor: pointer;
    transition: background 0.12s;
    gap: 10px;
}

.dash-task-row:hover { background: var(--st-bg); }
.dash-task-row:last-child { border-bottom: none; }

.dash-task-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }

.dash-task-type    { font-size: 13px; font-weight: 500; color: var(--st-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-customer{ font-size: 12px; color: var(--st-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-addr    { font-size: 11px; color: var(--st-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Team activity row */
.dash-team-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--st-bg);
}

.dash-team-row:last-child { border-bottom: none; }

/* Active Teams client-side search */
.dash-search-wrap { padding: 10px 16px 4px; }

/* In-progress segment of the two-layer progress bar: subtle moving stripe
   layered over the segment's solid background-color to signal "not static". */
.dash-bar-active {
    background-image: linear-gradient(45deg,
        rgba(255, 255, 255, 0.35) 25%, transparent 25%,
        transparent 50%, rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent);
    background-size: 14px 14px;
    animation: dash-bar-move 0.8s linear infinite;
}
@keyframes dash-bar-move {
    from { background-position: 0 0; }
    to   { background-position: 14px 0; }
}

@media (prefers-reduced-motion: reduce) {
    .dash-bar-active { animation: none; }
}

/* Completed task row */
.dash-completed-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--st-bg);
    cursor: pointer;
    transition: background 0.12s;
    gap: 8px;
}

.dash-completed-row:hover { background: var(--st-bg); }
.dash-completed-row:last-child { border-bottom: none; }

/* Calendar — table-style grid */
.dash-cal-table {
    display: grid;
    /* minmax(0, 1fr): a plain 1fr track still grows to fit a nowrap item title */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--st-border);
    border-left: 1px solid var(--st-border);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
.dash-cal-table.has-week-col {
    grid-template-columns: 36px repeat(7, minmax(0, 1fr));
}
.dash-cal-wk-header {
    width: 36px;
    min-width: 36px;
}
.dash-cal-wk-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    background: var(--st-bg);
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
}

/* Header cells */
.dash-cal-th {
    background: var(--st-bg);
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-muted);
    text-align: center;
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
}

.dash-cal-th:nth-child(7n) { border-right: none; }

/* Day cells */
.dash-cal-cell {
    background: var(--st-white);
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
    padding: 8px 10px 8px;
    min-height: 90px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-cal-cell:nth-child(7n) { border-right: none; }
.dash-cal-cell:nth-last-child(-n+7) { border-bottom: none; }

.dash-cal-cell.weekend { background: #FAFBFC; }

.dash-cal-cell.today {
    background: var(--st-primary-light);
}

.dash-cal-cell-date {
    font-size: 12px;
    color: var(--st-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.dash-cal-cell.today .dash-cal-cell-date { color: var(--st-primary); font-weight: 600; }

.dash-cal-status-pills {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
}

.dash-cal-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.dash-cal-pill.scheduled  { background: #EFF6FF; color: #3B82F6; }
.dash-cal-pill.draft      { background: #F1F5F9; color: #475569; }
.dash-cal-pill.completed  { background: #DCFCE7; color: #15803D; }

/* Calendar item chips: one row per task / plan-route occurrence, "+N more" underneath */
.dash-cal-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dash-cal-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    min-width: 0;
    line-height: 1.5;
}

/* ellipsis must live on a real element — anonymous flex-item text only clips */
.dash-cal-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-cal-item-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dash-cal-item.scheduled  .dash-cal-item-dot { background: #3B82F6; }
.dash-cal-item.inprogress .dash-cal-item-dot { background: #F59E0B; }
.dash-cal-item.draft      .dash-cal-item-dot { background: #94A3B8; }
.dash-cal-item.completed  .dash-cal-item-dot { background: #22C55E; }
.dash-cal-item.completed  { color: #94A3B8; text-decoration: line-through; }

/* Recurring plan-route occurrence not yet materialized: hollow violet dot, muted text */
.dash-cal-item.plan .dash-cal-item-dot {
    background: transparent;
    border: 1.5px solid #8B5CF6;
}
.dash-cal-item.plan { color: #64748B; }

.dash-cal-more {
    font-size: 11px;
    font-weight: 600;
    color: #4A76F9;
    margin-top: 2px;
}

/* ── End Dashboard ─────────────────────────────────────────────────── */

/* ── Customer List ──────────────────────────────────────────────────── */

/* Tab strip below topbar */
.cust-tab-strip {
    display: flex;
    align-items: stretch;
    background: var(--st-white);
    /* The divider is an inset shadow (painted under the tabs) rather than a border, so the
       active tab's 2px underline covers it instead of stacking above it. */
    box-shadow: inset 0 -1px 0 var(--st-border);
    padding: 0;
}

.cust-tab-strip-inner {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    scrollbar-width: none;
}
.cust-tab-strip-inner::-webkit-scrollbar { display: none; }

/* Underline tabs (approved design): muted label, the active tab gets primary text and a 2px
   primary underline sitting on the strip's bottom border. The count pill is primary-tinted and
   turns solid primary on the active tab. Shared by PageTabs and every hand-written strip. */
.cust-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 2px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--st-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.cust-tab:hover:not(.active):not(.disabled) { color: var(--st-text); border-bottom-color: var(--st-border-hover); }

.cust-tab.active {
    color: var(--st-primary);
    font-weight: 600;
    border-bottom-color: var(--st-primary);
}

.cust-tab.disabled {
    color: var(--st-border-hover);
    cursor: not-allowed;
}

.cust-tab-count {
    background: var(--st-primary-light);
    color: var(--st-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.cust-tab.active .cust-tab-count {
    background: var(--st-primary);
    color: var(--st-white);
}

/* Toolbar */
.cust-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

/* Search input */
.cust-search-wrap {
    position: relative;
    min-width: 240px;
}

.cust-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    color: var(--st-text);
    background: var(--st-white);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.cust-search-input:focus { border-color: var(--st-primary); }
.cust-search-input::placeholder { color: var(--st-subtle); }

/* Table */
.cust-table {
    width: 100%;
    border-collapse: collapse;
}

.cust-th {
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-muted);
    background: var(--st-bg);
    text-align: left;
    border-bottom: 1px solid var(--st-border);
    white-space: nowrap;
    user-select: none;
}

.cust-td {
    padding: 11px 16px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}

.cust-table tbody tr:last-child .cust-td { border-bottom: none; }
.cust-table tbody tr:hover .cust-td { background: var(--st-bg); }
.cust-group-filter { min-width: 180px; max-width: 260px; }
.cust-group-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--st-bg-alt); color: var(--st-muted); }
.cust-group-none { color: var(--st-border-hover); font-size: 13px; }

/* Checkbox */
.cust-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--st-primary);
}

/* Location count badge */
.cust-loc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--st-primary-light);
    color: var(--st-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    min-width: 28px;
}

/* Bottom pagination */
.cust-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #F1F5F9;
}

/* Page number buttons */
.cust-page-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: var(--st-white);
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}

.cust-page-btn:hover { background: #F1F5F9; }

.cust-page-btn.active {
    background: var(--st-primary);
    color: var(--st-white);
    border-color: var(--st-primary);
}

/* ── End Customer List ───────────────────────────────────────────────── */

/* ── Customer Detail ─────────────────────────────────────────────────── */

.cust-detail-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--st-muted);
    text-decoration: none;
    transition: background 0.12s;
    flex-shrink: 0;
    margin-right: 4px;
    align-self: center;
    margin-bottom: 2px;
}
.cust-detail-back:hover { background: #F1F5F9; color: var(--st-text); }

/* Two-column overview layout */
.cust-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) { .cust-detail-grid { grid-template-columns: 1fr; } }

/* Info card */
.cust-detail-card {
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    padding: 18px 20px 16px;
}

.cust-detail-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--st-text);
    margin-bottom: 14px;
}

/* Key-value info table */
.cust-info-table {
    width: 100%;
    border-collapse: collapse;
}

.cust-info-table tr { border-bottom: 1px solid #F1F5F9; }
.cust-info-table tr:last-child { border-bottom: none; }

.cust-info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--st-subtle);
    padding: 9px 12px 9px 0;
    width: 110px;
    white-space: nowrap;
    vertical-align: top;
}

.cust-info-value {
    font-size: 13px;
    color: var(--st-text);
    padding: 9px 0;
}

/* Locations preview table inside card */
.cust-loc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 4px;
}

.cust-loc-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 8px 8px 0;
    text-align: left;
}

.cust-loc-table tbody tr { border-top: 1px solid var(--st-bg); }
.cust-loc-table tbody td { padding: 8px 8px 8px 0; vertical-align: middle; }

/* Task row in right column */
.cust-task-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--st-bg);
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 4px;
}
.cust-task-row:hover { background: var(--st-bg); padding-left: 4px; padding-right: 4px; }
.cust-task-row:last-child { border-bottom: none; }

/* Small link-style button */
.cust-link-btn {
    background: none;
    border: none;
    color: var(--st-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.cust-link-btn:hover { text-decoration: underline; }

/* ── End Customer Detail ──────────────────────────────────────────────── */

/* ── Address Autocomplete ────────────────────────────────────────────── */

/* Button styling — ensure all buttons have a visible border */
/* StButton adds .st-button, whose rules in design-system.css take over size, radius, weight and border per kind. */
.mud-button-root:not(.mud-icon-button) { border: 1px solid #E2E8F0 !important; padding: 4px 8px !important; min-height: unset !important; }
.mud-icon-button:not(.mud-switch-base) { padding: 4px !important; }
.mud-switch-base .mud-switch-thumb-medium { width: 18px; height: 18px; }
.mud-button-root.mud-button-filled { border-color: transparent !important; }

/* Input styling — hairline tokens kept in sync with the global input block below */
.mud-input-outlined .mud-input-outlined-border { border-color: var(--st-border) !important; }
.mud-input-control.mud-input-input-control { border-radius: 8px; }
.mud-input-outlined:hover .mud-input-outlined-border { border-color: var(--st-border-hover) !important; }
.mud-input-outlined.mud-input-focused .mud-input-outlined-border { border-color: var(--st-primary) !important; }

/* Negative/destructive buttons */
.mud-button-root.mud-error-text { border: none !important; background: var(--st-error) !important; color: var(--st-white) !important; }
.mud-button-root.mud-error-text:hover { background: var(--st-error) !important; }
.mud-message-box__yes-button .mud-button-root { border: none !important; background: var(--st-error) !important; color: var(--st-white) !important; }
.mud-message-box__yes-button .mud-button-root:hover { background: var(--st-error) !important; }

/* Dialog styling */
.mud-dialog { border-radius: 12px !important; }
.mud-dialog-title { font-size: 16px; }
.mud-dialog-title .mud-typography-h6,
.mud-dialog-title .mud-typography-h5 { font-size: 16px; }

/* Google Places dropdown must appear above MudDialog (z-index ~1300) */
.pac-container {
    z-index: 9999 !important;
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    border: 1px solid #E2E8F0;
    margin-top: 2px;
}

.pac-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--st-text);
}

.pac-item:hover, .pac-item-selected { background: #F1F5F9; }
.pac-item-query { font-weight: 500; }
.pac-matched { color: var(--st-primary); }

/* Address autocomplete input — matches MudBlazor outlined variant (Style B):
   white fill, hairline border, and a shrunk label notched into the top border
   like a filled MudTextField. */
.addr-ac-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: 6px; /* room for the notched label */
}

.addr-ac-label {
    position: absolute;
    top: 0;
    left: 10px;
    z-index: 1;
    font-size: 12px;
    font-weight: 500;
    color: var(--st-muted);
    background: var(--st-white);
    padding: 0 4px;
    line-height: 12px;
}

.addr-ac-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--st-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--st-text);
    background: var(--st-white);
    outline: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    height: 40px;
}

.addr-ac-input:hover  { border-color: var(--st-border-hover); }
.addr-ac-input:focus  { border-color: var(--st-primary); box-shadow: 0 0 0 3px rgba(74,118,249,.15); }
.addr-ac-input::placeholder { color: var(--st-subtle); }

/* Container that holds the Google PlaceAutocompleteElement web component
   — styled to match the MudBlazor outlined fill look used elsewhere. */
.addr-ac-input-container {
    width: 100%;
    color-scheme: light;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    transition: background .15s, border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    height: 40px;
    display: flex;
    align-items: center;
    /* overflow must stay visible: the PlaceAutocompleteElement renders its
       suggestion dropdown as an absolutely-positioned child, so clipping the
       40px box (overflow:hidden) hid the predictions entirely. */
    overflow: visible;
}
/* The web component's own predictions dropdown — keep it above the dialog. */
.addr-ac-input-container gmp-place-autocomplete { width: 100%; }
.pac-container, .gmpx-place-autocomplete, gmp-place-autocomplete { z-index: 13000 !important; }
.addr-ac-input-container:hover { border-color: var(--st-border-hover); }
.addr-ac-input-container:focus-within {
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px rgba(74,118,249,.15);
}
.addr-ac-input-container gmp-place-autocomplete {
    width: 100%;
    display: block;
    color-scheme: light;
    background: transparent;
    --gmpx-color-surface: transparent;
}
/* Strip Google's default input chrome so it sits flush in our outlined box. */
.addr-ac-input-container gmp-place-autocomplete::part(input) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 14px !important;
    height: 38px !important;
    font-size: 14px !important;
    font-family: 'Inter', sans-serif !important;
    color: var(--st-text) !important;
    width: 100% !important;
    outline: none !important;
}
/* Legacy fallback input (real <input> injected when new API unavailable). */
.addr-ac-input-container > .addr-ac-input {
    background: transparent;
    border: none;
    box-shadow: none;
    height: 38px;
    padding: 0 14px;
}
.addr-ac-input-container > .addr-ac-input:focus { box-shadow: none; background: transparent; }

/* ── End Address Autocomplete ────────────────────────────────────────── */

/* ── Input Style B: Filled / frosted (global override) ──────────────────── */

/* SaberTask global input style — white fill, always-visible hairline border, blue focus ring.
   Matches design-system.css .st-input. Applies to EVERY MudBlazor outlined input/select/picker
   across the app, so all forms stay consistent from one place (tokens mirror design-system.css). */
.mud-input.mud-input-outlined {
    background: var(--st-white);
    border-radius: 8px;
    transition: background .15s, box-shadow .15s;
}
.mud-input-outlined-border {
    border: 1px solid var(--st-border) !important;
    border-radius: 8px !important;
    transition: border-color .15s, box-shadow .15s !important;
}

/* Hover: darker hairline */
.mud-input.mud-input-outlined:not(.mud-disabled):hover .mud-input-outlined-border {
    border-color: var(--st-border-hover) !important;
}

/* Focus: blue border + 3px ring */
.mud-input.mud-input-outlined.mud-input-focused {
    background: var(--st-white);
    box-shadow: 0 0 0 3px rgba(74, 118, 249, 0.15);
    border-radius: 8px;
}
.mud-input.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--st-primary) !important;
}

/* Error state */
.mud-input.mud-input-outlined.mud-input-error {
    background: #FFFBFB;
}
.mud-input.mud-input-outlined.mud-input-error .mud-input-outlined-border {
    border-color: #FCA5A5 !important;
}

/* Disabled */
.mud-input.mud-input-outlined.mud-disabled {
    background: var(--st-bg);
    opacity: .65;
}

/* MudSelect (dropdown) inherits same style */
.mud-select .mud-input.mud-input-outlined {
    background: var(--st-white);
}

/* ── End Input Style B ───────────────────────────────────────────────────── */

/* Blazor error */
/* ── Task Calendar ──────────────────────────────────────────────────── */

.task-cal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.task-cal-nav-btn {
    background: none;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
    font-family: inherit;
    font-size: 16px;
    transition: background 0.12s;
}
.task-cal-nav-btn:hover { background: #F1F5F9; }

.task-cal-nav-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--st-text);
    min-width: 160px;
    text-align: center;
}

.task-cal-today-btn {
    background: none;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
}
.task-cal-today-btn:hover { background: #F1F5F9; }

.task-cal-grid {
    display: grid;
    /* minmax(0, 1fr), not 1fr: a plain 1fr track keeps an automatic min-content minimum, so a
       long task pill widens its column and pushes the last weekdays outside the clipped
       .sap-calendar. A zero minimum keeps all seven columns equal and inside the container. */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--st-border);
    border-left: 1px solid var(--st-border);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}
.task-cal-grid.has-week-col {
    grid-template-columns: 36px repeat(7, minmax(0, 1fr));
}
.task-cal-wk-header {
    width: 36px;
    min-width: 36px;
}
.task-cal-wk-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    background: var(--st-bg);
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
}

.task-cal-header {
    background: var(--st-bg);
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-muted);
    text-align: center;
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
}

.task-cal-cell {
    background: var(--st-white);
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
    padding: 6px 6px 8px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Pairs with the minmax(0, 1fr) tracks: a flex container is also min-content sized by
       default, which would re-introduce the blowout from inside the cell. */
    min-width: 0;
}

.task-cal-cell.weekend { background: #FAFBFC; }
.task-cal-cell.today { background: var(--st-primary-light); }
.task-cal-cell.other-month { opacity: 0.45; }
.task-cal-cell.past { background: var(--st-bg-alt); }
.task-cal-cell.past .task-cal-day-num { color: var(--st-subtle); }

.task-cal-day-num {
    font-size: 12px;
    color: var(--st-muted);
    font-weight: 500;
    margin-bottom: 2px;
    padding: 0 2px;
}
.task-cal-cell.today .task-cal-day-num { color: var(--st-primary); font-weight: 700; }

.sap-day-hours-badge {
    font-size: 10px;
    font-weight: 600;
    color: #3B82F6;
    background: #EFF6FF;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.task-cal-pill {
    display: block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity 0.12s;
    line-height: 1.4;
}
.task-cal-pill:hover { opacity: 0.8; }

.task-cal-pill.draft      { background: #F1F5F9; color: var(--st-muted); }
.task-cal-pill.scheduled  { background: #EFF6FF; color: #3B82F6; }
.task-cal-pill.inprogress { background: #FFF7ED; color: var(--st-warning); }
.task-cal-pill.completed  { background: #F0FDF4; color: var(--st-success); }
.task-cal-pill.cancelled  { background: #FEF2F2; color: var(--st-error); }
.task-cal-pill.archived   { background: #F3F4F6; color: #9CA3AF; }
.task-cal-pill.fixed-schedule { background: #F3E8FF; color: #7C3AED; }

.task-cal-more {
    font-size: 11px;
    font-weight: 500;
    color: var(--st-subtle);
    padding: 0 4px;
    cursor: default;
}

.task-cal-cell { cursor: pointer; }
.dash-cal-cell { cursor: pointer; }

/* Day Tasks Dialog row */
.day-tasks-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--st-bg);
    cursor: pointer;
    transition: background 0.12s;
}
.day-tasks-row:hover { background: var(--st-bg); }
.day-tasks-row:last-child { border-bottom: none; }

/* ── End Task Calendar ─────────────────────────────────────────────── */

/* ── SA Planning ───────────────────────────────────────────────────── */

.sap-layout {
    display: flex;
    flex-direction: row;
    gap: 16px;
    min-height: calc(100vh - 200px);
    align-items: stretch;
}

.sap-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    transition: box-shadow 0.15s;
}

.sap-sidebar.drag-over {
    box-shadow: inset 0 0 0 2px var(--st-primary);
}

.sap-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #F1F5F9;
    flex-shrink: 0;
}

.sap-sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--st-text);
    margin: 0;
}

.sap-sidebar-count {
    background: var(--st-primary-light);
    color: var(--st-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sap-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sap-sidebar-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: grab;
    transition: background 0.12s;
    border: 1px solid var(--st-border);
    margin-bottom: 4px;
}

.sap-sidebar-item-content {
    flex: 1;
    min-width: 0;
}

.sap-sidebar-item:hover {
    background: var(--st-bg);
}

.sap-sidebar-item:active {
    cursor: grabbing;
}

.sap-sidebar-item-customer {
    font-size: 13px;
    font-weight: 500;
    color: var(--st-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-sidebar-item-location {
    font-size: 12px;
    color: var(--st-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-sidebar-item-title {
    font-size: 11px;
    color: var(--st-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 2px;
    margin-top: 8px;
    border-top: 1px solid var(--st-border);
}

.sap-sidebar-section-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--st-text);
    margin: 0;
}

.sap-sidebar-section-hint {
    font-size: 11px;
    color: var(--st-subtle);
    padding: 0 12px 6px;
    line-height: 1.4;
}

.sap-calendar {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    overflow: hidden;
}

.sap-calendar .task-cal-grid {
    flex: 1;
}

.sap-calendar .task-cal-cell {
    min-height: 140px;
}

.sap-calendar .task-cal-day-num {
    font-size: 14px;
}

.sap-calendar .task-cal-pill {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: grab;
    line-height: 1.4;
    margin-bottom: 2px;
    border: 1px solid currentColor;
    border-radius: 5px;
}

.sap-calendar .task-cal-pill .sap-cal-drag-handle {
    font-size: 13px;
}

.sap-cal-pill-est {
    margin-left: 2px;
    opacity: 0.7;
}

.sap-calendar .task-cal-pill:active {
    cursor: grabbing;
}

.sap-cal-pill-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sap-cal-drag-handle {
    flex-shrink: 0;
    margin-left: 4px;
    opacity: 1;
    font-size: 16px;
    line-height: 1;
    transition: opacity 0.15s;
}

.sap-calendar .task-cal-pill:hover .sap-cal-drag-handle {
    opacity: 0.7;
}

.task-cal-cell.drag-over {
    box-shadow: inset 0 0 0 2px var(--st-primary);
}

/* The dragged visit's suggested weekday inside its recommended week/month (TaskList planner). */
.task-cal-cell.suggested {
    background: var(--st-primary-50);
    box-shadow: inset 0 0 0 2px var(--st-primary-border);
}

.sap-visit-hint-agreement {
    font-style: italic;
}

.sap-empty-sidebar {
    padding: 24px 16px;
    text-align: center;
    color: var(--st-subtle);
    font-size: 13px;
}

.sap-empty-hint {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #B0BCCB;
    text-align: left;
}

@media (max-width: 900px) {
    .sap-layout {
        flex-direction: column;
    }
    .sap-sidebar {
        width: 100%;
        min-width: 100%;
        position: static;
        max-height: 300px;
    }
}

/* ── End SA Planning ──────────────────────────────────────────────── */

/* Fatal error bar (markup + texts in wwwroot/index.html, filled by Services/ErrorBarLoggerProvider.cs).
   Blazor toggles it with an inline display:block, so the layout lives on the inner row. */
#blazor-error-ui {
    background: var(--st-error-light);
    border-top: 1px solid #FECACA;
    color: var(--st-error);
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    z-index: 1000;
    max-height: 60vh;
    overflow-y: auto;
}
#blazor-error-ui [hidden] { display: none; }
#blazor-error-ui .reload { color: var(--st-error); }
#blazor-error-ui .dismiss { cursor: pointer; }
#blazor-error-ui .dismiss svg { vertical-align: middle; }
.st-errbar-row {
    display: flex;
    align-items: center;
    gap: var(--st-space-4);
}
.st-errbar-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}
.st-errbar-headline {
    color: var(--st-error-dark);
    font-weight: 500;
}
.st-errbar-where {
    color: var(--st-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}
.st-errbar-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: var(--st-space-3);
}
.st-errbar-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--st-error);
    text-decoration: underline;
    cursor: pointer;
}
.st-errbar-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--st-space-2);
    margin-top: var(--st-space-2);
}
.st-errbar-pre {
    margin: 0;
    width: 100%;
    max-height: 30vh;
    overflow: auto;
    padding: var(--st-space-2) var(--st-space-3);
    background: var(--st-white);
    border: 1px solid #FECACA;
    border-radius: var(--st-radius);
    color: var(--st-text);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}
@media (max-width: 600px) {
    #blazor-error-ui { padding: 12px 16px; }
    .st-errbar-row { flex-wrap: wrap; }
}

/* ── Day Detail Dialog ──────────────────────────────────────────────── */
.day-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.day-detail-stat-card {
    background: var(--st-bg);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 12px 16px;
}
.day-detail-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--st-muted);
    margin-bottom: 6px;
}
.day-detail-stat-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--st-text);
}
.day-detail-stat-total {
    color: #2563EB;
}

.day-detail-task-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.day-detail-travel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 56px;
    font-size: 12px;
    color: var(--st-subtle);
    border-left: 2px dashed var(--st-border-hover);
    margin-left: 27px;
}

.day-detail-task-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    margin-bottom: 2px;
    transition: background 0.15s;
}
.day-detail-task-row:hover {
    background: var(--st-bg);
}
.day-detail-task-row.urgent {
    border-left: 3px solid var(--st-error);
}

.day-detail-drag-handle {
    display: flex;
    align-items: center;
    cursor: grab;
    color: var(--st-subtle);
    flex-shrink: 0;
    padding: 4px;
}
.day-detail-drag-handle:active { cursor: grabbing; }

.day-detail-task-row.drag-over-above { border-top: 2px solid #2563EB; }
.day-detail-task-row.drag-over-below { border-bottom: 2px solid #2563EB; }
.day-detail-task-row.dragging { opacity: 0.4; }

.day-detail-task-info {
    flex: 1;
    min-width: 0;
}
.day-detail-task-customer {
    font-weight: 600;
    font-size: 13px;
    color: var(--st-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.day-detail-task-location {
    font-size: 12px;
    color: var(--st-muted);
    margin-top: 2px;
}
.day-detail-task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.day-detail-service-chip {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #EDE9FE;
    color: #7C3AED;
    font-weight: 500;
}
.day-detail-time-chip {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #E0F2FE;
    color: #0284C7;
    font-weight: 500;
}
.day-detail-agreement-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: #F1F5F9;
    color: var(--st-muted);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════
   MESSAGES PAGE  (msg-)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Page layout ─────────────────────────────────────────────────────────── */
.msg-page {
    display: flex;
    height: calc(100vh - 0px);
    overflow: hidden;
    background: var(--st-bg);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.msg-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--st-white);
    border-right: 1px solid var(--st-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.msg-sidebar-header {
    padding: 16px 16px 8px;
    border-bottom: 1px solid #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.msg-sidebar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--st-text);
}

.msg-search-wrap {
    padding: 8px 12px;
    border-bottom: 1px solid #F1F5F9;
}

.msg-search {
    width: 100%;
    background: #F1F5F9;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    padding: 8px 12px;
    font-family: inherit;
    outline: none;
    color: var(--st-text);
    transition: border-color 0.15s;
}
.msg-search:focus {
    background: var(--st-white);
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px rgba(74,118,249,0.12);
}
.msg-search::placeholder { color: var(--st-subtle); }

.msg-sections {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.msg-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 16px 4px;
}

/* ── Conversation item ───────────────────────────────────────────────────── */
.msg-conv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 1px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    min-height: 52px;
}
.msg-conv-item:hover { background: #F1F5F9; }
.msg-conv-item.active {
    background: var(--st-primary-light);
}

.msg-conv-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--st-primary-light);
    color: var(--st-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.msg-conv-avatar.group {
    background: var(--st-primary-light);
    color: var(--st-primary);
}
.msg-conv-avatar.announcement {
    background: #FEF3C7;
    color: var(--st-warning);
}
.msg-conv-avatar.team {
    background: #D1FAE5;
    color: var(--st-success);
}

.msg-conv-body {
    flex: 1;
    min-width: 0;
}

.msg-conv-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--st-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-conv-preview {
    font-size: 12px;
    color: var(--st-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.msg-conv-unread {
    background: var(--st-primary);
    color: var(--st-white);
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
}

.msg-new-conv-wrap {
    padding: 12px;
    border-top: 1px solid #F1F5F9;
}

.msg-new-conv-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: var(--st-primary);
    color: var(--st-white);
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    justify-content: center;
    transition: background 0.15s;
}
.msg-new-conv-btn:hover { background: var(--st-primary-hover); }

/* ── Thread area ─────────────────────────────────────────────────────────── */
.msg-thread-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--st-bg);
    position: relative;
}

/* ── Polling bar ─────────────────────────────────────────────────────────── */
.msg-polling-bar {
    height: 2px;
    background: #F1F5F9;
    overflow: hidden;
    flex-shrink: 0;
}

.msg-polling-progress {
    height: 2px;
    width: 0;
    background: var(--st-primary);
}

.msg-polling-progress.active {
    animation: msg-poll-sweep 10s linear infinite;
}

@keyframes msg-poll-sweep {
    0%   { width: 0; }
    100% { width: 100%; }
}

/* ── Thread header ───────────────────────────────────────────────────────── */
.msg-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--st-white);
    border-bottom: 1px solid var(--st-border);
    flex-shrink: 0;
}

.msg-thread-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--st-primary-light);
    color: var(--st-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.msg-thread-avatar.group { background: var(--st-primary-light); color: var(--st-primary); }
.msg-thread-avatar.announcement { background: #FEF3C7; color: var(--st-warning); }

.msg-thread-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--st-text);
}

.msg-thread-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.msg-thread-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}
.msg-badge-dm   { background: var(--st-primary-light); color: var(--st-primary); }
.msg-badge-group { background: var(--st-primary-light); color: var(--st-primary); }
.msg-badge-announcement { background: #FEF3C7; color: var(--st-warning); }
.msg-badge-team { background: #D1FAE5; color: var(--st-success); }

/* ── Messages list ───────────────────────────────────────────────────────── */
.msg-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-load-more-btn {
    background: none;
    border: 1px solid var(--st-border);
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    color: var(--st-primary);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
}
.msg-load-more-btn:hover { background: var(--st-primary-light); }

.msg-date-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--st-subtle);
    font-size: 12px;
    font-weight: 500;
    margin: 12px 0 8px;
}
.msg-date-divider::before,
.msg-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--st-border);
}

/* ── Message row ─────────────────────────────────────────────────────────── */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 75%;
    margin-bottom: 2px;
}
.msg-row.self {
    flex-direction: row-reverse;
    align-self: flex-end;
    max-width: 75%;
}

.msg-sender-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--st-primary-light);
    color: var(--st-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    align-self: flex-end;
    margin-bottom: 4px;
}
.msg-sender-avatar.invisible { visibility: hidden; }

.msg-content-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msg-sender-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--st-muted);
    padding: 0 12px;
    margin-bottom: 2px;
}

.msg-bubble {
    background: #F1F5F9;
    color: var(--st-text);
    border-radius: 12px 12px 12px 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
}

/* keep sender line breaks; body is rendered as plain text so \n would otherwise collapse */
.msg-body { white-space: pre-wrap; }
.msg-row.self .msg-bubble {
    background: var(--st-primary);
    color: var(--st-white);
    border-radius: 12px 12px 4px 12px;
}
.msg-bubble.consecutive {
    border-radius: 4px 12px 12px 4px;
}
.msg-row.self .msg-bubble.consecutive {
    border-radius: 12px 4px 4px 12px;
}

.msg-time {
    font-size: 11px;
    color: var(--st-subtle);
    padding: 0 4px;
}

/* ── Attachment in bubble ────────────────────────────────────────────────── */
.msg-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.12s;
}
.msg-attachment:hover { background: rgba(0,0,0,0.08); }

.msg-attach-icon { color: var(--st-error); }

.msg-attach-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    font-weight: 500;
}

.msg-image {
    margin-top: 4px;
    max-width: 240px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}
.msg-image img {
    width: 100%;
    display: block;
    border-radius: 8px;
    transition: opacity 0.15s;
}
.msg-image img:hover { opacity: 0.9; }

/* ── Empty thread ────────────────────────────────────────────────────────── */
.msg-empty-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--st-subtle);
}

.msg-empty-thread-icon {
    font-size: 48px !important;
    color: var(--st-border-hover);
    display: block;
    margin-bottom: 8px;
}

.msg-empty-thread-title {
    font-size: 16px;
    font-weight: 600;
    color: #475569;
}

/* ── Composer ────────────────────────────────────────────────────────────── */
.msg-composer {
    background: var(--st-white);
    border-top: 1px solid var(--st-border);
    padding: 12px 16px;
    flex-shrink: 0;
}

.msg-composer-blocked {
    background: #FFF7ED;
    border-top: 1px solid #FED7AA;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--st-warning);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.msg-composer-inner {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.msg-composer-textarea {
    flex: 1;
    background: #F1F5F9;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    padding: 10px 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
}
.msg-composer-textarea:focus {
    background: var(--st-white);
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px rgba(74,118,249,0.12);
}
.msg-composer-textarea::placeholder { color: var(--st-subtle); }

.msg-composer-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    color: var(--st-muted);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
}
.msg-composer-icon-btn:hover { background: #F1F5F9; border-color: var(--st-border-hover); }

.msg-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--st-primary);
    color: var(--st-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.msg-send-btn:hover:not(:disabled) { background: var(--st-primary-hover); }
.msg-send-btn:disabled { background: var(--st-border-hover); cursor: default; }

.msg-attach-preview-strip {
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.msg-attach-preview-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--st-primary-light);
    color: var(--st-primary);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
}

/* ── Dialog styles ───────────────────────────────────────────────────────── */
.msg-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}

.msg-dialog-panel {
    background: var(--st-white);
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 400px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.msg-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--st-border);
}

.msg-dialog-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--st-text);
}

.msg-dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.12s;
}
.msg-dialog-close:hover { background: #F1F5F9; }

.msg-dialog-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.msg-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    /* Right padding keeps the actions clear of the floating feedback button (as on the pager). */
    padding: 12px 72px 12px 20px;
    border-top: 1px solid var(--st-border);
}

.msg-dialog-input {
    width: 100%;
    background: #F1F5F9;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    padding: 10px 14px;
    font-family: inherit;
    outline: none;
    color: var(--st-text);
    transition: border-color 0.15s;
}
.msg-dialog-input:focus {
    background: var(--st-white);
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px rgba(74,118,249,0.12);
}

.msg-type-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1.5px solid var(--st-border);
    border-radius: 8px;
    background: var(--st-white);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.12s, background 0.12s;
    color: #475569;
}
.msg-type-option:hover { background: var(--st-bg); border-color: var(--st-border-hover); }
.msg-type-option.selected {
    border-color: var(--st-primary);
    background: var(--st-primary-light);
    color: var(--st-primary);
}

.msg-source-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid var(--st-border);
    border-radius: 8px;
    background: var(--st-white);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    transition: border-color 0.12s, background 0.12s;
    flex: 1;
    justify-content: center;
}
.msg-source-option:hover { background: var(--st-bg); border-color: var(--st-border-hover); }
.msg-source-option.selected {
    border-color: var(--st-primary);
    background: var(--st-primary-light);
    color: var(--st-primary);
}

.msg-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.msg-search-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--st-text);
    transition: background 0.12s;
}
.msg-search-option:hover { background: var(--st-bg); }

.msg-search-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--st-primary-light);
    color: var(--st-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
}

.msg-search-empty {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--st-white);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--st-subtle);
    z-index: 100;
}
.msg-search-empty.msg-search-error {
    color: var(--st-error);
}

.msg-member-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.msg-member-chip {
    display: flex;
    align-items: center;
    background: var(--st-primary-light);
    color: var(--st-primary);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
}

/* "Show 50 more" row at the bottom of the employee-picker list */
.msg-show-more {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--st-primary);
    text-align: center;
}
.msg-show-more:hover:not(:disabled) { background: var(--st-bg); }
.msg-show-more:disabled { cursor: default; }

.msg-dialog-btn-primary {
    background: var(--st-primary);
    color: var(--st-white);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.msg-dialog-btn-primary:hover:not(:disabled) { background: var(--st-primary-hover); }
.msg-dialog-btn-primary:disabled { opacity: 0.65; cursor: default; }

.msg-dialog-btn-ghost {
    background: transparent;
    color: #475569;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 8px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}
.msg-dialog-btn-ghost:hover { background: var(--st-bg); }

.msg-dialog-btn-danger {
    background: transparent;
    color: var(--st-error);
    border: 1px solid #FCA5A5;
    border-radius: 6px;
    padding: 8px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}
.msg-dialog-btn-danger:hover:not(:disabled) { background: #FEF2F2; }

/* ── Icon button (generic) ───────────────────────────────────────────────── */
.st-icon-btn {
    background: none;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-muted);
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}
.st-icon-btn:hover { background: #F1F5F9; border-color: var(--st-border-hover); }

/* Location popup dialog */
.loc-popup-dialog { max-width: 1280px !important; }
.loc-popup-dialog .mud-dialog-content { padding: 0 !important; overflow: hidden !important; }
.loc-popup-dialog .mud-dialog-title { display: none !important; }
/* Force all single-line text inputs in this dialog to a uniform compact height.
   Without this, an empty MudTextField<string?> in Outlined+Dense mode renders
   noticeably taller than one with a value, making the city/postal/country row
   look like 3 different sized boxes next to the populated Name field. */
.loc-popup-dialog .mud-input.mud-input-outlined:not(.mud-input-multiline) {
    min-height: 40px;
    height: 40px;
}
.loc-popup-dialog .mud-input.mud-input-outlined:not(.mud-input-multiline) input {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.loc-row-hover:hover { background: var(--st-bg); }

/* ── Image Preview Overlay ─────────────────────────────────────────────── */
.img-preview-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    z-index: 1500; display: flex; align-items: center; justify-content: center;
}
.img-preview-container { position: relative; max-width: 92vw; max-height: 92vh; }
.img-preview-image { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.img-preview-close {
    position: absolute; top: -16px; right: -16px;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--st-white); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); color: var(--st-text);
}
.img-preview-close:hover { background: #F1F5F9; }
.img-clickable { cursor: pointer; transition: opacity 0.15s; }
.img-clickable:hover { opacity: 0.85; }

/* ── Work Description Builder Sidebar ───────────────────────────────────── */

/* Overlay — fixed, full-screen, z-index 1400 (above MudDialog ~1300) */
.wdb-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1400;
    display: flex;
    justify-content: flex-end;
    animation: wdbFadeIn 0.15s ease;
}
@keyframes wdbFadeIn { from { opacity: 0; } to { opacity: 1; } }

.wdb-sidebar-panel {
    background: var(--st-white);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wdbSlideInRight 0.22s cubic-bezier(0.22,1,0.36,1);
}
@keyframes wdbSlideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Error bar */
.wdb-error-bar {
    background: #FEF2F2;
    border-bottom: 1px solid #FCA5A5;
    color: var(--st-error);
    font-size: 13px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Header */
.wdb-sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--st-border);
    flex-shrink: 0;
}
.wdb-sb-header-icon {
    color: var(--st-primary);
    font-size: 20px;
    flex-shrink: 0;
}
.wdb-sb-header-text { flex: 1; min-width: 0; margin-left: 10px; }
.wdb-sb-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--st-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wdb-sb-subtitle {
    font-size: 11px;
    color: var(--st-muted);
    margin-top: 1px;
}
.wdb-sb-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 0.12s;
    flex-shrink: 0;
}
.wdb-sb-close:hover { background: #F1F5F9; color: var(--st-text); }

/* Toolbar */
.wdb-sb-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--st-border);
    flex-shrink: 0;
}
.wdb-sb-toolbar-translations {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--st-bg);
    border-bottom: 1px solid var(--st-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.wdb-save-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    color: var(--st-subtle);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.wdb-save-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wdb-save-dot.saving {
    background: var(--st-primary);
    animation: wdbPulse 1s ease-in-out infinite;
}
.wdb-save-dot.saved { background: var(--st-success); }
.wdb-save-dot.error { background: var(--st-error); }
@keyframes wdbPulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* Compact button */
.wdb-btn-sm {
    background: none;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.wdb-btn-sm:hover { background: var(--st-bg); border-color: var(--st-border-hover); }
.wdb-btn-sm.primary {
    background: var(--st-primary);
    border-color: var(--st-primary);
    color: var(--st-white);
}
.wdb-btn-sm.primary:hover { background: var(--st-primary-hover); }
.wdb-btn-sm.danger { color: var(--st-error); border-color: #FCA5A5; }
.wdb-btn-sm.danger:hover { background: #FEF2F2; }

/* Scrollable body */
.wdb-sb-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--st-border-hover) transparent;
}
.wdb-sb-body::-webkit-scrollbar { width: 5px; }
.wdb-sb-body::-webkit-scrollbar-track { background: transparent; }
.wdb-sb-body::-webkit-scrollbar-thumb { background: var(--st-border-hover); border-radius: 10px; }

/* Draft area row */
.wdb-new-area-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--st-primary-light);
    border: 1.5px dashed var(--st-primary);
    border-radius: 10px;
    margin-bottom: 10px;
}
.wdb-new-area-row input {
    flex: 1;
    background: var(--st-white);
    border: 1.5px solid var(--st-primary);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--st-text);
    outline: none;
}

/* Area card */
.wdb-area-card {
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.wdb-area-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--st-bg);
    border-bottom: 1px solid var(--st-border);
}
.wdb-reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}
.wdb-reorder-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-subtle);
    padding: 1px 3px;
    font-size: 12px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.1s, background 0.1s;
}
.wdb-reorder-btn:hover:not(:disabled) { color: var(--st-primary); background: var(--st-primary-light); }
.wdb-reorder-btn:disabled { opacity: 0.25; cursor: default; }
.wdb-area-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--st-text);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wdb-area-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.wdb-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-subtle);
    padding: 4px;
    border-radius: 5px;
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: color 0.12s, background 0.12s;
}
.wdb-icon-btn:hover { color: #475569; background: #F1F5F9; }
.wdb-icon-btn.danger:hover { color: var(--st-error); background: #FEF2F2; }

/* ── Translations popover ─────────────────────────────────────────────── */
.wdb-lang-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    z-index: 10;
}
.wdb-lang-popover {
    background: var(--st-white);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
    padding: 16px;
    width: 360px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wdb-lang-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--st-text);
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #F1F5F9;
}
.wdb-lang-section { display: flex; flex-direction: column; }
.wdb-lang-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #F1F5F9;
}
.wdb-lang-radio,
.wdb-lang-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.wdb-lang-radio:hover,
.wdb-lang-check:hover { background: var(--st-bg); }
.wdb-lang-radio input,
.wdb-lang-check input { margin: 0; }

.wdb-view-lang {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: var(--st-white);
}
.wdb-view-lang-select {
    border: none;
    background: transparent;
    font-size: 12px;
    color: var(--st-text);
    cursor: pointer;
    outline: none;
}

/* Preview-mode (viewing a translation, edits disabled) */
.wdb-preview-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #FEF3C7;
    border-bottom: 1px solid #FCD34D;
    color: #92400E;
    font-size: 12px;
}
.wdb-preview-banner-btn {
    margin-left: auto;
    background: var(--st-white);
    color: #92400E;
    border: 1px solid #FCD34D;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.wdb-preview-banner-btn:hover { background: #FEF3C7; }

.wdb-field-input[readonly] {
    background: #F1F5F9;
    color: var(--st-muted);
    cursor: not-allowed;
    border-color: #E2E8F0;
}
.wdb-field-input[readonly]:focus { outline: none; box-shadow: none; }

/* Inline unsaved-changes confirmation, rendered inside the sidebar so z-index works naturally. */
.wdb-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.wdb-confirm-card {
    background: var(--st-white);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 20px;
    width: 360px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}
.wdb-confirm-title { font-size: 15px; font-weight: 600; color: var(--st-text); margin-bottom: 8px; }
.wdb-confirm-message { font-size: 13px; color: #475569; margin-bottom: 16px; line-height: 1.5; }
.wdb-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Area body (expanded) */
.wdb-area-body {
    padding: 12px 12px 10px;
}
.wdb-field-row {
    display: grid;
    grid-template-columns: 1fr 90px;
    gap: 8px;
    margin-bottom: 8px;
}
.wdb-field-input {
    width: 100%;
    background: var(--st-bg);
    border: 1.5px solid var(--st-border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 13px;
    color: var(--st-text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}
.wdb-field-input:focus { background: var(--st-white); border-color: var(--st-primary); box-shadow: 0 0 0 2px rgba(74,118,249,0.1); }
.wdb-field-input.wdb-field-error { border-color: var(--st-error); background: #FEF2F2; }
.wdb-field-input.wdb-field-error:focus { border-color: var(--st-error); box-shadow: 0 0 0 2px rgba(239,68,68,0.1); }
.wdb-field-input.full-width { grid-column: span 2; }
.wdb-field-label {
    font-size: 11px;
    color: var(--st-muted);
    font-weight: 500;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frequency list */
.wdb-freq-list {
    margin-top: 8px;
    border-top: 1px solid #F1F5F9;
    padding-top: 8px;
}

/* Frequency row */
.wdb-freq-row {
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    margin-bottom: 6px;
    overflow: hidden;
}
.wdb-freq-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    flex-wrap: wrap;
}
.wdb-schedule-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 20px;
    background: var(--st-primary-light);
    color: var(--st-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    white-space: nowrap;
}
.wdb-freq-meta {
    font-size: 11px;
    color: var(--st-muted);
    white-space: nowrap;
}
.wdb-freq-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Inline confirm */
.wdb-inline-confirm {
    background: #FEF2F2;
    border-top: 1px solid #FCA5A5;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--st-error);
}

/* Frequency form */
.wdb-freq-form {
    padding: 10px 10px 8px;
    background: var(--st-white);
    border-top: 1px solid var(--st-border);
}
.wdb-freq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.wdb-freq-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.wdb-freq-grid-3 > div,
.wdb-freq-grid > div {
    min-width: 0;
    overflow: hidden;
}
.wdb-freq-select {
    width: 100%;
    background: var(--st-bg);
    border: 1.5px solid var(--st-border);
    border-radius: 6px;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--st-text);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.wdb-freq-select:focus { background: var(--st-white); border-color: var(--st-primary); }

/* Draft frequency row */
.wdb-draft-freq-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    background: var(--st-primary-light);
    border: 1.5px dashed #93B4FB;
    border-radius: 8px;
    margin-bottom: 6px;
}

/* Add frequency dashed button */
.wdb-add-freq-btn {
    width: 100%;
    background: none;
    border: 1.5px dashed var(--st-border-hover);
    border-radius: 8px;
    padding: 7px 10px;
    font-family: inherit;
    font-size: 12px;
    color: var(--st-subtle);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.wdb-add-freq-btn:hover { border-color: var(--st-primary); color: var(--st-primary); background: var(--st-primary-light); }

/* Checklist section */
.wdb-checklist-section {
    margin-top: 8px;
    border-top: 1px solid #F1F5F9;
    padding-top: 8px;
}
.wdb-checklist-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 5px;
    margin-bottom: 2px;
    transition: background 0.1s;
}
.wdb-checklist-item:hover { background: var(--st-bg); }
.wdb-checklist-text {
    flex: 1;
    font-size: 12px;
    color: var(--st-text);
}
.wdb-checklist-dept {
    font-size: 10px;
    color: var(--st-subtle);
    background: #F1F5F9;
    padding: 1px 5px;
    border-radius: 20px;
}

/* Attachment section */
.wdb-attachment-section {
    margin-top: 8px;
    border-top: 1px solid #F1F5F9;
    padding-top: 8px;
}
.wdb-attachment-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.wdb-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--st-border);
}
.wdb-pending-thumb {
    width: 48px;
    height: 48px;
    border: 2px dashed var(--st-warning);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--st-warning);
    position: relative;
    background: #FFF7ED;
}
.wdb-thumb-wrap {
    position: relative;
    width: 48px;
    height: 48px;
}
.wdb-thumb-wrap .wdb-thumb {
    width: 48px;
    height: 48px;
}
.wdb-thumb-del {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--st-error);
    color: var(--st-white);
    border: 1px solid var(--st-white);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.wdb-thumb-wrap:hover .wdb-thumb-del {
    display: flex;
}
.wdb-dropzone {
    width: 72px;
    height: 48px;
    border: 2px dashed var(--st-border-hover);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--st-subtle);
    background: var(--st-bg);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.wdb-dropzone:hover {
    background: #EFF6FF;
    border-color: var(--st-primary);
    color: var(--st-primary);
}
.wdb-dropzone.uploading {
    background: #EFF6FF;
    border-color: var(--st-primary);
    cursor: default;
}
.wdb-area-body.drag-over {
    outline: 2px dashed var(--st-primary);
    outline-offset: -4px;
    background: #F0F6FF;
}

/* Archived section */
.wdb-archived-section {
    margin-top: 16px;
    border-top: 1px solid var(--st-border);
    padding-top: 12px;
}
.wdb-archived-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--st-subtle);
    background: none;
    border: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
    width: 100%;
    text-align: left;
    transition: color 0.12s;
}
.wdb-archived-toggle:hover { color: var(--st-muted); }
.wdb-archived-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    margin-top: 6px;
}
.wdb-archived-inline-confirm {
    margin-top: 4px;
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--st-error);
}

/* Copy-to dropdown */
.wdb-copy-dropdown {
    position: relative;
    display: inline-flex;
}
.wdb-copy-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 160px;
    z-index: 10;
    overflow: hidden;
}
.wdb-copy-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--st-text);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: none;
    border: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
}
.wdb-copy-menu-item:hover { background: var(--st-bg); }
.wdb-copy-menu-sep {
    height: 1px;
    background: #E8EDF5;
    margin: 2px 0;
}

.wdb-task-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 180px;
    overflow-y: auto;
    z-index: 20;
    margin-top: 2px;
}
.wdb-task-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--st-text);
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}
.wdb-task-dropdown-item:hover { background: #F1F5F9; }

/* ── Shift Scheduler ─────────────────────────────────────────────────── */
.shift-employee-cell { cursor: pointer; transition: background 0.15s; }
.shift-employee-cell:hover { background: #F1F5F9 !important; }
.shift-card {
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: box-shadow 0.15s;
    font-size: 11px;
}
.shift-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.shift-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}
.shift-card-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--st-text);
}
.shift-card-checkbox {
    cursor: pointer;
    width: 14px;
    height: 14px;
}
.shift-card-type {
    font-size: 10px;
    color: var(--st-muted);
}
.shift-card-actual {
    font-size: 10px;
    color: var(--st-muted);
    margin-top: 2px;
}
.calendar-table td, .calendar-table th {
    border-right: 1px solid #F1F5F9;
}
.calendar-table td:last-child, .calendar-table th:last-child {
    border-right: none;
}
.bulk-action-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: var(--st-text);
    border-top: 2px solid var(--st-primary);
    padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); /* clear the iOS home indicator */
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    animation: slideUp 0.2s ease;
}
.bulk-action-count {
    color: white;
    font-size: 13px;
    margin-right: 8px;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ── Shift Overview Popup ─────────────────────────────────────────────── */
.shift-overview-dialog .mud-dialog-content { padding: 0; overflow: hidden; }

.wd-import-dialog .mud-input-control { margin-top: 0 !important; margin-bottom: 0 !important; }
.wd-import-dialog .mud-input.mud-input-outlined { padding-top: 4px !important; padding-bottom: 4px !important; }
.wd-import-dialog .mud-input-label-outlined { top: -4px !important; font-size: 12px !important; }
.wd-import-dialog .mud-input-slot { font-size: 13px !important; padding: 4px 8px !important; }

.shift-overview-modal {
    padding: 24px;
    max-height: 65vh;
    overflow-y: auto;
}

.period-selector-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--st-border);
}

.period-nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--st-border);
    background: var(--st-white);
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.period-nav-btn:hover:not(:disabled) {
    background: #F1F5F9;
}

.period-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.shift-overview-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-subtle);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.summary-card {
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: 14px 16px;
}

.summary-card-total {
    border-color: var(--st-border);
    border-left: 3px solid var(--st-primary);
    background: #F5F8FF;
}

.overwork-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.overwork-week-tile {
    background: var(--st-white);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 100px;
}

.overwork-tile-has-overwork .overwork-week-tile,
.overwork-tile-has-overwork {
    border-color: #FED7AA;
}

.overwork-tile-has-overwork div:nth-child(2) {
    color: var(--st-warning);
}

.overwork-tile-zero div:nth-child(2) {
    color: var(--st-border-hover);
}

.overwork-tile-total {
    background: #FFF7ED;
    border-color: #FDE68A;
}


.scheduler-emp-clickable {
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: background 0.15s;
}

.scheduler-emp-clickable:hover {
    background: #F1F5F9;
}


.shift-filter-btn {
    background: var(--st-white);
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--st-muted);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shift-filter-btn:hover {
    background: var(--st-bg);
    border-color: var(--st-border-hover);
    color: var(--st-text);
}

.shift-filter-btn.active {
    background: var(--st-primary);
    color: var(--st-white);
    border-color: var(--st-primary);
}

/* ── Shift Approval Tab ─────────────────────────────────────────────── */

.approval-time-input {
    padding: 4px 8px;
    border: 1.5px solid #E2E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 78px;
    outline: none;
}

.approval-time-input:focus {
    border-color: var(--st-primary);
}

.approval-time-input.missing {
    border-color: #FCA5A5;
    background: #FEF2F2;
}

/* ── Draw Route calendar cell button ── */
.cell-draw-btn {
    background: none;
    border: 1px dashed #A5B4FC;
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #818CF8;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s;
    width: 100%;
}
.cell-draw-btn:hover {
    background: #EEF2FF;
    border-color: #6366F1;
    color: #4F46E5;
    border-style: solid;
}

/* ── Route drawn indicator card ── */
.route-indicator {
    background: #EEF2FF;
    border: 1px solid #A5B4FC;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.1s;
    flex: 1;
}
.route-indicator:hover { background: #E0E7FF; }
.route-indicator.dragging { opacity: 0.4; cursor: grabbing; }

.route-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    color: #A5B4FC;
    cursor: grab;
    flex-shrink: 0;
}

.route-drag-handle:active { cursor: grabbing; }
.route-drag-handle:hover { color: #6366F1; }

.route-indicator-icon {
    width: 28px;
    height: 28px;
    background: #6366F1;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.route-indicator-body { flex: 1; min-width: 0; }
.route-indicator-label {
    font-size: 11px;
    font-weight: 600;
    color: #4338CA;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.route-indicator-meta { font-size: 10px; color: #6366F1; margin-top: 1px; }
.route-indicator-dist { font-size: 10px; font-weight: 600; color: #6366F1; white-space: nowrap; }

/* ── Draw Route modal overlay ── */
.draw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1200;
    display: flex;
    align-items: stretch;
}
.draw-modal {
    display: flex;
    flex-direction: column;
    background: var(--st-white);
    width: 100%;
    height: 100%;
}
.draw-modal-toolbar {
    height: 56px;
    background: var(--st-white);
    border-bottom: 1px solid var(--st-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 10;
}
.draw-modal-title { font-size: 15px; font-weight: 600; color: var(--st-text); line-height: 1.2; }
.draw-modal-subtitle { font-size: 11px; color: var(--st-subtle); }
.draw-map-layout { flex: 1; display: flex; overflow: hidden; }
.draw-map-container { flex: 1; position: relative; overflow: hidden; cursor: crosshair; }
.draw-map-container.readonly { cursor: default; }
.draw-map-sidebar {
    width: 260px;
    background: var(--st-white);
    border-left: 1px solid var(--st-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}
.draw-map-sidebar-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.draw-map-sidebar-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.route-stat-card {
    background: var(--st-bg);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.stat-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-row:last-child { margin-bottom: 0; }
.stat-label { font-size: 11px; color: var(--st-subtle); font-weight: 500; }
.stat-value { font-size: 13px; font-weight: 600; color: var(--st-text); }
.stat-value.blue { color: var(--st-primary); }
.map-instruction-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    z-index: 5;
}
.map-instruction-dot {
    width: 8px; height: 8px;
    background: var(--st-primary); border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }
.view-mode-banner {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(99,102,241,0.9);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--st-white);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 5;
}
.snapping-toast {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--st-text);
    color: var(--st-white);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 20;
    white-space: nowrap;
}
.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--st-white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-btn {
    background: var(--st-bg);
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 7px 10px 7px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 190px;
    justify-content: space-between;
    transition: border-color 0.15s;
}
.overlay-btn:hover, .overlay-btn.open { background: #F1F5F9; border-color: var(--st-primary); }
.overlay-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--st-white);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 230px;
    z-index: 50;
    overflow: hidden;
}
.overlay-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--st-bg);
}
.overlay-item:hover { background: var(--st-bg); }
.overlay-item-checkbox {
    width: 15px; height: 15px;
    border: 1.5px solid var(--st-border-hover);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.15s; background: var(--st-white);
}
.overlay-item.checked .overlay-item-checkbox { background: var(--st-primary); border-color: var(--st-primary); }
.overlay-item-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.mode-toggle { display: flex; background: #F1F5F9; border-radius: 6px; padding: 3px; gap: 2px; }
.mode-btn {
    border: none; background: none;
    padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--st-muted);
    cursor: pointer; border-radius: 4px; font-family: inherit;
    display: flex; align-items: center; gap: 5px; transition: all 0.1s;
}
.mode-btn.active { background: var(--st-white); color: var(--st-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.waypoint-list-title {
    font-size: 11px; font-weight: 600; color: var(--st-subtle);
    text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 8px;
}
.waypoint-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid #F1F5F9; font-size: 12px;
}
.waypoint-num {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--st-primary-light); color: var(--st-primary);
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.waypoint-num.green { background: #D1FAE5; color: #059669; }
.waypoint-num.red { background: #FEE2E2; color: var(--st-error); }
.waypoint-coords { flex: 1; color: #475569; font-size: 11px; font-family: 'SF Mono', monospace; }
.overlay-legend {
    position: absolute; bottom: 32px; left: 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #E2E8F0; border-radius: 8px;
    padding: 10px 12px; font-size: 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); z-index: 5;
}

/* Planning — location search results */
.planning-loc-result:hover {
    background: #F1F5F9 !important;
}
.planning-loc-result:last-child {
    border-bottom: none;
}

/* ── Inline-to-popup dialog (itl) ───────────────────────────────────────── */
.itl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}
.itl-popup {
    background: var(--st-white);
    border-radius: 16px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.itl-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}
.itl-popup-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--st-text);
}
.itl-popup-body {
    padding: 20px 24px 24px;
}
.itl-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-subtle);
    padding: 4px;
    border-radius: 6px;
}
.itl-close-btn:hover {
    background: #F1F5F9;
    color: var(--st-muted);
}

/* ── Access Locations ──────────────────────────────────────────────────── */
.access-locations-map-container { width: 100%; height: 560px; border-radius: 12px; border: 1px solid var(--st-border); }
.access-locations-wrap { position: relative; width: 100%; }
.access-locations-overlay {
    position: absolute; top: 12px; left: 12px; z-index: 5;
    width: 320px; max-height: calc(100% - 24px);
    display: flex; flex-direction: column;
    background: var(--st-white); border: 1px solid var(--st-border); border-radius: 12px;
    box-shadow: 0 6px 24px rgba(15,23,42,0.18);
    overflow: hidden;
}
.access-locations-overlay-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #F1F5F9; }
.access-locations-overlay-title { font-size: 14px; font-weight: 600; color: var(--st-text); }
.access-locations-overlay-body { flex: 1; overflow-y: auto; padding: 8px; }
.access-locations-overlay-footer { padding: 8px 10px; border-top: 1px solid #F1F5F9; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--st-muted); }

.access-location-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
    margin-bottom: 4px; background: var(--st-white); cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.access-location-row:hover { background: var(--st-bg); border-color: var(--st-border); }
.access-location-row.archived { opacity: 0.6; }
.access-location-star { cursor: pointer; color: var(--st-border-hover); font-size: 18px; border: none; background: none; padding: 0; line-height: 1; flex-shrink: 0; }
.access-location-star.active { color: var(--st-warning); }
.access-location-badge-archived { font-size: 11px; background: #F1F5F9; color: var(--st-muted); padding: 2px 8px; border-radius: 4px; }

/* ── Plan day notes and location labels ───────────────────────────────── */
.entry-location-flags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 0; }
.plan-day-note { font-size: 12px; color: var(--st-muted); background: var(--st-bg); border-left: 3px solid #3B82F6; padding: 6px 10px; margin-bottom: 8px; border-radius: 4px; }
.plan-location-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #3B82F6; font-weight: 500; padding: 2px 8px; background: #EFF6FF; border-radius: 4px; }

/* ── Planning entry drop placeholder (rendered by planning-dnd.js; must not be scoped) ─ */
.entry-drop-ghost {
    height: 56px;
    margin: 6px 0;
    border: 2px dotted var(--st-subtle);
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.12);
    pointer-events: none;
    transition: none;
}

/* ─── E-learning ─── */
.elearning-seg {
    display: inline-flex;
    align-items: center;
    background: #F1F5F9;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.elearning-seg button {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.elearning-seg button.on {
    background: var(--st-white);
    color: var(--st-text-strong);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.elearning-seg button:hover:not(.on) {
    color: var(--st-text-strong);
}

/* "TEST" environment badge under the logo (hidden only when pointed at the prod API) */
.st-test-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--st-warning);
    color: var(--st-white);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: var(--st-radius-full);
    line-height: 1.4;
    text-transform: uppercase;
}
.st-test-badge-sm { margin: 0; }

/* Free-subcontractor upgrade nudge under the sidebar logo */
.st-upgrade-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 12px 10px 12px;
    padding: 7px 12px;
    background: linear-gradient(135deg, #4A76F9, #7C3AED);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
}
.st-upgrade-pill:hover { filter: brightness(1.08); }

/* Shared base-map style toggle (satellite photo vs vector map) — used by the maps
   that don't have their own component-scoped variant. Position it inside a
   position:relative map wrapper. */
.map-styletoggle-group {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}
.map-styletoggle {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #FFFFFF;
    color: #475569;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.map-styletoggle + .map-styletoggle { border-top: 1px solid #E2E8F0; }
.map-styletoggle:hover { background: #F1F5F9; }
.map-styletoggle.on { background: #4A76F9; color: #FFFFFF; }
