:root {
    /* --- Backgrounds --- */
    --color-canvas:         #EDF0FB;  /* page / main background */
    --color-surface:        #FFFFFF;  /* cards, modals, panels */

    /* --- Primary Navy --- */
    --color-primary-dark:   #243280;  /* sidebar top, darkest elements */
    --color-primary:        #2B3674;  /* headings, icons, active text */

    /* --- Accent --- */
    --color-accent:         #4F7EF7;  /* buttons, links, highlight borders, badges */

    /* --- Borders --- */
    --color-border:         #D1D9F0;  /* card and panel borders */

    /* --- Text --- */
    --color-text-heading:   #2B3674;  /* page titles, card headings */
    --color-text-body:      #374151;  /* general body text */
    --color-text-muted:     #707EAE;  /* subtitles, timestamps, helper text */

    /* --- Sidebar nav --- */
    --color-nav-idle:       #C0D6FF;  /* inactive nav link text */
    --color-nav-active-bg:  rgba(255, 255, 255, 0.20); /* active/hover nav bg */

    /* --- Status --- */
    --color-success:        #22C55E;
    --color-warning:        #F59E0B;
    --color-error:          #EF4444;
}

/* Refined operational surfaces: Home, Scheduler and Settings. */
.refined-ui {
    --color-canvas: #f5f7fa;
    --color-border: #dfe5ed;
    --color-text-heading: #25324b;
    --color-text-muted: #65738a;
    background: var(--color-canvas);
    color: var(--color-text-heading);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    caret-color: #315fc3;
    scrollbar-color: #b8c3d1 transparent;
    scrollbar-width: thin;
}
.refined-ui ::selection { background: #dce7fb; color: #203d74; }
.refined-ui :is(button, a, input, select):focus-visible { outline: 2px solid #315fc3; outline-offset: 3px; }
.refined-ui button { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; }
.refined-ui button:disabled { cursor: not-allowed; opacity: .5; }
.refined-ui h1, .refined-ui h2 { text-wrap: balance; }
.refined-ui p { text-wrap: pretty; }
.refined-ui [class*='text-[#707EAE]'], .refined-ui .text-gray-400 { color: var(--color-text-muted); }
.refined-ui [class*='border-[#D1D9F0]'] { border-color: var(--color-border); }
.refined-ui [class*='text-[#2B3674]'] { color: var(--color-text-heading); }
.refined-ui [class*='bg-[#EDF0FB]'] { background-color: var(--color-canvas); }
.refined-ui .uppercase { text-transform: none; letter-spacing: .01em; }
.refined-ui :is(input:not([type=checkbox]):not([type=hidden]), select) {
    min-height: 40px;
    border-color: #ccd5e1;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    color: #25324b;
}
.refined-ui input::placeholder { color: #65738a; opacity: 1; }
.refined-ui input:disabled, .refined-ui select:disabled { background: #f0f3f7; }
.refined-ui #sidebar { background: #243280; }
.sidebar-brand { display: none; }
.refined-ui .sidebar-brand { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 24px; border-bottom: 1px solid #ffffff20; color: #c0d6ff; font-size: 12px; letter-spacing: .02em; }
.refined-ui .sidebar-brand img { width: 38px; height: 38px; object-fit: contain; background: white; padding: 4px; border-radius: 4px; }
.refined-ui #sidebar > div:nth-child(2) { padding: 20px 12px; gap: 6px; flex: 1; }
.refined-ui #sidebar a, .refined-ui #sidebar button { min-height: 44px; padding: 11px 14px; border-radius: 6px; font-size: 14px; }
.refined-ui #sidebar a[aria-current=page] { background: #ffffff; color: #243280; font-weight: 600; }
.refined-ui #sidebar a:not([aria-current]):hover { background: #ffffff14; color: white; }
.refined-ui #sidebar form { margin-top: auto; padding-top: 22px; }
.refined-ui #sidebar form button { color: #e2b6c3; }
.refined-ui header { padding: 18px 32px; border-color: #dfe5ed; }
.refined-ui header img { display: none; }
.refined-ui #system-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.refined-ui header > div:last-child { color: #65738a; }
.refined-ui header > div:last-child p { font-size: 13px; font-weight: 400; }
.refined-ui main { padding: 30px 36px 36px; }
.refined-ui .page-heading { margin-bottom: 26px; gap: 16px; }
.refined-ui h1 { font-size: 28px; line-height: 1.25; letter-spacing: -.025em; font-weight: 600; }
.refined-ui footer { background: #f5f7fa; border-top: 1px solid #e5e9ef; }
.refined-ui footer > div { padding: 9px 32px; }
.refined-ui footer p { font-size: 11px; color: #65738a; }
.fleet-summary { display: grid; grid-template-columns: repeat(3, 1fr); padding: 24px 0; margin-bottom: 28px; border-block: 1px solid #dfe5ed; }
.summary-item { padding: 0 28px; border-right: 1px solid #dfe5ed; }
.summary-item:first-child { padding-left: 0; }
.summary-item:last-child { border: 0; }
.summary-item > p:first-child { color: #65738a; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; margin-bottom: 7px; }
.summary-item > p:last-child { font-size: 34px; line-height: 1.1; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: #25324b; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; }
.chart-panel { min-width: 0; padding: 22px; border: 1px solid #dfe5ed; border-radius: 12px; background: white; }
.chart-panel > div:first-child { min-height: 66px; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.chart-panel h2 { font-size: 15px; font-weight: 600; line-height: 1.45; letter-spacing: -.01em; max-width: 34ch; margin: 0; }
.chart-panel select { max-width: 140px; min-width: 110px; }
.chart-plot { position: relative; height: 250px; }
.refined-ui .schedule-toolbar { flex-wrap: wrap; gap: 16px; }
.refined-ui .schedule-toolbar > div { flex-wrap: wrap; gap: 8px; }
.refined-ui #btn-create-schedule { background: #243280; padding: 10px 16px; border-radius: 6px; min-height: 40px; box-shadow: none; font-weight: 500; }
.refined-ui #btn-create-schedule:hover { background: #344895; }
.refined-ui #calendar-view { padding: 24px; border: 1px solid #dfe5ed; border-radius: 12px; }
.refined-ui #list-view > div { box-shadow: none; }
.refined-ui #btn-calendar-view, .refined-ui #btn-list-view { min-height: 40px; padding: 8px 13px; }
.refined-ui [id^=btn-][aria-pressed=true] { background: #eaf0fc; color: #243280; font-weight: 600; }
.refined-ui .fc { --fc-border-color: #e5e9ef; --fc-today-bg-color: #f0f5ff; --fc-button-bg-color: #fff; --fc-button-text-color: #3a4962; --fc-button-border-color: #ccd5e1; --fc-button-hover-bg-color: #f0f3f8; --fc-button-hover-border-color: #b6c2d3; --fc-button-active-bg-color: #eaf0fc; --fc-button-active-border-color: #b8c9ec; }
.refined-ui .fc .fc-toolbar-title { color: #25324b; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.refined-ui .fc .fc-button { font-size: 13px; padding: 7px 12px; box-shadow: none; }
.refined-ui .fc .fc-col-header-cell { background: #fafbfd; }
.refined-ui .fc .fc-col-header-cell-cushion { color: #65738a; font-size: 12px; padding: 12px 4px; font-weight: 500; }
.refined-ui .fc .fc-daygrid-day-number { padding: 9px 11px; font-size: 13px; color: #3a4962; font-variant-numeric: tabular-nums; }
.refined-ui .fc .fc-day-today .fc-daygrid-day-number { color: #254eaa; font-weight: 700; }
.refined-ui .fc .fc-day-other { background: #fafbfd; }
.refined-ui dialog { border-radius: 12px; max-height: calc(100dvh - 32px); width: calc(100% - 32px); }
.refined-ui dialog button:has(.fa-times) { width: 32px; height: 32px; }
.refined-ui dialog label { font-size: 13px; }
.settings-panel { border: 1px solid #dfe5ed; border-radius: 12px; background: #fff; overflow: hidden; }
.settings-tabs { display: flex; gap: 24px; padding: 0 28px; border-bottom: 1px solid #dfe5ed; overflow-x: auto; overflow-y: hidden; }
.settings-tabs button { padding: 18px 0; white-space: nowrap; font-size: 14px; }
.refined-ui .settings-tabs button[aria-selected=true] { color: #243280; border-color: #243280; }
.refined-ui .settings-section { padding: 30px; gap: 24px; }
.settings-intro { padding-bottom: 4px; }
.settings-intro h2 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.settings-intro p { color: #65738a; margin-top: 5px; max-width: 65ch; font-size: 14px; }
.refined-ui .settings-section > div:has(> input), .refined-ui .settings-section > div:has(> select) { display: grid; grid-template-columns: 180px minmax(0, 480px); align-items: center; gap: 24px; }
.refined-ui .settings-section label { color: #46546a; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.refined-ui .settings-section > div:has(> button[id^=save]) { border-top: 1px solid #e5e9ef; padding-top: 22px; margin-top: 6px; }
.refined-ui .settings-section button[id^=save] { padding: 10px 18px; border-radius: 6px; }
.settings-table-scroll { overflow-x: auto; }
.settings-table-scroll table { min-width: 650px; }
.refined-ui th { color: #65738a; font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: .01em; }
.refined-ui td { font-variant-numeric: tabular-nums; }
.refined-ui tbody tr:hover { background-color: #f8fafc; }
@media (max-width: 1100px) {
    .refined-ui main { padding: 26px; }
    .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-panel > div:first-child { flex-wrap: wrap; }
}
@media (max-width: 900px) {
    .refined-ui #sidebar { position: absolute; z-index: 30; top: 68px; bottom: 0; height: auto; box-shadow: 12px 0 30px -20px #17233880; }
    .refined-ui header { padding: 16px 20px; min-height: 68px; }
    .refined-ui .sidebar-brand { display: none; }
    .refined-ui h1 { font-size: 25px; }
    .refined-ui #calendar-view { padding: 16px; }
}
@media (max-width: 640px) {
    .refined-ui main { padding: 22px 16px; }
    .refined-ui #system-name { font-size: 13px; max-width: 30ch; }
    .refined-ui header > div:last-child { display: none; }
    .refined-ui header > div:first-child { gap: 10px; }
    .refined-ui footer > div { padding: 8px 12px; flex-wrap: wrap; gap: 3px; }
    .refined-ui footer p { font-size: 10px; }
    .fleet-summary { padding: 20px 0; }
    .summary-item { padding: 0 14px; }
    .summary-item > p:first-child { font-size: 12px; }
    .summary-item > p:last-child { font-size: 28px; }
    .chart-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .chart-panel { padding: 18px; }
    .chart-panel > div:first-child { align-items: center; }
    .refined-ui .schedule-toolbar { align-items: flex-start; }
    .refined-ui .fc .fc-toolbar { flex-wrap: wrap; gap: 12px; }
    .refined-ui .fc .fc-toolbar-title { font-size: 18px; }
    .refined-ui .fc .fc-button { padding: 6px 8px; font-size: 12px; }
    .refined-ui .fc .fc-daygrid-day-number { padding: 6px; }
    .settings-tabs { gap: 20px; padding: 0 20px; }
    .refined-ui .settings-section { padding: 22px 20px; }
    .refined-ui .settings-section > div:has(> input), .refined-ui .settings-section > div:has(> select) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .refined-ui dialog .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .refined-ui *, .refined-ui *::before, .refined-ui *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

.chart-period { display: block; margin-top: 4px; font-size: 12px; color: #65738a; font-weight: 400; letter-spacing: 0; }
.chart-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 5px; color: #65738a; font-size: 13px; }
.refined-ui .settings-tabs button { margin-bottom: 0; }

@media (max-width: 640px) {
    .refined-ui #user-settings > div:first-child { flex-wrap: wrap; gap: 16px; align-items: flex-start; }
}

/* Remaining operational pages share the same surfaces and type roles. */
.filter-toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 24px; }
.filter-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.filter-field > label { font-size: 12px; font-weight: 500; color: #65738a; }
.refined-ui .filter-field :is(input, select) { width: 100%; padding: 8px 12px; border: 1px solid #ccd5e1; }
.alert-filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.alert-filters .filter-field { grid-column: span 2; }
.alert-filters .filter-field:nth-last-child(-n+2) { grid-column: span 3; }
.data-table-scroll, .history-calendar, .detail-panel { border: 1px solid #dfe5ed; border-radius: 12px; background: #fff; overflow: hidden; }
.data-table-scroll { overflow-x: auto; }
.data-table-scroll > table { width: 100%; min-width: 1060px; }
.refined-ui .data-table-scroll thead { background: #fafbfd; border-color: #e5e9ef; }
.refined-ui .data-table-scroll th { padding: 15px 18px; white-space: nowrap; }
.refined-ui .data-table-scroll td { padding: 18px; font-size: 13px; vertical-align: top; }
.refined-ui td.table-empty { padding: 68px 24px; text-align: left; }
.table-empty strong { display: block; font-size: 15px; font-weight: 500; color: #3a4962; }
.table-empty span { display: block; margin-top: 6px; font-size: 13px; color: #65738a; }
.refined-ui #pagination-controls > div { flex-wrap: wrap; gap: 12px; }
.refined-ui #pagination-controls button { background: white; color: #3a4962; border: 1px solid #ccd5e1; border-radius: 6px; min-height: 40px; }
.refined-ui #pagination-controls button:hover:not(:disabled) { background: #eaf0fc; }
.refined-ui #pagination-controls button:disabled { opacity: .65; background: #f0f3f7; color: #65738a; }
.refined-ui #pagination-controls input { border: 1px solid #ccd5e1; }
.threshold-table-scroll { overflow-x: auto; }
.threshold-table-scroll table { min-width: 660px; }
.refined-ui #alert-types-modal { max-width: 960px; }
.refined-ui #alert-types-modal td { line-height: 1.6; vertical-align: top; }
.refined-ui #alert-types-modal input { min-width: 76px; }
.analytics-overview { display: grid; grid-template-columns: minmax(280px, 1.4fr) repeat(2, minmax(0, 1fr)); align-items: center; border-block: 1px solid #dfe5ed; padding: 24px 0; margin-bottom: 28px; }
.analytics-range { margin: 0; gap: 12px; }
.analytics-range .filter-field { flex: 1 1 125px; max-width: 170px; }
.analytics-overview .summary-item { border: 0; border-left: 1px solid #dfe5ed; padding: 0 24px; }
.range-feedback:empty { display: none; }
.range-feedback { color: #b42332; font-size: 12px; flex-basis: 100%; }
.robot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.robot-card { min-width: 0; background: #fff; padding: 24px; border: 1px solid #dfe5ed; border-radius: 12px; }
.robot-card > div:first-child { gap: 16px; align-items: flex-start; }
.robot-card .robot-name { font-size: 17px; font-weight: 600; letter-spacing: -.015em; overflow-wrap: anywhere; }
.robot-card .robot-ip { display: inline-flex; margin-top: 6px; }
.robot-card .robot-battery { font-variant-numeric: tabular-nums; }
.robot-card .robot-mission { white-space: normal; overflow-wrap: anywhere; }
.robot-card .robot-mission-text { max-width: 65%; text-align: right; overflow-wrap: anywhere; font-weight: 500; }
.stream-status { display: flex; gap: 9px; align-items: center; padding: 14px 0; margin-bottom: 24px; border-block: 1px solid #dfe5ed; color: #65738a; font-size: 13px; }
.stream-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #8b98aa; }
.stream-status[data-connected=true] .stream-dot { background: #19815b; }
.stream-status[data-connected=false] .stream-dot { background: #ae6c21; }
.monitoring-empty { padding: 64px 28px; border: 1px dashed #ccd5e1; border-radius: 12px; }
.monitoring-empty[hidden] { display: none; }
.monitoring-empty h2 { font-size: 18px; font-weight: 500; letter-spacing: -.015em; }
.monitoring-empty p { margin-top: 8px; color: #65738a; font-size: 14px; max-width: 60ch; }
.history-calendar { padding: 24px; }
.detail-back { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #315fc3; margin-bottom: 22px; text-underline-offset: 3px; }
.detail-back:hover { text-decoration: underline; }
.detail-panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 24px; border-bottom: 1px solid #e5e9ef; }
.detail-panel-heading h2 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.detail-panel-heading > div { flex-wrap: wrap; }
.snapshot-tabs { display: flex; gap: 22px; padding: 0 24px; border-bottom: 1px solid #dfe5ed; }
.refined-ui .snapshot-tabs button { border-radius: 0; padding: 14px 0; }
.refined-ui .snapshot-tabs button[aria-pressed=true] { color: #243280; border-color: #243280; }
.refined-ui #context-snapshot { overflow-x: auto; }
.refined-ui #context-snapshot td { overflow-wrap: anywhere; }
.refined-ui[data-page=alert-context] h1 { overflow-wrap: anywhere; }
.refined-ui #btn-prev, .refined-ui #btn-next { width: 34px; height: 34px; }
/* Authentication pages share one centered brand and card composition. */
.refined-ui.auth-page { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: #f5f7fa; font: 16px/1.5 "DM Sans", "Segoe UI", "Microsoft YaHei", sans-serif; }
.refined-ui.auth-page * { box-sizing: border-box; }
.refined-ui.auth-page [hidden] { display: none !important; }
.refined-ui.auth-page .auth-main { display: flex; align-items: center; justify-content: center; flex: 1; padding: 40px 24px; }
.refined-ui.auth-page .auth-shell { width: 100%; max-width: 440px; }
.refined-ui.auth-page .auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0; margin: 0 0 24px; }
.refined-ui.auth-page .auth-brand img { display: block; width: 36px; height: 36px; object-fit: contain; }
.refined-ui.auth-page .auth-brand span { font-size: 24px; line-height: 1.3; font-weight: 700; color: #243280; letter-spacing: -.02em; }
.refined-ui.auth-page .auth-content { width: 100%; padding: 0; }
.refined-ui.auth-page .auth-panel { width: 100%; margin: 0; padding: 32px; background: #fff; border: 1px solid #dfe5ed; border-radius: 16px; }
.refined-ui.auth-page .auth-panel h1 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; color: #25324b; }
.refined-ui.auth-page .auth-intro { margin: 10px 0 28px; color: #5e6d84; font-size: 16px; line-height: 1.5; }
.refined-ui.auth-page #login-form { display: flex; flex-direction: column; gap: 20px; }
.refined-ui.auth-page .auth-field label { display: block; margin: 0 0 8px; font-size: 15px; font-weight: 600; line-height: 1.4; }
.refined-ui.auth-page .auth-panel .auth-input { display: block; width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid #c7d1e0; border-radius: 8px; background: #f9fbfe; font: inherit; font-size: 16px; color: #25324b; transition: border-color 140ms ease, background-color 140ms ease; }
.refined-ui.auth-page .auth-panel .auth-input:hover { border-color: #9daec5; }
.refined-ui.auth-page .auth-panel .auth-input:focus { border-color: #315fc3; background: #fff; }
.refined-ui.auth-page .auth-password { position: relative; }
.refined-ui.auth-page .auth-password .auth-input { padding-right: 60px; }
.refined-ui.auth-page .auth-password-toggle { display: flex; align-items: center; justify-content: center; position: absolute; right: 4px; top: 4px; width: 44px; min-height: 44px; padding: 10px; border: 0; border-radius: 6px; background: transparent; color: #5e6d84; cursor: pointer; }
.refined-ui.auth-page .auth-password-toggle:hover { background: #eaf0f9; color: #243280; }
.refined-ui.auth-page .auth-password-toggle svg { width: 22px; height: 22px; }
.refined-ui.auth-page .auth-primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 12px 18px; border: 1px solid #243280; border-radius: 8px; background: #243280; color: #fff; font: inherit; font-size: 16px; font-weight: 600; line-height: 1.4; text-decoration: none; cursor: pointer; }
.refined-ui.auth-page .auth-primary:hover:not(:disabled) { background: #344895; border-color: #344895; }
.refined-ui.auth-page #login-btn { margin-top: 4px; }
.refined-ui.auth-page .auth-primary:disabled { opacity: 1; background: #65729e; border-color: #65729e; color: #fff; cursor: wait; }
.refined-ui.auth-page .auth-error { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 24px; padding: 12px; border: 1px solid #edccd0; border-radius: 8px; background: #fff4f5; color: #a52f3e; font-size: 14px; line-height: 1.5; }
.refined-ui.auth-page .auth-error svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.refined-ui.auth-page .auth-error p { margin: 0; }
.refined-ui.auth-page .auth-signed-out { text-align: center; }
.refined-ui.auth-page .auth-complete { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 50%; background: #edf7f1; color: #23664d; }
.refined-ui.auth-page .auth-complete svg { width: 28px; height: 28px; }
.refined-ui.auth-page .auth-footer { flex: none; padding: 12px 20px; }
.refined-ui.auth-page .auth-footer p { margin: 0; color: #65738a; font-size: 12px; line-height: 1.5; text-align: center; }
.refined-ui.auth-page .auth-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #bfc8e9; border-top-color: #fff; border-radius: 50%; animation: auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refined-ui.auth-page .auth-spinner { animation: none; } }
@media (max-width: 480px) {
    .refined-ui.auth-page .auth-main { padding: 24px 16px; }
    .refined-ui.auth-page .auth-panel { padding: 28px 24px; }
    .refined-ui.auth-page .auth-panel h1 { font-size: 28px; }
}
@media (max-height: 700px) and (min-width: 600px) {
    .refined-ui.auth-page .auth-main { padding: 24px; }
    .refined-ui.auth-page .auth-brand { margin-bottom: 20px; }
    .refined-ui.auth-page .auth-panel { padding: 28px; }
    .refined-ui.auth-page .auth-intro { margin-bottom: 24px; }
}
@media (min-width: 1500px) {
    .alert-filters { grid-template-columns: repeat(3, minmax(120px, 1fr)) repeat(2, minmax(210px, 1.3fr)); }
    .alert-filters .filter-field, .alert-filters .filter-field:nth-last-child(-n+2) { grid-column: auto; }
}
@media (max-width: 1100px) {
    .analytics-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 0; }
    .analytics-range { grid-column: 1 / -1; }
    .analytics-range .filter-field { max-width: 200px; }
    .analytics-overview .summary-item:nth-child(2) { border-left: 0; padding-left: 0; }
}
@media (max-width: 640px) {
    .robot-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .robot-card { padding: 20px; }
    .robot-card > div:first-child { flex-wrap: wrap; gap: 10px; }
    .alert-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
    .alert-filters .filter-field { grid-column: auto; }
    .alert-filters .filter-field:nth-child(3), .alert-filters .filter-field:nth-last-child(-n+2) { grid-column: 1 / -1; }
    .refined-ui #pagination-controls { justify-content: flex-start; }
    .refined-ui #pagination-controls > div { gap: 8px; }
    .refined-ui #pagination-controls > div > span { flex-basis: 100%; }
    .analytics-overview .summary-item { padding-inline: 16px; }
    .analytics-overview .summary-item > p:first-child { min-height: 36px; }
    .detail-panel-heading { padding: 16px 20px; }
    .detail-panel > .p-6, .refined-ui #context-snapshot { padding: 20px; }
    .history-calendar { padding: 16px; }
    .auth-panel { padding: 28px 24px; }
    .refined-ui h1 { overflow-wrap: anywhere; }
}

.refined-ui #save-thresholds-btn { min-height: 40px; padding: 9px 16px; font-size: 14px; background: #243280; border-radius: 6px; }
.refined-ui #save-thresholds-btn:hover { background: #344895; }
@media (min-width: 900px) {
    .data-table-scroll:has([data-empty-state]) > table { min-width: 0; table-layout: fixed; }
    .data-table-scroll:has([data-empty-state]) th { white-space: normal; padding-inline: 12px; overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
    .data-table-scroll:has([data-empty-state]) > table { min-width: 0; table-layout: fixed; }
    .data-table-scroll:has([data-empty-state]) thead { display: none; }
    .refined-ui td.table-empty { padding: 40px 20px; }
}

.refined-ui #context-snapshot button { min-width: 28px; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 640px) {
    .detail-panel-heading > div { width: 100%; gap: 8px; }
    #snapshot-time { flex-basis: 100%; }
}

/* Dense alert records: predictable widths, bounded summaries, persistent actions. */
.refined-ui .alert-data-scroll { max-height: clamp(340px, 56vh, 760px); overflow: auto; scroll-padding-top: 60px; }
.refined-ui .alert-table { table-layout: fixed; width: 100%; min-width: 1320px; }
.alert-table col:nth-child(1) { width: 72px; }
.alert-table col:nth-child(2) { width: 142px; }
.alert-table col:nth-child(3) { width: 124px; }
.alert-table col:nth-child(4) { width: 284px; }
.alert-table col:nth-child(5) { width: 170px; }
.alert-table col:nth-child(6) { width: 204px; }
.alert-table col:nth-child(7) { width: 84px; }
.alert-table col:nth-child(8) { width: 126px; }
.alert-table col:nth-child(9) { width: 114px; }
.refined-ui .alert-table th { position: sticky; top: 0; z-index: 4; background: #fafbfd; padding: 12px; white-space: normal; }
.refined-ui .alert-table td { padding: 14px 12px; line-height: 1.45; vertical-align: top; overflow-wrap: anywhere; }
.refined-ui .alert-table :is(th, td):first-child:not([colspan]) { position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid #e5e9ef; }
.refined-ui .alert-table :is(th, td):nth-child(8) { position: sticky; right: 114px; z-index: 2; background: #fff; border-left: 1px solid #e5e9ef; }
.refined-ui .alert-table :is(th, td):nth-child(9) { position: sticky; right: 0; z-index: 2; background: #fff; }
.refined-ui .alert-table thead th:is(:first-child, :nth-child(8), :nth-child(9)) { top: 0; z-index: 5; background: #fafbfd; }
.refined-ui .alert-table tbody tr:hover > td { background-color: #f8fafc; }
.case-number { font-weight: 600; color: #3a4962; }
.cell-date, .cell-secondary { display: block; }
.cell-secondary { margin-top: 4px; font-size: 12px; color: #65738a; font-weight: 400; }
.refined-ui .cell-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; white-space: normal; text-wrap: wrap; overflow-wrap: anywhere; }
.alert-message summary { list-style: none; cursor: pointer; }
.alert-message summary::-webkit-details-marker { display: none; }
.message-toggle { display: inline-block; color: #315fc3; margin-top: 5px; font-size: 12px; font-weight: 500; }
.message-toggle::after { content: 'Show more'; }
.alert-message[open] .message-toggle::after { content: 'Show less'; }
.alert-message[open] summary > .cell-clamp { display: none; }
.message-full { padding-top: 8px; }
.message-full p + p { margin-top: 8px; }
.refined-ui .row-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.row-actions a { color: #315fc3; font-size: 12px; font-weight: 500; padding-block: 2px; }
.row-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.row-actions button { color: #b42332; font-size: 12px; padding: 2px 0; }
.alert-message summary:focus-visible { outline: 2px solid #315fc3; outline-offset: 4px; border-radius: 3px; }
.data-table-scroll:has([data-empty-state]) .alert-table col { width: auto; }
.detail-messages p { line-height: 1.65; color: #3a4962; overflow-wrap: anywhere; max-width: 75ch; }
.detail-messages p + p { margin-top: 10px; }

/* Month overview and a fully readable agenda for the selected day. */
.refined-ui #calendar-view.scheduler-workspace { display: grid; gap: 22px; padding: 0; border: 0; background: none; border-radius: 0; overflow: visible; }
.calendar-panel, .day-agenda { min-width: 0; background: white; border: 1px solid #dfe5ed; border-radius: 12px; padding: 24px; }
.refined-ui .calendar-panel .fc-daygrid-day-frame { min-height: 112px; }
.refined-ui .fc .fc-daygrid-more-link { color: #315fc3; font-size: 12px; font-weight: 500; padding: 4px 6px; }
.refined-ui .fc .selected-calendar-day { background: #eaf0fc; }
.refined-ui .fc .selected-calendar-day .fc-daygrid-day-number { color: #243280; font-weight: 700; }
.refined-ui .fc .fc-daygrid-day-number[role=button] { cursor: pointer; }
.refined-ui .fc .fc-popover { border: 1px solid #dfe5ed; border-radius: 8px; box-shadow: 0 10px 28px -12px #25324b40; max-width: min(340px, calc(100vw - 32px)); z-index: 8; }
.refined-ui .fc .fc-popover-body { max-height: 320px; overflow-y: auto; }
.agenda-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #e5e9ef; }
.agenda-heading h2 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.agenda-heading p { margin-top: 5px; color: #65738a; font-size: 13px; }
.agenda-date-controls { display: flex; align-items: center; gap: 6px; }
.agenda-date-controls button { width: 34px; min-height: 40px; border: 1px solid #ccd5e1; border-radius: 6px; color: #46546a; }
.agenda-date-controls button:hover { background: #f0f3f7; }
.refined-ui #agenda-date { padding: 6px 10px; max-width: 160px; }
#agenda-runs { max-height: 420px; overflow-y: auto; }
.agenda-run { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto 12px; width: 100%; align-items: start; gap: 16px; text-align: left; padding: 17px 4px; border-bottom: 1px solid #edf0f4; }
.agenda-run:last-child { border-bottom: 0; }
.agenda-run:hover { background: #f8fafc; }
.agenda-run time { font-size: 13px; font-variant-numeric: tabular-nums; color: #46546a; }
.agenda-run-info { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.agenda-run-info strong { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.agenda-run-info > span { font-size: 12px; color: #65738a; overflow-wrap: anywhere; }
.agenda-status { border-radius: 4px; padding: 3px 7px; font-size: 11px; white-space: nowrap; }
.agenda-run > i { align-self: center; font-size: 10px; color: #65738a; }
.agenda-empty { padding: 30px 0 10px; color: #65738a; font-size: 14px; }
@media (min-width: 1600px) {
    .refined-ui #calendar-view.scheduler-workspace { grid-template-columns: minmax(0, 1fr) 350px; align-items: start; }
    .agenda-run { grid-template-columns: 45px minmax(0, 1fr); gap: 8px 12px; }
    .agenda-run .agenda-status { grid-column: 2; justify-self: start; }
    .agenda-run > i { display: none; }
}
@media (max-width: 640px) {
    .refined-ui .alert-table :is(th, td):nth-child(8) { position: static; border-left: 0; }
    .refined-ui .alert-table :is(th, td):nth-child(9) { border-left: 1px solid #e5e9ef; }
    .refined-ui .alert-table thead th:nth-child(8) { position: sticky; top: 0; z-index: 4; }
    .refined-ui .alert-table .row-actions :is(a, button) { min-height: 30px; }
    .calendar-panel, .day-agenda { padding: 16px; }
    .refined-ui .calendar-panel .fc-daygrid-day-frame { min-height: 104px; }
    .agenda-run { grid-template-columns: 45px minmax(0, 1fr); gap: 8px 12px; }
    .agenda-run .agenda-status { grid-column: 2; justify-self: start; }
    .agenda-run > i { display: none; }
    .refined-ui .alert-data-scroll { max-height: 60vh; }
}

.refined-ui #calendar-view.scheduler-workspace.hidden { display: none; }

.refined-ui .calendar-panel .fc-daygrid-day-number { padding: 6px 8px; }
.refined-ui .calendar-panel .fc-daygrid-event { margin: 1px 2px; }
.refined-ui .calendar-panel .fc-daygrid-more-link { padding: 2px 5px; font-size: 11px; }

@media (max-width: 640px) {
    .refined-ui .alert-table tbody td:first-child:not([colspan]) { position: static; border-right: 0; }
    .refined-ui .alert-table thead th:first-child { left: auto; z-index: 4; }
}

.calendar-event-summary { display: flex; align-items: center; gap: 3px; padding: 0 5px; width: 100%; overflow: hidden; font-size: 11px; line-height: 1.35; cursor: pointer; box-sizing: border-box; }
@media (max-width: 640px) {
    .refined-ui .alert-table thead th:nth-child(8) { right: auto; left: auto; }
    .calendar-event-summary { padding-inline: 1px; gap: 1px; }
    .calendar-event-summary > span:not(:first-child) { display: none; }
}

.alert-data-scroll:has([data-empty-state]) .alert-table th:nth-child(8) { right: auto; }

/* Operations overview: actionable lists, separate from historical analytics. */
.refined-ui .operations-heading,.refined-ui .operations-panel-heading{display:flex;align-items:baseline;justify-content:space-between;gap:16px}
.refined-ui .operations-heading{margin-bottom:24px;flex-wrap:wrap;color:#566780;font-size:14px}
.refined-ui .operations-heading a,.refined-ui .operations-panel-heading a,.refined-ui .operations-updated button{color:#24479b;text-decoration:underline;text-underline-offset:3px;font-size:13px}
.refined-ui .operations-summary{margin-bottom:28px}
.refined-ui .operations-summary .summary-item p{font-size:12px;color:#566780;margin-bottom:6px}
.refined-ui .operations-summary strong{font-size:28px;color:#203256;font-variant-numeric:tabular-nums}
.refined-ui .operations-summary small{font-size:12px;font-weight:400;color:#566780}
.refined-ui .operations-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px}
.refined-ui .operations-panel{min-width:0;background:#fff;border:1px solid #dce3ed;border-radius:12px;padding:22px}
.refined-ui .operations-panel h2{font-size:17px;font-weight:600;color:#203256}
.refined-ui .operations-note,.refined-ui .analytics-definition{font-size:12px;line-height:1.7;color:#566780;margin:10px 0 18px}
.refined-ui .analytics-definition{max-width:100ch;margin-bottom:24px}
.refined-ui .operations-row{display:flex;align-items:center;gap:14px;padding:15px 0;border-top:1px solid #e3e8ef;color:#203256}
.refined-ui .operations-row:hover{background:#f5f7fa}
.refined-ui .operations-row:focus-visible{outline:2px solid #24479b;outline-offset:3px}
.refined-ui .operations-row>div{flex:1;min-width:0}
.refined-ui .operations-row strong{display:block;font-size:14px;font-weight:500;overflow-wrap:anywhere}
.refined-ui .operations-row span{display:block;font-size:12px;color:#566780;margin-top:5px;overflow-wrap:anywhere}
.refined-ui .operations-row time{font-size:12px;color:#566780;font-variant-numeric:tabular-nums;flex-shrink:0}
.refined-ui .operations-row i{font-size:10px;color:#566780}
.refined-ui .operations-empty{font-size:14px;color:#566780;padding:24px 0;line-height:1.7}
.refined-ui .operations-fleet{grid-column:1/-1}
.refined-ui .operations-updated{margin-top:22px}
@media(max-width:1000px){.refined-ui .operations-grid{grid-template-columns:1fr}.refined-ui .operations-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.refined-ui .operations-summary .summary-item{min-width:0}}
@media(max-width:540px){.refined-ui .operations-panel{padding:16px}.refined-ui .operations-panel-heading{align-items:flex-start;flex-wrap:wrap;gap:8px}.refined-ui .operations-row{flex-wrap:wrap}.refined-ui .operations-row>div{flex-basis:100%}.refined-ui .operations-summary strong{font-size:24px}}

.refined-ui .operations-summary{grid-template-columns:repeat(4,minmax(0,1fr))}
.refined-ui .operations-summary .summary-item{padding-inline:20px}
.refined-ui .operations-summary .summary-item:first-child{padding-left:0}
.refined-ui .analytics-range .filter-field:last-of-type{flex-basis:100%;max-width:100%}
.refined-ui .analytics-range select{width:100%;max-width:100%;min-width:0}
@media(max-width:1000px){.refined-ui .operations-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 0}.refined-ui .operations-summary .summary-item:nth-child(3){padding-left:0}.refined-ui .operations-summary .summary-item:nth-child(2){border-right:0}}

.refined-ui[data-page="analytics"] #main-content>div:not(.page-heading){min-width:0;max-width:100%}
.refined-ui .analytics-overview,.refined-ui .analytics-range{min-width:0;max-width:100%}
.refined-ui #mission-rate{font-size:26px;overflow-wrap:anywhere}
@media(max-width:540px){.refined-ui .analytics-range{display:grid;grid-template-columns:minmax(0,1fr);gap:14px}.refined-ui .analytics-range .filter-field{max-width:100%}.refined-ui .analytics-range input{width:100%;min-width:0;max-width:100%}.refined-ui .analytics-overview .summary-item{min-width:0}.refined-ui #mission-rate{font-size:22px;line-height:1.4}}

/* Home charts use the same current-state data as the operations overview. */
.refined-ui .home-chart-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin-bottom:24px}
.refined-ui .operations-summary .summary-item p i{font-size:13px;margin-right:5px;color:#526b9a}
.refined-ui .operations-panel-heading h2 i{font-size:14px;color:#526b9a;margin-right:7px}
.refined-ui .home-live-label{font-size:12px;color:#15734d;display:inline-flex;align-items:center;gap:6px}
.refined-ui .home-live-label:before{content:"";height:6px;width:6px;border-radius:50%;background:#228463}
.refined-ui .home-status-chart{padding-bottom:20px}
.refined-ui .home-fleet-ratio{display:flex;align-items:baseline;gap:12px;margin:22px 0 18px;flex-wrap:wrap}
.refined-ui .home-fleet-ratio strong{font-size:36px;line-height:1.2;font-weight:600;letter-spacing:-.02em;color:#203256;font-variant-numeric:tabular-nums}
.refined-ui .home-fleet-ratio strong span{color:#65738a;font-size:24px;font-weight:400}
.refined-ui .home-fleet-ratio>span{color:#566780;font-size:12px}
.refined-ui .home-fleet-stack{display:flex;overflow:hidden;width:100%;height:22px;border-radius:4px;background:#eef1f5;margin-bottom:24px}
.refined-ui .home-fleet-stack>span{height:100%;border-right:2px solid white}
.refined-ui .home-fleet-stack>span:last-child{border-right:0}
.refined-ui .home-chart-completed{background:#238365}
.refined-ui .home-chart-progress{background:#4c6fc4}
.refined-ui .home-chart-pending{background:#95a1b3}
.refined-ui .home-chart-failed{background:#c95555}
.refined-ui .home-chart-legend{display:flex;gap:24px;flex-wrap:wrap}
.refined-ui .home-chart-legend>div{flex:1;min-width:76px}
.refined-ui .home-chart-legend dt{display:flex;align-items:center;gap:7px;font-size:12px;color:#566780}
.refined-ui .home-chart-legend dd{font-size:20px;color:#203256;font-variant-numeric:tabular-nums;margin:6px 0 0 15px}
.refined-ui .home-chart-dot{display:inline-block;width:8px;height:8px;border-radius:2px;flex-shrink:0}
.refined-ui .home-outcome-bars{display:grid;gap:18px;margin-top:24px}
.refined-ui .home-outcome-row{display:grid;grid-template-columns:104px minmax(0,1fr) 28px;align-items:center;gap:12px;font-size:12px;color:#566780}
.refined-ui .home-outcome-row strong{text-align:right;font-weight:500;font-size:14px;color:#203256;font-variant-numeric:tabular-nums}
.refined-ui .home-bar-track{height:12px;background:#eef1f5;border-radius:3px;overflow:hidden}
.refined-ui .home-bar-fill{display:block;height:100%;border-radius:3px}
.refined-ui .home-chart-caption{margin-top:16px;color:#566780;font-size:11px;line-height:1.6}
@media(max-width:1000px){.refined-ui .home-chart-grid{grid-template-columns:1fr}}
@media(max-width:540px){.refined-ui .home-outcome-row{grid-template-columns:90px minmax(0,1fr) 24px;gap:8px}.refined-ui .home-chart-legend{gap:12px}.refined-ui .home-fleet-ratio strong{font-size:32px}}
.refined-ui .home-live-label[data-live="false"]{color:#566780}.refined-ui .home-live-label[data-live="false"]:before{background:#95a1b3}
/* Center the Home summary metrics within their four columns. */
.refined-ui .operations-summary .summary-item{display:flex;flex-direction:column;align-items:center;text-align:center;padding-inline:16px}
.refined-ui .operations-summary .summary-item:first-child{padding-left:16px}
@media(max-width:1000px){.refined-ui .operations-summary .summary-item:nth-child(3){padding-left:16px}}
