/* TruckLinx Fleet Command — shared layout and map.
   Source of truth for all Fleet Command presentation rules. */

/* Global and shared portal styles */
:root {
    color-scheme: dark;
    --navy-950: #050b16;
    --navy-900: #081629;
    --navy-800: #11233b;
    --blue: #248cfa;
    --blue-light: #70b6ff;
    --text: #f4f8ff;
    --muted: #a3b4cc;
    --line: rgba(165, 194, 229, .17);
    --good: #50d6a4;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy-950); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 13% 18%, rgba(37, 129, 238, .19), transparent 37%),
        radial-gradient(circle at 93% 89%, rgba(29, 103, 185, .12), transparent 34%),
        linear-gradient(135deg, #071225, #050a15 72%);
}
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible {
    outline: 3px solid var(--blue-light);
    outline-offset: 3px;
}

.shell {
    width: calc(100% - 44px);
    max-width: none;
    margin: 0 auto;
}

/* Preserve the original login page dimensions. */
.main:has(> #login-screen:not([hidden])) {
    max-width: 1200px;
}

.topbar {
    min-height: 99px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 13px; align-items: center; }
.brand-symbol {
    width: 49px; height: 49px; border-radius: 14px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #227fe6, #0d4c9b);
    box-shadow: 0 12px 28px rgba(19, 119, 237, .3);
}
.brand-symbol svg { width: 32px; height: 32px; }
.brand-title { display: block; font-size: 20px; font-weight: 850; letter-spacing: -.04em; }
.brand-title span { color: var(--blue-light); }
.brand-description {
    display: block; color: var(--muted); font-size: 10px;
    letter-spacing: .22em; font-weight: 750; margin-top: 2px;
}
.private-label {
    display: flex; align-items: center; gap: 9px;
    color: #c0d4ec; font-size: 12px; font-weight: 700;
    letter-spacing: .09em; text-transform: uppercase;
}
.private-label::before {
    content: ""; width: 7px; height: 7px;
    background: var(--good); border-radius: 50%;
    box-shadow: 0 0 13px rgba(80, 214, 164, .55);
}
.main { padding: clamp(50px, 8vh, 105px) 0 76px; }
.auth-layout {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .82fr);
    align-items: center; gap: clamp(42px, 8vw, 130px);
}
.eyebrow {
    color: var(--blue-light); font-size: 12px; font-weight: 800;
    letter-spacing: .18em; text-transform: uppercase;
    display: flex; align-items: center; gap: 11px;
}
.eyebrow::before { content: ""; width: 25px; height: 2px; background: var(--blue); }
h1 { font-size: clamp(44px, 5vw, 70px); font-weight: 850; letter-spacing: -.06em; line-height: 1.08; margin: 22px 0; }
h1 em { font-style: normal; color: var(--blue-light); }
.intro { color: var(--muted); font-size: 17px; line-height: 1.85; max-width: 490px; margin: 0; }
.feature-grid { display: grid; gap: 14px; margin-top: 36px; }
.feature { display: flex; gap: 14px; align-items: center; color: #d0dded; font-size: 14px; }
.feature-icon {
    display: grid; place-items: center;
    width: 38px; height: 38px; flex: 0 0 auto;
    border: 1px solid rgba(88, 161, 247, .32);
    background: rgba(36, 140, 250, .10); border-radius: 11px;
    color: var(--blue-light); font-size: 17px;
}
.login-card, .portal-card {
    background: linear-gradient(155deg, rgba(20, 41, 68, .96), rgba(8, 19, 35, .98));
    border: 1px solid rgba(134, 176, 232, .24);
    border-radius: 24px; padding: clamp(25px, 3.2vw, 42px);
    box-shadow: 0 35px 75px rgba(0, 0, 0, .35);
}
.card-label { color: var(--blue-light); font-weight: 750; text-transform: uppercase; letter-spacing: .15em; font-size: 11px; }
h2 { font-size: 30px; margin: 12px 0 8px; letter-spacing: -.04em; }
.card-description { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 30px; }
.form-field { margin-bottom: 19px; }
.form-field label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.form-field input {
    width: 100%; height: 52px; padding: 0 16px;
    color: var(--text); background: #09182b;
    border: 1px solid rgba(159, 193, 233, .27);
    border-radius: 12px; outline: none;
}
.form-field input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(36, 140, 250, .15); }
.form-field input::placeholder { color: #71829b; }
.primary-button, .secondary-button {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 10px; min-height: 52px; border-radius: 12px;
    font-size: 14px; font-weight: 800; text-decoration: none;
    padding: 0 19px;
}
.primary-button {
    width: 100%; color: #fff; border: 1px solid #3399ff;
    background: linear-gradient(120deg, #1677db, #2297fd);
    box-shadow: 0 13px 28px rgba(20, 125, 238, .22);
}
.primary-button:not(:disabled):hover { filter: brightness(1.1); }
.secondary-button { color: #d7e9ff; border: 1px solid var(--line); background: rgba(255, 255, 255, .055); }
.secondary-button:hover { background: rgba(255, 255, 255, .1); }
.message { margin: 16px 0 0; line-height: 1.5; font-size: 13px; }
.message.error { color: #ffadad; }
.form-footnote { margin: 23px 0 0; text-align: center; color: #9daec3; font-size: 12px; line-height: 1.6; }
.footer { border-top: 1px solid var(--line); padding: 22px 0 36px; color: #7f91ab; font-size: 12px; }
.footer-content { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.loading { min-height: 45vh; display: grid; place-content: center; gap: 18px; text-align: center; color: var(--muted); }
.spinner {
    width: 34px; height: 34px; border-radius: 50%; margin: 0 auto;
    border: 3px solid rgba(112, 182, 255, .2); border-top-color: var(--blue-light);
    animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.portal-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 26px; }
.portal-title { font-size: clamp(33px, 4vw, 48px); margin: 10px 0 8px; }
.portal-subtitle { color: var(--muted); line-height: 1.6; margin: 0; }
.connection-status { display: flex; gap: 11px; align-items: center; color: var(--good); font-weight: 800; }
.connection-status svg { width: 22px; height: 22px; }
.fleet-name { margin: 12px 0 7px; font-size: clamp(23px, 3vw, 32px); font-weight: 800; overflow-wrap: anywhere; }
.fleet-meta { margin: 0; color: var(--muted); }
.section-title { font-size: 19px; margin: 38px 0 15px; }
.preview-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.preview-card { border: 1px solid var(--line); border-radius: 17px; padding: 23px; background: rgba(17, 35, 59, .8); }
.preview-card h3 { margin: 9px 0 9px; font-size: 17px; }
.preview-card p { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.65; }
.preview-card small { display: inline-block; color: #a8ccfc; margin-top: 21px; letter-spacing: .05em; }
@media (max-width: 820px) {
    .auth-layout { grid-template-columns: 1fr; gap: 42px; }
    .main { padding-top: 49px; }
    .intro { max-width: none; }
    .preview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 450px) {
    .shell { width: min(100% - 30px, 1200px); }
    .private-label { font-size: 10px; }
    .brand-title { font-size: 18px; }
    .brand-description { font-size: 9px; }
    .topbar { min-height: 82px; }
    .login-card, .portal-card { padding: 23px; }
}

/* Fleet map styles */
.fleet-map-section { margin-top: 28px; }
.fleet-map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.fleet-map-title { margin: 0 0 6px; font-size: clamp(20px, 2.4vw, 27px); }
.fleet-map-caption, .fleet-map-notice { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.fleet-map-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.fleet-map-actions .map-action { min-height: 40px; padding: 0 13px; font-size: 12px; }
.fleet-map-frame { position: relative; height: clamp(350px, 56vh, 680px); overflow: hidden; border: 1px solid rgba(134, 176, 232, .30); border-radius: 18px; background: #0a1726; }
.fleet-map-canvas { height: 100%; width: 100%; }
.fleet-map-empty { position: absolute; top: 16px; left: 16px; z-index: 2; max-width: min(480px, calc(100% - 90px)); padding: 11px 14px; display: flex; gap: 9px; align-items: flex-start; border: 1px solid rgba(134, 176, 232, .28); background: rgba(7, 20, 39, .92); border-radius: 12px; color: #e0eaff; font-size: 12px; line-height: 1.45; pointer-events: none; }
.fleet-map-empty-dot { margin-top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #70b6ff; flex: 0 0 auto; }
.fleet-map-error { position: absolute; inset: 0; z-index: 3; margin: 0; display: grid; place-items: center; padding: 24px; background: #0a1726; color: #f4f8ff; font-size: 14px; text-align: center; }
.fleet-map-notice { padding: 11px 2px 0; }
.fleet-map-frame .maplibregl-ctrl-group { background: #10243b; border: 1px solid rgba(134,176,232,.3); border-radius: 9px; }
.fleet-map-frame .maplibregl-ctrl-group button { background: #10243b; }
.fleet-map-frame .maplibregl-ctrl-group button:hover { background: #193d61; }
.fleet-map-frame .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.fleet-map-frame .maplibregl-ctrl-attrib { background: rgba(8, 22, 41, .85); color: #dae7fa; }
.fleet-map-frame .maplibregl-ctrl-attrib a { color: #9bccff; }
@media (max-width: 700px) {
    .fleet-map-frame { height: min(67vh, 550px); min-height: 350px; }
    .fleet-map-empty { top: 12px; left: 12px; max-width: calc(100% - 76px); padding: 9px 10px; font-size: 11px; }
}
@media (max-width: 450px) { .fleet-map-toolbar { align-items: flex-start; } .fleet-map-actions { width: 100%; } }




/* Authenticated Overview spacing */
.main:has(> #portal-screen:not([hidden])) {
    padding-top: 10px;
    padding-bottom: 10px;
}


/* Fleet Command navigation */
#portal-screen > nav[aria-label="Fleet Command navigation"] {
    padding: 0 0 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
}


.portal-card > .fleet-map-section {
    margin-top: 14px;
}


/* Keep the verified fleet name and role tightly stacked in the header.
   These elements are paragraphs moved into the brand via JavaScript; reset
   their paragraph spacing and override the generic brand-subtitle tracking. */
#header-fleet-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

#header-fleet-identity #fleet-name {
    display: block;
    margin: 0;
    padding: 0;
    font-size: clamp(14px, 1.4vw, 18px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#header-fleet-identity #fleet-role {
    display: block;
    margin: 0;
    padding: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: normal;
    line-height: 1.2;
    text-transform: none;
}


/* Reduce empty space above the Fleet Map */
#portal-screen > .portal-card {
    padding-top: 12px;
}


/* Brighten the Fleet Map without affecting its controls */
.fleet-map-canvas .maplibregl-canvas {
    filter: brightness(1.3);
}


/* Keep the footer at the bottom on every Fleet Command tab */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.main {
    flex: 1;
}


/* TruckLinx official Fleet Command header icon */
.topbar .brand-symbol {
    background: url('../images/trucklinx-fleet-icon.png') center / contain no-repeat;
    border-radius: 50%;
    box-shadow: none;
}

.topbar .brand-symbol svg {
    display: none;
}


/* ==========================================
   TruckLinx Fleet Command - Fleet Roster
   ========================================== */

#fleet-roster-members:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

#fleet-roster-members .fleet-member-card {
    padding: 22px;
    border: 1px solid #304864;
    border-radius: 16px;
    background: #132740;
    min-width: 0;
}

/* Driver identity */
.roster-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.roster-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    font-size: 27px;
    border-radius: 12px;
    background: #203d60;
}

.roster-card-header h3 {
    margin: 0 0 5px;
    font-size: 17px;
    color: #ffffff;
}

.roster-member-id {
    margin: 0;
    color: #91aac8;
    font-size: 11px;
    overflow-wrap: anywhere;
}

/* Driver and equipment details */
.roster-card-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
    padding: 18px 0;
    border-top: 1px solid #304864;
    border-bottom: 1px solid #304864;
}

.roster-detail {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.roster-detail strong {
    display: block;
    margin-bottom: 5px;
    color: #91aac8;
    font-size: 11px;
    font-weight: 500;
}

.roster-detail span {
    display: block;
    color: #f1f6ff;
    font-size: 13px;
    font-weight: 600;
}

/* Membership status */
.roster-card-status {
    display: block;
    margin-top: 18px;
    font-size: 11px;
    color: #55ddb6;
    letter-spacing: 0.3px;
}

/* Tablet and phone responsiveness */
@media (max-width: 760px) {
    #fleet-roster-members:not([hidden]) {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    #fleet-roster-members .fleet-member-card {
        padding: 16px;
    }
}



/* Roster profile editing: scoped to the independent roster module. */
.roster-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.roster-card-actions button { padding: 10px 14px; }
.roster-edit-input {
    display: block; width: 100%; min-width: 0; box-sizing: border-box;
    padding: 9px 10px; border: 1px solid #587595; border-radius: 7px;
    background: #081a30; color: #f1f6ff; font: inherit; font-size: 13px;
}
.roster-edit-input:focus-visible { outline: 2px solid #71b8ff; outline-offset: 2px; }
.roster-card-feedback { margin: 10px 0 0; font-size: 12px; color: #d7e9ff; }

/* ==========================================
   TruckLinx Fleet Command - Inline Staff Records
   ========================================== */

#fleet-roster-members:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 22px;
}

/* Single-line employee record */

#fleet-roster-members .fleet-member-card {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #365675 #0b192a;
}

/* Employee identity */

#fleet-roster-members .roster-card-header {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    margin: 0;
    min-width: 145px;
}

#fleet-roster-members .roster-card-icon {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border-radius: 8px;
}

#fleet-roster-members .roster-card-header h3 {
    font-size: 14px;
    margin: 0 0 3px;
    white-space: nowrap;
}

#fleet-roster-members .roster-member-id {
    font-size: 10px;
    white-space: nowrap;
}

/* All employee fields on one horizontal line */

#fleet-roster-members .roster-card-details {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    flex: 1 0 auto;
    gap: 24px;
    padding: 4px 18px;
    border: 0;
    border-left: 1px solid #304864;
    border-right: 1px solid #304864;
}

#fleet-roster-members .roster-detail {
    flex: 0 0 auto;
    min-width: 85px;
    white-space: nowrap;
}

#fleet-roster-members .roster-detail strong {
    font-size: 11px;
    margin-bottom: 4px;
    white-space: nowrap;
}

#fleet-roster-members .roster-detail span {
    font-size: 12px;
    white-space: nowrap;
    overflow-wrap: normal;
}

/* Membership status */

#fleet-roster-members .roster-card-status {
    flex: 0 0 auto;
    margin: 0;
    font-size: 10px;
    color: #50d6a4;
    white-space: nowrap;
}

/* Record actions */

#fleet-roster-members .roster-card-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin: 0;
}

#fleet-roster-members .roster-card-actions button {
    width: auto;
    min-height: 34px;
    padding: 7px 12px;
    font-size: 11px;
    white-space: nowrap;
}

/* Inline editing */

#fleet-roster-members .roster-edit-input {
    width: 160px;
    min-width: 120px;
    padding: 7px;
    font-size: 12px;
}

#fleet-roster-members .roster-card-feedback {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

/* Horizontal record scrollbar */

#fleet-roster-members .fleet-member-card::-webkit-scrollbar {
    height: 8px;
}

