/* ================== Slim header ================== */
.app-header {
    background: #1f2a44;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 999;
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    max-width: 100%;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
}

.app-brand:hover { color: #fff; text-decoration: none; }
.app-brand i { color: #5e72e4; }

.app-header-link {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: background .15s;
}

.app-header-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}

/* Breadcrumbs */
.app-breadcrumbs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.7);
    font-size: 14px;
    margin-left: 10px;
}
.app-bc-link {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .15s;
}
.app-bc-link:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    text-decoration: none;
}
.app-bc-sep {
    color: rgba(255,255,255,.35);
    font-weight: 300;
}
.app-bc-current {
    color: #fff;
    font-weight: 600;
    padding: 4px 8px;
}

.app-header-spacer { flex: 1; }

.app-user-menu { position: relative; }

.app-user-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    padding: 6px 14px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.app-user-btn:hover { background: rgba(255,255,255,.08); }

.app-role-pill {
    background: #5e72e4;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

.app-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    color: #333;
    min-width: 180px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    overflow: hidden;
    z-index: 1000;
}

.app-user-dropdown a {
    display: block;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}
.app-user-dropdown a:hover { background: #f4f6fb; }

/* ================== Home cards ================== */
.home-shell {
    padding: 24px 36px 48px;
    max-width: 1280px;
    margin: 0 auto;
}

.home-business-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 18px;
}

.home-business-label { color: #8898aa; margin-right: 6px; font-size: 13px; }
.home-business-current {
    color: #5e72e4;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.home-welcome { color: #525f7f; font-size: 14px; }

.home-business-popup {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    margin-top: -8px;
    margin-bottom: 18px;
    padding: 8px 0;
    min-width: 260px;
    z-index: 200;
}
.home-business-popup ul { list-style: none; margin: 0; padding: 0; }
.home-business-popup li {
    padding: 8px 16px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
}
.home-business-popup li:hover { background: #f4f6fb; }

.home-greeting {
    font-size: 22px;
    font-weight: 600;
    color: #32325d;
    margin: 16px 0 18px;
}

.home-empty {
    text-align: center;
    color: #8898aa;
    padding: 60px;
    background: #fff;
    border-radius: 10px;
}

.home-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.home-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px 20px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid transparent;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(94,114,228,.18);
    border-color: #5e72e4;
    text-decoration: none;
    color: inherit;
}

.home-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: linear-gradient(135deg,#5e72e4,#825ee4);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 6px;
}

.home-card-title {
    font-size: 17px;
    font-weight: 600;
    color: #32325d;
}

.home-card-tagline {
    font-size: 13px;
    color: #8898aa;
    line-height: 1.4;
}

/* ================== Module hub layout ================== */
.hub-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 56px);
}

.hub-sidebar {
    background: #fff;
    border-right: 1px solid #e9ecef;
    padding: 18px 0;
    position: sticky;
    top: 56px;
    align-self: start;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
}

.hub-sidebar-head {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 18px 18px;
    border-bottom: 1px solid #f0f3f7;
    margin-bottom: 10px;
}

