/* Workspace shell: grouped navigation, location header, status labels and route notices. */
:root{--sw-red:#df211c;--sw-navy:#111e29;--sw-surface:#fff;--sw-soft:#f3f6f9;--sw-ink:#1d2733;--sw-muted:#5d6b7a;--sw-line:#dce3ec;--sw-focus:#1769d1}
[data-theme=dark]{--sw-surface:#1c2c39;--sw-soft:#223442;--sw-ink:#edf2f7;--sw-muted:#b3c0ce;--sw-line:#405365;--sw-focus:#7db4ff}

/* "Where am I": organisation, then the page you are on. */
#topbar .top-title{display:flex;align-items:baseline;gap:8px;min-width:0}
#org-name{color:#b3c0ce;font-weight:600;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:32vw}
#org-name::after{content:'/';margin-left:8px;color:var(--sw-line)}
#page-heading{font-size:15px;font-weight:700;color:#fff;white-space:nowrap}
@media(max-width:600px){#org-name{display:none}#page-heading{font-size:13px}}

/* Grouped navigation */
.nav-group{display:flex;flex-direction:column;gap:2px;padding:6px 0 8px}
.nav-group+.nav-group{border-top:1px solid var(--sw-line)}
.nav-group-label{font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--sw-muted);padding:4px 10px 4px}
a.nav-item{text-decoration:none}
.nav-item.active{box-shadow:inset 3px 0 0 var(--sw-red)}
@media(max-width:900px){.nav-group-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.nav-group{padding:4px 0}}
.sidebar-collapsed .nav-group-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* Account, theme and sign-out stay reachable at every width (icons only on phones). */
.footer-row.footer-signout{color:#b91b17}
[data-theme=dark] .footer-row.footer-signout{color:#ff8a86}
@media(max-width:600px){.sidebar-footer{display:flex!important;flex-direction:column;gap:2px;padding:4px 2px}.sidebar-footer .footer-row{justify-content:center;padding:0;min-height:40px}.sidebar-footer .footer-row>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}}

/* Status: colour is always paired with a word and the last report time. */
.status-pill{display:inline-flex;align-items:center;gap:6px;padding:2px 9px 2px 7px;border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap;color:var(--sw-ink);background:color-mix(in srgb,var(--status) 14%,transparent);border:1px solid color-mix(in srgb,var(--status) 45%,transparent)}
.status-pill i{width:8px;height:8px;border-radius:50%;background:var(--status);flex:none}
.list-row .row-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.list-row .row-meta{color:var(--sw-muted)}

/* Route notices and full-panel states */
.route-notice{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:0 0 12px;padding:10px 12px;border-radius:10px;border:1px solid var(--sw-line);background:var(--sw-surface);color:var(--sw-ink);font-size:13px;line-height:1.4;box-shadow:0 6px 20px #0b1b2a1f}
.route-notice>div{display:flex;flex-direction:column;gap:2px}
.route-notice-warn{border-left:4px solid #e88425}
.route-notice-info{border-left:4px solid #2c8cda}
.route-notice-close{border:0;background:transparent;font-size:18px;line-height:1;color:var(--sw-muted);min-width:32px;min-height:32px;border-radius:8px;cursor:pointer}
#workspace>.route-notice{position:absolute;z-index:30;top:12px;left:50%;transform:translateX(-50%);width:min(520px,calc(100% - 24px))}
.auth-card #auth-notice:empty{display:none}
.auth-card .route-notice{margin:12px 0;text-align:left}
.state-card{margin:16px;padding:18px;border-radius:12px;background:var(--sw-surface);border:1px solid var(--sw-line);color:var(--sw-ink);display:flex;flex-direction:column;gap:8px}

/* Visible keyboard focus everywhere in the shell. */
:is(.nav-item,.footer-row,.btn,button,a,input,select,textarea):focus-visible{outline:3px solid var(--sw-focus);outline-offset:2px}
@media(pointer:coarse){.nav-item,.footer-row{min-height:44px}}

/* Hide controls the server would refuse. Vehicles are registered in the owner console;
   tracking viewers and operators have read-only workspaces. The API still enforces both. */
[data-entity=vehicles]:is([data-action=edit],[data-action=remove],[data-action=add],[data-action=restore]){display:none!important}
body:is([data-role=viewer],[data-role=operator]) :is(#panel,#page-overlay,#map-tools) :is([data-action=add],[data-action=edit],[data-action=remove],[data-action=restore],[data-action=draw],[data-action=poi],[data-action=archive-view]){display:none!important}

/* Owner console: customer plan at a glance. */
.plan-chip{display:inline-block;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:700;background:#eef2f6;color:#33404d;border:1px solid #d5dde6}
.plan-chip.plan-fmis{background:#fdeceb;color:#9b1714;border-color:#f3c2c0}
[data-theme=dark] .plan-chip{background:#223442;color:#d8e2ec;border-color:#405365}
[data-theme=dark] .plan-chip.plan-fmis{background:#3a2024;color:#ffb3b0;border-color:#6b3237}

/* Narrow sidebar: Back becomes a single icon button instead of overflowing the rail. */
@media(max-width:900px){
 .workspace-navigation-sidebar{padding:6px 4px;justify-content:center}
 .workspace-navigation-sidebar .workspace-location{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
 .workspace-navigation-sidebar [data-workspace-back]{font-size:0;min-width:40px;min-height:40px;padding:0;display:grid;place-items:center}
 .workspace-navigation-sidebar [data-workspace-back]::before{content:'\2190';font-size:18px}
}

/* FMIS record states: readable words with a consistent colour. */
.record-status{display:inline-block;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:700;background:#eef2f6;color:#33404d;white-space:nowrap}
.record-status-approved,.record-status-in_progress{background:#e4f0fb;color:#17558f}
.record-status-completed,.record-status-closed,.record-status-paid{background:#e3f5ec;color:#11683f}
.record-status-rejected,.record-status-cancelled{background:#fdeceb;color:#9b1714}
.record-overdue{display:block;color:#b45309;font-weight:700}
[data-theme=dark] .record-status{background:#223442;color:#d8e2ec}
#workspace>.provider-banner{top:auto;bottom:calc(var(--dock-height) + 24px)}
@media(max-width:600px){.sidebar-collapse{display:none}}
.trip-result{margin:0 0 14px}
.trip-result p{margin:0}
.customer-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.migration textarea{width:100%;font-family:ui-monospace,Menlo,monospace;font-size:13px}
.migration-sent{display:flex;flex-direction:column;gap:6px;padding:10px 0;border-top:1px solid var(--sw-line)}
.migration-sent .token-box{display:flex;flex-wrap:wrap;gap:6px}.migration-sent input{flex:1 1 220px;min-width:0}
.plan-chip.plan-ready{background:#e3f5ec;color:#11683f;border-color:#b7e2cb}
.mfa-actions{display:flex;gap:8px;align-items:center;flex:none}
#workspace>.mfa-prompt{top:12px;bottom:auto;z-index:40}