#fleet-roster-members .fleet-member-card::-webkit-scrollbar-track {
    background: #0b192a;
    border-radius: 8px;
}

#fleet-roster-members .fleet-member-card::-webkit-scrollbar-thumb {
    background: #365675;
    border-radius: 8px;
}

#fleet-roster-members .fleet-member-card::-webkit-scrollbar-thumb:hover {
    background: #70b6ff;
}

/* ==========================================
   TruckLinx Fleet Command - Staff Typography
   ========================================== */

#fleet-roster-members .roster-card-header h3 {
    font-size: 17px;
}

#fleet-roster-members .roster-member-id {
    font-size: 12px;
}

#fleet-roster-members .roster-detail strong {
    font-size: 13px;
}

#fleet-roster-members .roster-detail span {
    font-size: 15px;
}

#fleet-roster-members .roster-card-status {
    font-size: 12px;
}

#fleet-roster-members .roster-card-actions button {
    font-size: 14px;
}

#fleet-roster-members .roster-edit-input {
    font-size: 15px;
}

#fleet-roster-members .roster-card-feedback {
    font-size: 13px;
}

/* ==========================================
   TruckLinx Fleet Command - Staff Header
   ========================================== */

section[aria-labelledby="fleet-roster-heading"] > .portal-heading {
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

#fleet-roster-heading {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.3;
}

#fleet-roster-summary {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.fleet-roster-heading-actions {
    margin: 0;
}

.fleet-roster-heading-actions .secondary-button {
    min-height: 42px;
    padding: 0 18px;
    font-size: 14px;
}