* { box-sizing: border-box; }

html, body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
    height: 100%;
    background: #F8FAFC;
}

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

/* Sidebar — fixed to the left edge of the viewport */
.st-sidebar {
    background: #ffffff;
    border-right: 1px solid #E8EDF5;
    width: 240px;
    min-width: 240px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.st-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #1E293B;
    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: #94A3B8;
    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: #1E293B;
}

/* 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: #EEF3FE;
    color: #4A76F9;
}

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

.st-sidebar-footer {
    margin-top: auto;
    padding: 8px 0 0;
    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: #F8FAFC; }

.st-user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: #4A76F9;
    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: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-user-tenant {
    font-size: 11px;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-notif-badge {
    margin-left: auto;
    background: #EF4444;
    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: #ffffff;
    border-bottom: 1px solid #E8EDF5;
    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;
}

.st-page-title {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    flex: 1;
}

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

/* Status badges */
.st-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    gap: 5px;
}

.st-status.draft     { background: #F1F5F9; color: #64748B; }
.st-status.scheduled { background: #EFF6FF; color: #3B82F6; }
.st-status.inprogress{ background: #FFF7ED; color: #F97316; }
.st-status.completed { background: #F0FDF4; color: #22C55E; }
.st-status.cancelled { background: #FEF2F2; color: #EF4444; }
.st-status.archived  { background: #F3F4F6; color: #9CA3AF; }

/* Responsive */
@media (max-width: 768px) {
    .st-sidebar { width: 100%; height: auto; position: relative; }
    .st-main { margin-left: 0; }
}

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

/* White section card */
.dash-section {
    background: #ffffff;
    border: 1px solid #E8EDF5;
    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: #64748B;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.dpt-btn:hover { background: #E2E8F0; color: #1E293B; }
.dpt-btn.active { background: #ffffff; color: #1E293B; 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: #F8FAFC;
    border: 1px solid #E8EDF5;
    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: #4A76F9;
    letter-spacing: 0.06em;
    background: #EEF3FE;
    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: #EEF3FE; color: #4A76F9; }
.dash-kpi-badge.badge-green  { background: #F0FDF4; color: #22C55E; }
.dash-kpi-badge.badge-orange { background: #FFF7ED; color: #F97316; }
.dash-kpi-badge.badge-grey   { background: #F1F5F9; color: #64748B; }

.dash-kpi-desc {
    font-size: 12px;
    color: #94A3B8;
    margin-bottom: 6px;
}

.dash-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #1E293B;
    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: #ffffff;
    border: 1px solid #E8EDF5;
    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: #1E293B;
}

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

/* Tab row inside panel header */
.dash-tab-row {
    display: flex;
    background: #F1F5F9;
    border-radius: 6px;
    padding: 2px;
    gap: 1px;
}

.dtab {
    background: transparent;
    border: none;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.dtab:hover { background: #E2E8F0; color: #1E293B; }
.dtab.active { background: #ffffff; color: #1E293B; box-shadow: 0 1px 2px rgba(0,0,0,.07); }

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

.dash-task-row:hover { background: #F8FAFC; }
.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: #1E293B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-customer{ font-size: 12px; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-addr    { font-size: 11px; color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Team activity row */
.dash-team-row {
    padding: 12px 16px;
    border-bottom: 1px solid #F8FAFC;
}

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

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

.dash-completed-row:hover { background: #F8FAFC; }
.dash-completed-row:last-child { border-bottom: none; }

/* Calendar — table-style grid */
.dash-cal-table {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #E8EDF5;
    border-left: 1px solid #E8EDF5;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
.dash-cal-table.has-week-col {
    grid-template-columns: 36px repeat(7, 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: #94A3B8;
    background: #F8FAFC;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
}

/* Header cells */
.dash-cal-th {
    background: #F8FAFC;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    text-align: center;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
}

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

/* Day cells */
.dash-cal-cell {
    background: #ffffff;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
    padding: 8px 10px 8px;
    min-height: 90px;
    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: #EEF3FE;
}

.dash-cal-cell-date {
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    margin-bottom: 6px;
}

.dash-cal-cell.today .dash-cal-cell-date { color: #4A76F9; 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; }

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

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

/* Tab strip below topbar */
.cust-tab-strip {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-bottom: 1px solid #E8EDF5;
    padding: 0;
}

.cust-tab-strip-inner {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
}

.cust-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #64748B;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    margin-bottom: -1px;
}

.cust-tab:hover { color: #1E293B; }

.cust-tab.active {
    color: #4A76F9;
    border-bottom-color: #4A76F9;
    font-weight: 600;
}

.cust-tab.disabled {
    color: #CBD5E1;
    cursor: not-allowed;
}

.cust-tab-count {
    background: #EEF3FE;
    color: #4A76F9;
    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: #4A76F9;
    color: #ffffff;
}

/* 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: #1E293B;
    background: #ffffff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.cust-search-input:focus { border-color: #4A76F9; }
.cust-search-input::placeholder { color: #94A3B8; }

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

.cust-th {
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    background: #F8FAFC;
    text-align: left;
    border-bottom: 1px solid #E8EDF5;
    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: #F8FAFC; }

/* Checkbox */
.cust-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4A76F9;
}

/* Location count badge */
.cust-loc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #EEF3FE;
    color: #4A76F9;
    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: #ffffff;
    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: #4A76F9;
    color: #ffffff;
    border-color: #4A76F9;
}

/* ── 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: #64748B;
    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: #1E293B; }

/* 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: #ffffff;
    border: 1px solid #E8EDF5;
    border-radius: 12px;
    padding: 18px 20px 16px;
}

.cust-detail-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1E293B;
    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: #94A3B8;
    padding: 9px 12px 9px 0;
    width: 110px;
    white-space: nowrap;
    vertical-align: top;
}

.cust-info-value {
    font-size: 13px;
    color: #1E293B;
    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: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 8px 8px 0;
    text-align: left;
}

.cust-loc-table tbody tr { border-top: 1px solid #F8FAFC; }
.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 #F8FAFC;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 4px;
}
.cust-task-row:hover { background: #F8FAFC; 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: #4A76F9;
    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 */
.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 */
.mud-input-outlined .mud-input-outlined-border { border-color: #CBD5E1 !important; }
.mud-input-control.mud-input-input-control { border-radius: 4px; }
.mud-input-outlined:hover .mud-input-outlined-border { border-color: #94A3B8 !important; }
.mud-input-outlined.mud-input-focused .mud-input-outlined-border { border-color: #4A76F9 !important; }

/* Negative/destructive buttons */
.mud-button-root.mud-error-text { border: none !important; background: #EF4444 !important; color: #FFFFFF !important; }
.mud-button-root.mud-error-text:hover { background: #DC2626 !important; }
.mud-message-box__yes-button .mud-button-root { border: none !important; background: #EF4444 !important; color: #FFFFFF !important; }
.mud-message-box__yes-button .mud-button-root:hover { background: #DC2626 !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: #1E293B;
}

.pac-item:hover, .pac-item-selected { background: #F1F5F9; }
.pac-item-query { font-weight: 500; }
.pac-matched { color: #4A76F9; }

/* Address autocomplete input — matches MudBlazor outlined variant */
.addr-ac-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.addr-ac-label {
    font-size: 12px;
    font-weight: 500;
    color: #64748B;
    padding-left: 2px;
}

.addr-ac-input {
    width: 100%;
    padding: 14px 14px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #1E293B;
    background: #F1F5F9;
    outline: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.addr-ac-input:hover  { border-color: #CBD5E1; }
.addr-ac-input:focus  { background: #fff; border-color: #4A76F9; box-shadow: 0 0 0 3px rgba(74,118,249,.12); }
.addr-ac-input::placeholder { color: #94A3B8; }

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

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

/* Default: light grey fill, invisible border */
.mud-input.mud-input-outlined {
    background: #F1F5F9;
    border-radius: 8px;
    transition: background .15s, box-shadow .15s;
}
.mud-input-outlined-border {
    border: 1.5px solid transparent !important;
    border-radius: 8px !important;
    transition: border-color .15s !important;
}

/* Hover: faint border */
.mud-input.mud-input-outlined:not(.mud-disabled):hover .mud-input-outlined-border {
    border-color: #CBD5E1 !important;
}

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

/* Error state */
.mud-input.mud-input-outlined.mud-input-error {
    background: #FEF2F2;
}
.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: #F8FAFC;
    opacity: .65;
}

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

/* ── 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: #1E293B;
    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;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #E8EDF5;
    border-left: 1px solid #E8EDF5;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}
.task-cal-grid.has-week-col {
    grid-template-columns: 36px repeat(7, 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: #94A3B8;
    background: #F8FAFC;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
}

.task-cal-header {
    background: #F8FAFC;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    text-align: center;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
}

.task-cal-cell {
    background: #ffffff;
    border-right: 1px solid #E8EDF5;
    border-bottom: 1px solid #E8EDF5;
    padding: 6px 6px 8px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-cal-cell.weekend { background: #FAFBFC; }
.task-cal-cell.today { background: #EEF3FE; }
.task-cal-cell.other-month { opacity: 0.45; }

.task-cal-day-num {
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    margin-bottom: 2px;
    padding: 0 2px;
}
.task-cal-cell.today .task-cal-day-num { color: #4A76F9; 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: #64748B; }
.task-cal-pill.scheduled  { background: #EFF6FF; color: #3B82F6; }
.task-cal-pill.inprogress { background: #FFF7ED; color: #F97316; }
.task-cal-pill.completed  { background: #F0FDF4; color: #22C55E; }
.task-cal-pill.cancelled  { background: #FEF2F2; color: #EF4444; }
.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: #94A3B8;
    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 #F8FAFC;
    cursor: pointer;
    transition: background 0.12s;
}
.day-tasks-row:hover { background: #F8FAFC; }
.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: #ffffff;
    border: 1px solid #E8EDF5;
    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 #4A76F9;
}

.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: #1E293B;
    margin: 0;
}

.sap-sidebar-count {
    background: #EEF3FE;
    color: #4A76F9;
    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 #E8EDF5;
    margin-bottom: 4px;
}

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

.sap-sidebar-item:hover {
    background: #F8FAFC;
}

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

.sap-sidebar-item-customer {
    font-size: 13px;
    font-weight: 500;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-sidebar-item-location {
    font-size: 12px;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-sidebar-item-title {
    font-size: 11px;
    color: #94A3B8;
    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 #E8EDF5;
}

.sap-sidebar-section-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
}

.sap-sidebar-section-hint {
    font-size: 11px;
    color: #94A3B8;
    padding: 0 12px 6px;
    line-height: 1.4;
}

.sap-calendar {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #E8EDF5;
    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: 5px 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: grab;
    line-height: 1.5;
    margin-bottom: 2px;
    border: 1px solid currentColor;
    border-radius: 5px;
}

.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 #4A76F9;
}

.sap-empty-sidebar {
    padding: 24px 16px;
    text-align: center;
    color: #94A3B8;
    font-size: 13px;
}

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

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

#blazor-error-ui {
    background: #FEF2F2;
    border-top: 1px solid #FECACA;
    color: #DC2626;
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    z-index: 1000;
}
#blazor-error-ui .reload { color: #DC2626; }

/* ── 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: #F8FAFC;
    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: #64748B;
    margin-bottom: 6px;
}
.day-detail-stat-number {
    font-size: 20px;
    font-weight: 700;
    color: #1E293B;
}
.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: #94A3B8;
    border-left: 2px dashed #CBD5E1;
    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: #F8FAFC;
}
.day-detail-task-row.urgent {
    border-left: 3px solid #EF4444;
}

.day-detail-drag-handle {
    display: flex;
    align-items: center;
    cursor: grab;
    color: #94A3B8;
    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: #1E293B;
    display: flex;
    align-items: center;
    gap: 8px;
}
.day-detail-task-location {
    font-size: 12px;
    color: #64748B;
    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: #64748B;
    font-weight: 500;
}

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

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

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.msg-sidebar {
    width: 280px;
    min-width: 280px;
    background: #FFFFFF;
    border-right: 1px solid #E8EDF5;
    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: #1E293B;
}

.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: #1E293B;
    transition: border-color 0.15s;
}
.msg-search:focus {
    background: #FFFFFF;
    border-color: #4A76F9;
    box-shadow: 0 0 0 3px rgba(74,118,249,0.12);
}
.msg-search::placeholder { color: #94A3B8; }

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

.msg-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #94A3B8;
    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: #EEF3FE;
}

.msg-conv-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #EEF3FE;
    color: #4A76F9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.msg-conv-avatar.group {
    background: #EEF3FE;
    color: #4A76F9;
}
.msg-conv-avatar.announcement {
    background: #FEF3C7;
    color: #F97316;
}
.msg-conv-avatar.team {
    background: #D1FAE5;
    color: #22C55E;
}

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

.msg-conv-name {
    font-size: 13px;
    font-weight: 500;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-conv-preview {
    font-size: 12px;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.msg-conv-unread {
    background: #4A76F9;
    color: #FFFFFF;
    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: #4A76F9;
    color: #FFFFFF;
    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: #3561E0; }

/* ── Thread area ─────────────────────────────────────────────────────────── */
.msg-thread-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #F8FAFC;
    position: relative;
}

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

.msg-polling-progress {
    height: 2px;
    width: 0;
    background: #4A76F9;
}

.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: #FFFFFF;
    border-bottom: 1px solid #E8EDF5;
    flex-shrink: 0;
}

.msg-thread-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: #EEF3FE;
    color: #4A76F9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.msg-thread-avatar.group { background: #EEF3FE; color: #4A76F9; }
.msg-thread-avatar.announcement { background: #FEF3C7; color: #F97316; }

.msg-thread-title {
    font-size: 15px;
    font-weight: 600;
    color: #1E293B;
}

.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: #EEF3FE; color: #4A76F9; }
.msg-badge-group { background: #EEF3FE; color: #4A76F9; }
.msg-badge-announcement { background: #FEF3C7; color: #F97316; }
.msg-badge-team { background: #D1FAE5; color: #22C55E; }

/* ── 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 #E8EDF5;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    color: #4A76F9;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
}
.msg-load-more-btn:hover { background: #EEF3FE; }

.msg-date-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94A3B8;
    font-size: 12px;
    font-weight: 500;
    margin: 12px 0 8px;
}
.msg-date-divider::before,
.msg-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E8EDF5;
}

/* ── 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: #EEF3FE;
    color: #4A76F9;
    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: #64748B;
    padding: 0 12px;
    margin-bottom: 2px;
}

.msg-bubble {
    background: #F1F5F9;
    color: #1E293B;
    border-radius: 12px 12px 12px 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
}
.msg-row.self .msg-bubble {
    background: #4A76F9;
    color: #FFFFFF;
    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: #94A3B8;
    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: #EF4444; }

.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: #94A3B8;
}

.msg-empty-thread-icon {
    font-size: 48px !important;
    color: #CBD5E1;
    display: block;
    margin-bottom: 8px;
}

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

/* ── Composer ────────────────────────────────────────────────────────────── */
.msg-composer {
    background: #FFFFFF;
    border-top: 1px solid #E8EDF5;
    padding: 12px 16px;
    flex-shrink: 0;
}

.msg-composer-blocked {
    background: #FFF7ED;
    border-top: 1px solid #FED7AA;
    padding: 12px 16px;
    font-size: 13px;
    color: #F97316;
    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: #FFFFFF;
    border-color: #4A76F9;
    box-shadow: 0 0 0 3px rgba(74,118,249,0.12);
}
.msg-composer-textarea::placeholder { color: #94A3B8; }

.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: #64748B;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
}
.msg-composer-icon-btn:hover { background: #F1F5F9; border-color: #CBD5E1; }

.msg-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4A76F9;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.msg-send-btn:hover:not(:disabled) { background: #3561E0; }
.msg-send-btn:disabled { background: #CBD5E1; 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: #EEF3FE;
    color: #4A76F9;
    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: #FFFFFF;
    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 #E8EDF5;
}

.msg-dialog-title {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
}

.msg-dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748B;
    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;
    padding: 12px 20px;
    border-top: 1px solid #E8EDF5;
}

.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: #1E293B;
    transition: border-color 0.15s;
}
.msg-dialog-input:focus {
    background: #FFFFFF;
    border-color: #4A76F9;
    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 #E8EDF5;
    border-radius: 8px;
    background: #FFFFFF;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.12s, background 0.12s;
    color: #475569;
}
.msg-type-option:hover { background: #F8FAFC; border-color: #CBD5E1; }
.msg-type-option.selected {
    border-color: #4A76F9;
    background: #EEF3FE;
    color: #4A76F9;
}

.msg-source-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid #E8EDF5;
    border-radius: 8px;
    background: #FFFFFF;
    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: #F8FAFC; border-color: #CBD5E1; }
.msg-source-option.selected {
    border-color: #4A76F9;
    background: #EEF3FE;
    color: #4A76F9;
}

.msg-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E8EDF5;
    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: #1E293B;
    transition: background 0.12s;
}
.msg-search-option:hover { background: #F8FAFC; }

.msg-search-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #EEF3FE;
    color: #4A76F9;
    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: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #94A3B8;
    z-index: 100;
}
.msg-search-empty.msg-search-error {
    color: #EF4444;
}

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

.msg-member-chip {
    display: flex;
    align-items: center;
    background: #EEF3FE;
    color: #4A76F9;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
}

.msg-dialog-btn-primary {
    background: #4A76F9;
    color: #FFFFFF;
    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: #3561E0; }
.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: #F8FAFC; }

.msg-dialog-btn-danger {
    background: transparent;
    color: #EF4444;
    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: #64748B;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}
.st-icon-btn:hover { background: #F1F5F9; border-color: #CBD5E1; }

/* 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; }
.loc-nav-item:hover { background: #F1F5F9; }
.loc-row-hover:hover { background: #F8FAFC; }

/* ── 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: #FFFFFF; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); color: #1E293B;
}
.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: #FFFFFF;
    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: #DC2626;
    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 #E8EDF5;
    flex-shrink: 0;
}
.wdb-sb-header-icon {
    color: #4A76F9;
    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: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wdb-sb-subtitle {
    font-size: 11px;
    color: #64748B;
    margin-top: 1px;
}
.wdb-sb-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748B;
    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: #1E293B; }

/* Toolbar */
.wdb-sb-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #E8EDF5;
    flex-shrink: 0;
}
.wdb-save-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    color: #94A3B8;
    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: #4A76F9;
    animation: wdbPulse 1s ease-in-out infinite;
}
.wdb-save-dot.saved { background: #22C55E; }
.wdb-save-dot.error { background: #EF4444; }
@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: #F8FAFC; border-color: #CBD5E1; }
.wdb-btn-sm.primary {
    background: #4A76F9;
    border-color: #4A76F9;
    color: #FFFFFF;
}
.wdb-btn-sm.primary:hover { background: #3B68F7; }
.wdb-btn-sm.danger { color: #EF4444; 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: #CBD5E1 transparent;
}
.wdb-sb-body::-webkit-scrollbar { width: 5px; }
.wdb-sb-body::-webkit-scrollbar-track { background: transparent; }
.wdb-sb-body::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* Draft area row */
.wdb-new-area-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #EEF3FE;
    border: 1.5px dashed #4A76F9;
    border-radius: 10px;
    margin-bottom: 10px;
}
.wdb-new-area-row input {
    flex: 1;
    background: #FFFFFF;
    border: 1.5px solid #4A76F9;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 14px;
    color: #1E293B;
    outline: none;
}

/* Area card */
.wdb-area-card {
    background: #FFFFFF;
    border: 1px solid #E8EDF5;
    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: #F8FAFC;
    border-bottom: 1px solid #E8EDF5;
}
.wdb-reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}
.wdb-reorder-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94A3B8;
    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: #4A76F9; background: #EEF3FE; }
.wdb-reorder-btn:disabled { opacity: 0.25; cursor: default; }
.wdb-area-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #1E293B;
    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: #94A3B8;
    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: #EF4444; background: #FEF2F2; }

/* 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: #F8FAFC;
    border: 1.5px solid #E8EDF5;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 13px;
    color: #1E293B;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}
.wdb-field-input:focus { background: #FFFFFF; border-color: #4A76F9; box-shadow: 0 0 0 2px rgba(74,118,249,0.1); }
.wdb-field-input.wdb-field-error { border-color: #EF4444; background: #FEF2F2; }
.wdb-field-input.wdb-field-error:focus { border-color: #EF4444; 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: #64748B;
    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: #F8FAFC;
    border: 1px solid #E8EDF5;
    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: #EEF3FE;
    color: #4A76F9;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    white-space: nowrap;
}
.wdb-freq-meta {
    font-size: 11px;
    color: #64748B;
    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: #DC2626;
}

/* Frequency form */
.wdb-freq-form {
    padding: 10px 10px 8px;
    background: #FFFFFF;
    border-top: 1px solid #E8EDF5;
}
.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: #F8FAFC;
    border: 1.5px solid #E8EDF5;
    border-radius: 6px;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 12px;
    color: #1E293B;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.wdb-freq-select:focus { background: #FFFFFF; border-color: #4A76F9; }

/* Draft frequency row */
.wdb-draft-freq-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    background: #EEF3FE;
    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 #CBD5E1;
    border-radius: 8px;
    padding: 7px 10px;
    font-family: inherit;
    font-size: 12px;
    color: #94A3B8;
    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: #4A76F9; color: #4A76F9; background: #EEF3FE; }

/* 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: #F8FAFC; }
.wdb-checklist-text {
    flex: 1;
    font-size: 12px;
    color: #1E293B;
}
.wdb-checklist-dept {
    font-size: 10px;
    color: #94A3B8;
    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 #E8EDF5;
}
.wdb-pending-thumb {
    width: 48px;
    height: 48px;
    border: 2px dashed #F97316;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #F97316;
    position: relative;
    background: #FFF7ED;
}

/* Archived section */
.wdb-archived-section {
    margin-top: 16px;
    border-top: 1px solid #E8EDF5;
    padding-top: 12px;
}
.wdb-archived-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #94A3B8;
    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: #64748B; }
.wdb-archived-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #F8FAFC;
    border: 1px solid #E8EDF5;
    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: #DC2626;
}

/* Copy-to dropdown */
.wdb-copy-dropdown {
    position: relative;
    display: inline-flex;
}
.wdb-copy-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E8EDF5;
    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: #1E293B;
    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: #F8FAFC; }

.wdb-task-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E8EDF5;
    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: #1E293B;
    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: #1E293B;
}
.shift-card-checkbox {
    cursor: pointer;
    width: 14px;
    height: 14px;
}
.shift-card-type {
    font-size: 10px;
    color: #64748B;
}
.shift-card-actual {
    font-size: 10px;
    color: #64748B;
    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: #1E293B;
    border-top: 2px solid #4A76F9;
    padding: 12px 24px;
    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 #E8EDF5;
}

.period-nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #E8EDF5;
    background: #FFFFFF;
    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: #94A3B8;
    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: #F8FAFC;
    border: 1px solid #E8EDF5;
    border-radius: 10px;
    padding: 14px 16px;
}

.summary-card-total {
    border-color: #E8EDF5;
    border-left: 3px solid #4A76F9;
    background: #F5F8FF;
}

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

.overwork-week-tile {
    background: #FFFFFF;
    border: 1px solid #E8EDF5;
    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: #F97316;
}

.overwork-tile-zero div:nth-child(2) {
    color: #CBD5E1;
}

.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: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shift-filter-btn:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
    color: #1E293B;
}

.shift-filter-btn.active {
    background: #4A76F9;
    color: #FFFFFF;
    border-color: #4A76F9;
}

/* ── 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: #4A76F9;
}

.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: #FFFFFF;
    width: 100%;
    height: 100%;
}
.draw-modal-toolbar {
    height: 56px;
    background: #FFFFFF;
    border-bottom: 1px solid #E8EDF5;
    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: #1E293B; line-height: 1.2; }
.draw-modal-subtitle { font-size: 11px; color: #94A3B8; }
.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: #FFFFFF;
    border-left: 1px solid #E8EDF5;
    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: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.draw-map-sidebar-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.route-stat-card {
    background: #F8FAFC;
    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: #94A3B8; font-weight: 500; }
.stat-value { font-size: 13px; font-weight: 600; color: #1E293B; }
.stat-value.blue { color: #4A76F9; }
.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: #4A76F9; 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: #FFFFFF;
    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: #1E293B;
    color: #FFFFFF;
    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: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-btn {
    background: #F8FAFC;
    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: #4A76F9; }
.overlay-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #FFFFFF;
    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 #F8FAFC;
}
.overlay-item:hover { background: #F8FAFC; }
.overlay-item-checkbox {
    width: 15px; height: 15px;
    border: 1.5px solid #CBD5E1;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.15s; background: #FFFFFF;
}
.overlay-item.checked .overlay-item-checkbox { background: #4A76F9; border-color: #4A76F9; }
.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: #64748B;
    cursor: pointer; border-radius: 4px; font-family: inherit;
    display: flex; align-items: center; gap: 5px; transition: all 0.1s;
}
.mode-btn.active { background: #FFFFFF; color: #4A76F9; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.waypoint-list-title {
    font-size: 11px; font-weight: 600; color: #94A3B8;
    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: #EEF3FE; color: #4A76F9;
    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: #DC2626; }
.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: #fff;
    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: #1E293B;
}
.itl-popup-body {
    padding: 20px 24px 24px;
}
.itl-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94A3B8;
    padding: 4px;
    border-radius: 6px;
}
.itl-close-btn:hover {
    background: #F1F5F9;
    color: #64748B;
}