.hub-sidebar-head i {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg,#5e72e4,#825ee4);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.hub-sidebar-title { font-weight: 600; color: #32325d; font-size: 15px; }
.hub-sidebar-sub { font-size: 12px; color: #8898aa; }

.hub-sidebar-empty {
    padding: 18px;
    color: #8898aa;
    font-size: 13px;
    font-style: italic;
}

.hub-sidebar-nav { display: flex; flex-direction: column; }

.hub-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #525f7f;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.hub-sidebar-link:hover {
    background: #f4f6fb;
    color: #5e72e4;
    border-left-color: #5e72e4;
    text-decoration: none;
}

.hub-sidebar-link i { width: 18px; text-align: center; color: #8898aa; }
.hub-sidebar-link:hover i { color: #5e72e4; }

.hub-main {
    padding: 24px 32px 48px;
    background: #f6f8fc;
}

.hub-main-head { margin-bottom: 24px; }
.hub-main-head h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: #32325d;
    display: flex;
    align-items: center;
    gap: 12px;
}
.hub-main-head h1 i { color: #5e72e4; }
.hub-main-head p { margin: 0; color: #8898aa; font-size: 14px; }

.hub-section-title {
    margin: 28px 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: #32325d;
}

.hub-placeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.hub-placeholder-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border-left: 4px solid #5e72e4;
}

.hub-placeholder-title { font-size: 12px; color: #8898aa; text-transform: uppercase; letter-spacing: .5px; }
.hub-placeholder-value { font-size: 28px; font-weight: 700; color: #32325d; margin: 4px 0; }
.hub-placeholder-hint { font-size: 12px; color: #b3bcc9; font-style: italic; }

.hub-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.hub-quick-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: #32325d;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: border-color .15s, transform .15s;
}

.hub-quick-card:hover {
    border-color: #5e72e4;
    transform: translateY(-1px);
    color: #5e72e4;
    text-decoration: none;
}

.hub-quick-card i {
    color: #5e72e4;
    font-size: 18px;
    width: 22px;
    text-align: center;
}

/* ================== Stubs & errors ================== */
.hub-stub {
    margin: 60px auto;
    max-width: 480px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    padding: 36px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.hub-stub i {
    font-size: 44px;
    color: #5e72e4;
    margin-bottom: 14px;
}

.hub-stub h2 { color: #32325d; margin-bottom: 8px; }
.hub-stub p { color: #525f7f; }
.hub-stub-status {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-top: 8px;
}

.hub-stub-back {
    display: inline-block;
    margin-top: 22px;
    color: #5e72e4;
    text-decoration: none;
    font-size: 14px;
}
.hub-stub-back:hover { text-decoration: underline; }

.hub-error {
    margin: 40px auto;
    max-width: 480px;
    padding: 24px;
    background: #fee;
    color: #991b1b;
    border-radius: 10px;
    text-align: center;
}

/* ================== Module-hub business filter ================== */
.hub-main-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
}
.hub-main-titleblock { min-width: 0; }

.hub-business-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.hub-business-label { color: #8898aa; font-size: 13px; }
.hub-business-picker { position: relative; }
.hub-business-btn {
    background: #f4f6fb;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: #32325d;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}
.hub-business-btn:hover { border-color: #5e72e4; color: #5e72e4; }
.hub-business-btn i.fa-briefcase { color: #5e72e4; }
.hub-business-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 500;
}
.hub-business-dropdown a {
    display: block;
    padding: 9px 14px;
    color: #32325d;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}
.hub-business-dropdown a:hover { background: #f4f6fb; color: #5e72e4; }

/* ================== Home welcome strip ================== */
.home-welcome-strip {
    background: #fff;
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    color: #525f7f;
    font-size: 14px;
    margin-bottom: 18px;
}

/* ================== Tracking map ================== */
.tracking-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tracking-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    flex-wrap: wrap;
    gap: 10px;
}
.tracking-status { color: #525f7f; font-size: 14px; }
.tracking-status i { color: #5e72e4; margin-right: 6px; }
.tracking-search {
    display: flex;
    gap: 6px;
    align-items: center;
}
.tracking-search input {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    width: 200px;
}
.tracking-search input:focus { border-color: #5e72e4; outline: none; }

.tracking-map-canvas {
    width: 100%;
    height: calc(100vh - 220px);
    min-height: 480px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    overflow: hidden;
}

/* Info window styling (rendered as Leaflet popup) */
.tracking-info { font-size: 13px; min-width: 220px; }
.tracking-info-head {
    font-size: 14px;
    color: #5e72e4;
    border-bottom: 1px solid #f0f3f7;
    padding-bottom: 6px;
    margin-bottom: 6px;
}
.tracking-info-table { width: 100%; }
.tracking-info-table td {
    padding: 3px 4px;
    color: #525f7f;
}
.tracking-info-table td:first-child {
    color: #8898aa;
    font-size: 12px;
    width: 78px;
}
.tracking-info-actions { margin-top: 10px; text-align: right; }
.tracking-info-btn {
    background: #5e72e4;
    color: #fff;
    border: 0;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.tracking-info-btn:hover { background: #4a5cd2; }

/* Playback panel — bottom strip */
.tracking-playback-panel {
    position: fixed;
    left: 24px;
    right: 24px;
    bottom: 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
    z-index: 1500;
    border: 1px solid #e9ecef;
    max-width: 1200px;
    margin: 0 auto;
}
.tracking-playback-head {
    padding: 10px 14px;
    background: linear-gradient(135deg,#5e72e4,#825ee4);
    color: #fff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tracking-playback-close {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}
.tracking-playback-body {
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr 140px 90px;
    gap: 12px;
    align-items: end;
}
.tracking-playback-body .form-group { margin: 0; }
.tracking-playback-body label {
    font-size: 11px;
    color: #8898aa;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: block;
    margin-bottom: 4px;
}
.tracking-playback-body input[type="datetime-local"],
.tracking-playback-body select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}
.tracking-playback-body input:focus,
.tracking-playback-body select:focus { border-color: #5e72e4; outline: none; }

.tracking-playback-run {
    background: #5e72e4;
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.tracking-playback-run:hover { background: #4a5cd2; }
.tracking-playback-run:disabled { background: #b8c1d4; cursor: not-allowed; }

.tracking-playback-error {
    grid-column: 1 / -1;
    color: #991b1b;
    background: #fee;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
}

/* Timeline + transport row (visible after Run is pressed) */
.tracking-playback-transport {
    padding: 0 14px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #f0f3f7;
    margin-top: -1px;
    padding-top: 12px;
}
.tracking-playback-controls { display: flex; gap: 4px; }
.tracking-playback-btn {
    background: #f4f6fb;
    border: 1px solid #e9ecef;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    color: #5e72e4;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tracking-playback-btn:hover { background: #e9ecef; }
.tracking-playback-btn.is-active {
    background: #5e72e4;
    color: #fff;
    border-color: #5e72e4;
}

.tracking-playback-slider-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tracking-playback-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #16a34a 0%, #f59e0b 50%, #ef4444 100%);
    outline: none;
}
.tracking-playback-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #5e72e4;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.tracking-playback-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #5e72e4;
    cursor: pointer;
}
.tracking-playback-tick-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8898aa;
}

.tracking-playback-legend {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #525f7f;
}
.tracking-playback-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tracking-playback-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.tracking-playback-legend .lg-moving { background: #16a34a; }
.tracking-playback-legend .lg-idle   { background: #f59e0b; }
.tracking-playback-legend .lg-stop   { background: #ef4444; }

/* ================== Responsive ================== */
@media (max-width: 900px) {
    .hub-shell { grid-template-columns: 1fr; }
    .hub-sidebar { position: relative; top: 0; max-height: none; }
    .home-shell { padding: 16px; }
    .hub-main-head { flex-direction: column; align-items: stretch; }
    .tracking-playback-panel { right: 12px; left: 12px; bottom: 12px; }
    .tracking-playback-body { grid-template-columns: 1fr 1fr; }
    .tracking-playback-body .tracking-playback-run { grid-column: 1 / -1; }
    .tracking-playback-transport { flex-wrap: wrap; }
    .tracking-map-canvas { height: 60vh; }
}
