* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f6f9;
    color: #172033;
}

.topbar {
    min-height: 76px;
    background: #101828;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.brand {
    font-size: 23px;
    font-weight: 750;
}

.subtitle {
    font-size: 12px;
    color: #aeb8ca;
    margin-top: 3px;
}

.version {
    color: #aeb8ca;
    font-size: 13px;
}

.page {
    max-width: 1450px;
    margin: auto;
    padding: 34px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.hero h1 {
    margin: 0;
    font-size: 32px;
}

.hero p {
    color: #667085;
    margin: 7px 0 0;
}

.primary-btn {
    border: 0;
    background: #2563eb;
    color: white;
    padding: 12px 18px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 21px;
    border-left: 5px solid #64748b;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
}

.stat-card.green {
    border-left-color: #16a34a;
}

.stat-card.yellow {
    border-left-color: #eab308;
}

.stat-card.red {
    border-left-color: #dc2626;
}

.stat-card.blue {
    border-left-color: #2563eb;
}

.stat-number {
    font-size: 31px;
    font-weight: 800;
}

.stat-label {
    margin-top: 3px;
    color: #667085;
    font-size: 13px;
}

.panel {
    background: white;
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    border-bottom: 1px solid #eaecf0;
}

.panel-header h2 {
    margin: 0;
}

.panel-header p {
    color: #667085;
    font-size: 13px;
    margin: 4px 0 0;
}

.search {
    width: 300px;
    padding: 11px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    outline: none;
}

.vehicle-row {
    display: flex;
    align-items: center;
    padding: 17px 24px;
    border-bottom: 1px solid #f0f2f5;
    gap: 15px;
}

.truck-icon {
    font-size: 26px;
}

.vehicle-main {
    flex: 1;
}

.truck-number {
    font-weight: 750;
    font-size: 16px;
}

.vehicle-meta {
    color: #667085;
    font-size: 12px;
    margin-top: 3px;
}

.mileage {
    min-width: 130px;
    text-align: right;
}

.mileage strong {
    display: block;
    font-size: 17px;
}

.mileage span {
    color: #667085;
    font-size: 11px;
}

.status {
    min-width: 82px;
    text-align: center;
    padding: 7px 10px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 800;
}

.status.good {
    background: #dcfce7;
    color: #166534;
}

.empty-state {
    text-align: center;
    padding: 75px 20px;
}

.empty-icon {
    font-size: 52px;
}

.empty-state h3 {
    margin-bottom: 6px;
}

.empty-state p {
    color: #667085;
}

footer {
    text-align: center;
    padding: 26px;
    color: #98a2b3;
    font-size: 12px;
}

@media (max-width: 850px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .page {
        padding: 18px;
    }

    .hero {
        align-items: flex-start;
        gap: 18px;
    }

    .search {
        width: 190px;
    }
}

.primary-btn {
    text-decoration: none;
    display: inline-block;
}

.form-page {
    max-width: 1000px;
}

.back-row {
    margin-bottom: 18px;
}

.back-link {
    color: #475467;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.form-panel {
    background: white;
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
}

.form-heading {
    margin-bottom: 26px;
}

.form-heading h1 {
    margin: 0;
    font-size: 28px;
}

.form-heading p {
    margin: 6px 0 0;
    color: #667085;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: #344054;
}

.field input,
.field select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.field input:focus,
.field select:focus {
    outline: 2px solid #dbeafe;
    border-color: #2563eb;
}

.form-note {
    margin-top: 22px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475467;
    font-size: 13px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
}

.secondary-btn {
    display: inline-block;
    padding: 11px 18px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    color: #344054;
    background: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.status.baseline {
    background: #fef3c7;
    color: #92400e;
    min-width: 125px;
}

.baseline-needed {
    color: #b45309;
    font-size: 14px !important;
}

.edit-btn {
    text-decoration: none;
    color: #344054;
    border: 1px solid #d0d5dd;
    background: white;
    border-radius: 7px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
}

.edit-btn:hover {
    background: #f8fafc;
}

.baseline-title {
    color: #b45309 !important;
    font-weight: 700;
}

.edit-btn {
    text-decoration: none;
    color: #344054;
    border: 1px solid #d0d5dd;
    background: white;
    border-radius: 7px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
}

.edit-btn:hover {
    background: #f8fafc;
}

.baseline-title {
    color: #b45309 !important;
    font-weight: 700;
}

.system-bar {
    background: white;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 3px 12px rgba(16,24,40,.06);
}

.system-label {
    font-size: 13px;
    font-weight: 750;
    color: #344054;
}

.system-form {
    flex: 1;
}

.system-select {
    width: 100%;
    max-width: 390px;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: white;
    color: #172033;
    font-size: 14px;
    font-weight: 650;
}

.all-systems-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}

.baseline-card {
    border-left-color: #f59e0b;
}

.cards {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 650px) {

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .system-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .system-select {
        max-width: none;
    }

    .vehicle-row {
        flex-wrap: wrap;
    }
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-link {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}

.top-link:hover {
    color: white;
}

.signed-in-user {
    color: #98a2b3;
    font-size: 12px;
}

.login-body {
    min-height: 100vh;
    margin: 0;
    background: #f4f6f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 15px;
    padding: 34px;
    box-shadow: 0 8px 30px rgba(16,24,40,.12);
}

.login-brand {
    color: #172033;
    font-size: 24px;
    font-weight: 800;
}

.login-subtitle {
    color: #667085;
    font-size: 12px;
    margin-top: 3px;
}

.login-box h1 {
    margin-top: 32px;
    margin-bottom: 22px;
}

.login-password {
    margin-top: 18px;
}

.login-btn {
    width: 100%;
    margin-top: 24px;
}

.login-help {
    color: #667085;
    font-size: 14px;
    line-height: 1.5;
}

.admin-user-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid #eaecf0;
}

.admin-user-main {
    flex: 1;
    min-width: 0;
}

.user-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.user-role {
    background: #eef2ff;
    color: #3730a3;
    padding: 6px 9px;
    border-radius: 30px;
    font-size: 10px;
    font-weight: 800;
}

.admin-role {
    background: #dbeafe;
    color: #1d4ed8;
}

.small-btn {
    padding: 7px 11px;
    font-size: 12px;
}

.user-password-field {
    margin-top: 20px;
}

.field-help {
    color: #667085;
    font-size: 12px;
    line-height: 1.4;
}

.system-access-title {
    margin-top: 28px;
    margin-bottom: 12px;
    color: #344054;
    font-size: 14px;
    font-weight: 750;
}

.system-check-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.system-check {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    padding: 12px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.system-check input {
    width: 17px;
    height: 17px;
}

@media (max-width: 650px) {
    .system-check-grid {
        grid-template-columns: 1fr;
    }

    .admin-user-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .top-actions {
        gap: 9px;
    }

    .signed-in-user {
        display: none;
    }
}

.system-fixed {
    font-size: 14px;
    font-weight: 750;
    color: #172033;
}

.truck-link {
    color: #172033;
    text-decoration: none;
}

.truck-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.vehicle-hero {
    background: white;
    border-radius: 14px;
    padding: 26px 28px;
    margin-bottom: 20px;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
    display: flex;
    justify-content: space-between;
    gap: 25px;
    align-items: center;
}

.vehicle-hero h1 {
    margin: 4px 0 10px;
    font-size: 34px;
}

.vehicle-system-label {
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.vehicle-id-line {
    color: #667085;
    font-size: 13px;
    margin-top: 4px;
}

.vehicle-mileage-box {
    text-align: right;
    min-width: 190px;
}

.vehicle-mileage-label {
    color: #667085;
    font-size: 12px;
    font-weight: 650;
}

.vehicle-mileage-number {
    font-size: 34px;
    font-weight: 800;
    margin-top: 3px;
}

.vehicle-mileage-unit {
    color: #667085;
    font-size: 12px;
}

.vehicle-mileage-baseline {
    color: #b45309;
    font-size: 18px;
    font-weight: 800;
    margin-top: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-panel {
    overflow: hidden;
}

.maintenance-rule-row,
.service-row {
    padding: 17px 22px;
    border-bottom: 1px solid #eaecf0;
}

.maintenance-rule-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.maintenance-rule-main {
    flex: 1;
}

.maintenance-due-info {
    margin-top: 5px;
}

.status.due-soon-status {
    background: #fef3c7;
    color: #92400e;
}

.status.overdue-status {
    background: #fee2e2;
    color: #991b1b;
}

.status.neutral-status {
    background: #f2f4f7;
    color: #475467;
    min-width: 110px;
}

.service-row {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr) 110px 100px;
    gap: 14px;
    align-items: center;
}

.service-date {
    color: #475467;
    font-size: 13px;
    font-weight: 650;
}

.service-mileage,
.service-cost {
    text-align: right;
    font-size: 13px;
    font-weight: 700;
}

.compact-empty {
    padding: 45px 20px;
}

.detail-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.action-panel {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
}

.action-panel h3 {
    margin: 0 0 18px;
}

.action-panel .field {
    margin-bottom: 14px;
}

.action-panel textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

.two-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-full {
    width: 100%;
    margin-top: 4px;
}

@media (max-width: 950px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-side {
        order: -1;
    }
}

@media (max-width: 650px) {
    .vehicle-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .vehicle-mileage-box {
        text-align: left;
    }

    .service-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .service-mileage,
    .service-cost {
        text-align: left;
    }
}

.admin-page {
    max-width: 1900px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-tab {
    background: white;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 11px 18px;
    color: #172033;
    text-decoration: none;
    font-size: 14px;
    font-weight: 750;
}

.admin-tab.active {
    background: #111;
    color: white;
    border-color: #111;
}

.admin-table-panel {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
}

.admin-section-heading {
    padding: 20px 22px;
    border-bottom: 1px solid #eaecf0;
}

.admin-section-heading h2 {
    margin: 0;
}

.admin-section-heading p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 13px;
}

.admin-table-scroll {
    overflow-x: auto;
}

.account-table,
.activity-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1400px;
}

.account-table th,
.account-table td,
.activity-table th,
.activity-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eaecf0;
    vertical-align: top;
    text-align: left;
    font-size: 12px;
}

.account-table th,
.activity-table th {
    background: #f8fafc;
    color: #344054;
    font-weight: 800;
    white-space: nowrap;
}

.table-subtext {
    color: #98a2b3;
    font-size: 11px;
    margin-top: 3px;
}

.status-detail-cell {
    min-width: 260px;
}

.online-pill,
.offline-pill,
.locked-pill,
.unlocked-pill,
.enabled-pill,
.disabled-pill,
.password-change-pill {
    display: inline-block;
    border-radius: 30px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
}

.online-pill,
.unlocked-pill {
    background: #dcfce7;
    color: #166534;
}

.offline-pill {
    background: #f1f5f9;
    color: #475569;
}

.locked-pill,
.disabled-pill {
    background: #fee2e2;
    color: #991b1b;
}

.enabled-pill {
    background: #dbeafe;
    color: #1d4ed8;
}

.password-change-pill {
    background: #fef3c7;
    color: #92400e;
}

.device-info {
    color: #667085;
    font-size: 11px;
    margin-top: 3px;
}

.account-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 220px;
}

.account-actions form {
    margin: 0;
}

.action-button {
    appearance: none;
    border: 0;
    border-radius: 6px;
    padding: 6px 8px;
    color: white;
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.action-button.black {
    background: #111;
}

.action-button.orange {
    background: #b45309;
}

.action-button.red {
    background: #991b1b;
}

.action-button.green {
    background: #166534;
}

.administrator-label {
    color: #98a2b3;
}

.security-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.security-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 3px 12px rgba(16,24,40,.07);
}

.security-card strong {
    display: block;
    font-size: 28px;
    color: #172033;
}

.security-card span {
    display: block;
    margin-top: 7px;
    color: #667085;
    font-size: 11px;
    font-weight: 800;
}

.activity-pill {
    display: inline-block;
    border-radius: 30px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
}

.activity-pill.success {
    background: #dcfce7;
    color: #166534;
}

.activity-pill.error {
    background: #fee2e2;
    color: #991b1b;
}

.activity-pill.warning {
    background: #fef3c7;
    color: #92400e;
}

.group-admin-grid {
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.group-admin-card {
    border: 1px solid #eaecf0;
    border-radius: 10px;
    padding: 17px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.group-counts {
    color: #667085;
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .security-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .group-admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .security-cards {
        grid-template-columns: 1fr;
    }
}

.setup-card {
    border-left-color: #8b5cf6;
}

.status.setup-status {
    background: #ede9fe;
    color: #5b21b6;
}

.status.due-soon-status {
    background: #fef3c7;
    color: #92400e;
}

.status.overdue-status {
    background: #fee2e2;
    color: #991b1b;
}

/* Fleet Overview status cards */
.cards {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 650px) {
    .cards {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* ----------------------------------------------------------
   Truck Information
   ---------------------------------------------------------- */

.truck-info-panel {
    margin-bottom: 20px;
}

.truck-info-title h3 {
    margin-bottom: 4px;
}

.truck-info-subtitle {
    margin: 0 0 18px;
    font-size: 13px;
    color: #718096;
}

.document-item {
    padding: 15px 0;
    border-bottom: 1px solid #e8edf5;
}

.document-item:first-of-type {
    padding-top: 4px;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.document-header strong {
    color: #17233f;
    font-size: 15px;
}

.document-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.document-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .35px;
}

.document-status.valid {
    color: #087443;
    background: #dff7ea;
}

.document-status.due-soon {
    color: #8a5b00;
    background: #fff2c7;
}

.document-status.expired {
    color: #a82020;
    background: #fde3e3;
}

.document-status.not-entered {
    color: #667085;
    background: #edf1f6;
}

.truck-info-save {
    width: 100%;
    margin-top: 18px;
}

@media (max-width: 650px) {
    .document-date-grid {
        grid-template-columns: 1fr;
    }
}

.truck-info-save {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 18px;
    padding: 11px 16px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.truck-info-save:hover {
    opacity: .92;
}


/* ----------------------------------------------------------
   Fleet document alerts
   ---------------------------------------------------------- */

.document-due-card {
    border-left-color: #f59e0b;
}

.document-expired-card {
    border-left-color: #dc2626;
}

.vehicle-document-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.vehicle-document-alert {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .25px;
}

.vehicle-document-alert.due-soon {
    color: #8a5b00;
    background: #fff2c7;
}

.vehicle-document-alert.expired {
    color: #a82020;
    background: #fde3e3;
}

/* Clickable dashboard filter cards */

.clickable-stat-card {
    cursor: pointer;
    transition:
        transform .15s ease,
        box-shadow .15s ease;
}

.clickable-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(23, 35, 63, .10);
}

.clickable-stat-card.active-stat-filter {
    outline: 3px solid rgba(37, 99, 235, .20);
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   Collapsible truck setup panels
   ---------------------------------------------------------- */

.setup-details {
    margin-bottom: 20px;
}

.setup-details > summary {
    list-style: none;
}

.setup-details > summary::-webkit-details-marker {
    display: none;
}

.setup-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;

    padding: 16px 18px;

    background: #ffffff;
    border-radius: 14px;

    box-shadow:
        0 2px 10px rgba(23, 35, 63, .06);

    cursor: pointer;
}

.setup-summary strong {
    display: block;
    color: #17233f;
    font-size: 15px;
}

.setup-summary-note {
    display: block;
    margin-top: 3px;
    color: #718096;
    font-size: 12px;
}

.setup-summary-action {
    flex-shrink: 0;

    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
}

.setup-details[open] > .setup-summary {
    margin-bottom: 10px;
}

.setup-details[open] .setup-summary-action::after {
    content: " ↑";
}

.setup-details:not([open]) .setup-summary-action::after {
    content: " ↓";
}

.setup-details > .action-panel {
    margin-bottom: 0;
}



/* ----------------------------------------------------------
   Vehicle In Service / Downtime
   ---------------------------------------------------------- */

.status.in-service-status {
    background: #dbeafe;
    color: #1d4ed8;
}

.vehicle-in-service-panel {
    border: 2px solid #60a5fa;
}

.availability-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.availability-heading h3 {
    margin: 0;
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .3px;
}

.availability-badge.in-service {
    background: #dbeafe;
    color: #1d4ed8;
}

.availability-badge.available {
    background: #dcfce7;
    color: #15803d;
}

.downtime-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.downtime-info > div {
    padding: 11px 12px;
    border-radius: 9px;
    background: #f7f9fc;
}

.downtime-info span {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    color: #718096;
}

.downtime-info strong {
    color: #17233f;
    font-size: 13px;
}

.downtime-info .downtime-notes {
    grid-column: 1 / -1;
}

.return-service-btn {
    margin-top: 10px;
}

.downtime-history-item {
    padding: 14px 0;
    border-bottom: 1px solid #e8edf5;
}

.downtime-history-item:last-child {
    border-bottom: 0;
}

.downtime-history-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.downtime-history-meta {
    margin-top: 5px;
    color: #718096;
    font-size: 12px;
}

.downtime-history-notes {
    margin-top: 8px;
    font-size: 13px;
    color: #465166;
}

@media (max-width: 650px) {
    .downtime-info {
        grid-template-columns: 1fr;
    }

    .downtime-info .downtime-notes {
        grid-column: auto;
    }
}


/* Attention Needed dashboard tile */

.attention-card {
    border-left-color: #ea580c;
}

.attention-card .stat-number {
    font-weight: 800;
}



/* ----------------------------------------------------------
   Maintenance Template Admin
   ---------------------------------------------------------- */

.admin-page-heading {
    margin: 24px 0;
}

.admin-page-heading h1 {
    margin: 0 0 5px;
    color: #17233f;
}

.admin-page-heading p {
    margin: 0;
    color: #718096;
}

.admin-flash {
    margin-bottom: 18px;
    padding: 12px 15px;
    border-radius: 10px;
    background: #eaf2ff;
    color: #1d4ed8;
    font-weight: 600;
}

.template-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 20px;
    align-items: start;
}

.admin-card {
    padding: 22px;
    margin-bottom: 20px;
    border-radius: 15px;
    background: #ffffff;
    box-shadow:
        0 2px 12px rgba(23, 35, 63, .07);
}

.admin-card h2 {
    margin-top: 0;
    color: #17233f;
}

.template-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;

    margin-top: 10px;
    padding: 15px;

    text-decoration: none;
    color: #17233f;

    border: 1px solid #e5eaf2;
    border-radius: 11px;
}

.template-list-item:hover {
    background: #f8faff;
}

.template-list-item strong {
    display: block;
    font-size: 15px;
}

.template-list-item span {
    display: block;
    margin-top: 3px;
    color: #718096;
    font-size: 12px;
}

.template-list-item p {
    margin: 6px 0 0;
    color: #718096;
    font-size: 12px;
}

.template-list-item .template-manage {
    color: #2563eb;
    font-weight: 700;
    white-space: nowrap;
}

.template-back-link {
    margin-top: 20px;
}

.template-back-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
}

.template-delete-card p {
    color: #718096;
    font-size: 13px;
}

.danger-action-btn,
.small-danger-btn {
    border: 0;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 700;
    cursor: pointer;
}

.danger-action-btn {
    width: 100%;
    padding: 11px 15px;
}

.small-danger-btn {
    padding: 7px 10px;
}

.template-rules-card {
    margin-top: 2px;
}

.template-rule-heading p {
    margin-top: -7px;
    color: #718096;
    font-size: 13px;
}

.template-rule-row {
    display: grid;
    grid-template-columns:
        minmax(150px, 1.2fr)
        1fr
        1fr
        1.2fr
        auto;

    gap: 14px;
    align-items: center;

    padding: 14px 0;
    border-bottom: 1px solid #e8edf5;

    color: #465166;
    font-size: 13px;
}

.template-rule-row:last-child {
    border-bottom: 0;
}

.template-rule-name {
    color: #17233f;
}

.empty-admin-state {
    padding: 24px;
    text-align: center;
    color: #718096;
}

@media (max-width: 850px) {

    .template-admin-grid {
        grid-template-columns: 1fr;
    }

    .template-rule-row {
        grid-template-columns: 1fr;
    }
}


/* ----------------------------------------------------------
   Apply Maintenance Template
   ---------------------------------------------------------- */

.template-apply-panel {
    border: 1px solid #dbe7fb;
}

.template-apply-help {
    margin: -5px 0 16px;
    color: #718096;
    font-size: 13px;
    line-height: 1.45;
}

.template-apply-panel select {
    width: 100%;
}


/* ----------------------------------------------------------
   Service Visit / Invoice
   ---------------------------------------------------------- */

.service-visit-help {
    margin: -5px 0 16px;
    color: #718096;
    font-size: 13px;
}

.service-rule-checklist {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}

.service-rule-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 9px 11px;

    border: 1px solid #e4eaf3;
    border-radius: 9px;

    cursor: pointer;
}

.service-rule-checkbox:hover {
    background: #f8faff;
}

.service-rule-checkbox input {
    width: auto;
    margin: 0;
}

.field-help {
    margin-top: 7px;
    color: #718096;
    font-size: 11px;
    line-height: 1.4;
}


/* ----------------------------------------------------------
   Expanded Service Visit History
   ---------------------------------------------------------- */

.service-history-section {
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(23, 35, 63, .07);
}

.service-history-header {
    padding: 22px 24px 18px;
    border-bottom: 1px solid #e8edf5;
}

.service-history-header h2 {
    margin: 0 0 4px;
    color: #17233f;
}

.service-history-header p {
    margin: 0;
    color: #718096;
    font-size: 13px;
}

.service-visit-history-item {
    border-bottom: 1px solid #e8edf5;
}

.service-visit-history-item:last-child {
    border-bottom: 0;
}

.service-visit-history-item > summary {
    list-style: none;
}

.service-visit-history-item > summary::-webkit-details-marker {
    display: none;
}

.service-visit-summary {
    display: grid;
    grid-template-columns: 110px 1fr 110px 65px;
    gap: 16px;
    align-items: center;

    padding: 17px 22px;
    cursor: pointer;
}

.service-visit-summary:hover {
    background: #f8faff;
}

.service-visit-date {
    color: #5f6b7c;
    font-size: 13px;
    font-weight: 700;
}

.service-visit-main strong {
    display: block;
    color: #17233f;
    font-size: 14px;
}

.service-visit-main span {
    display: block;
    margin-top: 3px;
    color: #718096;
    font-size: 12px;
}

.service-visit-mileage {
    text-align: right;
    color: #17233f;
    font-size: 13px;
    font-weight: 700;
}

.service-visit-open {
    text-align: right;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
}

.service-visit-history-item[open] .service-visit-open {
    font-size: 0;
}

.service-visit-history-item[open] .service-visit-open::after {
    content: "Close ↑";
    font-size: 12px;
}

.service-visit-details {
    padding: 18px 22px 22px;
    border-top: 1px solid #eef2f7;
    background: #fafbfe;
}

.service-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.service-detail-grid > div {
    padding: 11px 12px;
    border-radius: 9px;
    background: #ffffff;
}

.service-detail-grid span,
.service-detail-block > span {
    display: block;
    margin-bottom: 4px;
    color: #718096;
    font-size: 11px;
    font-weight: 700;
}

.service-detail-grid strong {
    color: #17233f;
    font-size: 13px;
}

.service-detail-block {
    margin-top: 15px;
    padding: 13px 14px;
    border-radius: 9px;
    background: #ffffff;
}

.service-detail-block p {
    margin: 0;
    color: #465166;
    font-size: 13px;
    line-height: 1.5;
}

.work-performed-list {
    display: grid;
    gap: 5px;
}

.work-performed-item {
    color: #17233f;
    font-size: 13px;
}

.invoice-view-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
}

.invoice-view-link:hover {
    text-decoration: underline;
}

.service-invoice-name {
    margin-top: 12px;
    color: #718096;
    font-size: 11px;
}

@media (max-width: 700px) {

    .service-visit-summary {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .service-visit-mileage,
    .service-visit-open {
        text-align: left;
    }

    .service-detail-grid {
        grid-template-columns: 1fr;
    }
}



/* ----------------------------------------------------------
   Edit / Void Service Visits
   ---------------------------------------------------------- */

.service-record-admin-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e5eaf2;
}

.service-edit-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;

    padding: 10px 14px;
    margin-bottom: 12px;

    border-radius: 8px;

    background: #eaf2ff;
    color: #2563eb;

    text-align: center;
    text-decoration: none;
    font-weight: 700;
}

.service-void-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.service-void-form input {
    min-width: 0;
}

.service-void-btn {
    padding: 9px 13px;

    border: 0;
    border-radius: 8px;

    background: #fee2e2;
    color: #b91c1c;

    font-weight: 700;
    cursor: pointer;
}

.service-voided-box {
    margin-top: 16px;
    padding: 13px;

    border: 1px solid #fecaca;
    border-radius: 9px;

    background: #fff1f2;
    color: #991b1b;

    font-size: 12px;
}

.service-voided-box strong {
    display: block;
    margin-bottom: 6px;
}

.service-voided-summary {
    text-align: right;

    color: #b91c1c;
    font-size: 11px;
    font-weight: 800;

    background: #fee2e2;

    padding: 5px 8px;
    border-radius: 999px;
}

.service-edit-back {
    margin: 22px 0;
}

.service-edit-back a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
}

.service-edit-card {
    max-width: 760px;
    margin: 0 auto 40px;

    padding: 26px;

    background: #ffffff;
    border-radius: 15px;

    box-shadow:
        0 2px 12px rgba(23, 35, 63, .07);
}

.service-edit-heading {
    margin-bottom: 22px;
}

.service-edit-heading h1 {
    margin: 0;
    color: #17233f;
}

.service-edit-heading p {
    margin: 5px 0 0;
    color: #718096;
}

.existing-invoice-box {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 15px;

    margin: 16px 0;
    padding: 13px 14px;

    background: #f7f9fc;
    border-radius: 9px;
}

.existing-invoice-box strong,
.existing-invoice-box span {
    display: block;
}

.existing-invoice-box span {
    margin-top: 3px;
    color: #718096;
    font-size: 11px;
}

.existing-invoice-box a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 650px) {

    .service-void-form {
        grid-template-columns: 1fr;
    }

    .service-voided-summary {
        text-align: left;
        width: fit-content;
    }
}


/* ----------------------------------------------------------
   Retired Vehicles
   ---------------------------------------------------------- */

.vehicle-retirement-panel,
.retired-vehicle-card {
    background: #fff;
    border-radius: 15px;
    padding: 24px;
    margin: 22px 0;
    box-shadow: 0 2px 12px rgba(23, 35, 63, .07);
}

.vehicle-retirement-panel h2,
.retired-page-heading h1 {
    color: #17233f;
    margin-top: 0;
}

.vehicle-retirement-panel p,
.retired-page-heading p {
    color: #718096;
}

.retire-vehicle-btn {
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 700;
    cursor: pointer;
}

.retired-vehicle-list {
    display: grid;
}

.retired-vehicle-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 18px 4px;
    border-bottom: 1px solid #e8edf5;
}

.retired-vehicle-row:last-child {
    border-bottom: 0;
}

.retired-vehicle-row strong,
.retired-vehicle-row span,
.retired-vehicle-row small {
    display: block;
}

.retired-vehicle-row span,
.retired-vehicle-row small {
    margin-top: 3px;
    color: #718096;
}

.retired-vehicle-reason > span {
    font-size: 11px;
    font-weight: 700;
}

.retired-vehicle-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 750px) {
    .retired-vehicle-row {
        grid-template-columns: 1fr;
    }

    .retired-vehicle-actions {
        align-items: stretch;
        flex-direction: column;
    }
}



/* ----------------------------------------------------------
   Lytx Sync Status
   ---------------------------------------------------------- */

.lytx-page-heading {
    margin: 24px 0;
}

.lytx-page-heading h1 {
    margin-bottom: 4px;
    color: #17233f;
}

.lytx-page-heading p {
    margin: 0;
    color: #718096;
}

.lytx-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.lytx-summary-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 2px 12px rgba(23,35,63,.06);
}

.lytx-summary-card.warning {
    border-left-color: #f59e0b;
}

.lytx-summary-card strong {
    display: block;
    font-size: 28px;
    color: #17233f;
}

.lytx-summary-card span {
    display: block;
    margin-top: 4px;
    color: #718096;
    font-size: 12px;
}

.lytx-sync-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.lytx-sync-card,
.lytx-ledger-card {
    background: #fff;
    border-radius: 15px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(23,35,63,.07);
}

.lytx-sync-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.lytx-sync-title h2,
.lytx-ledger-card h2 {
    margin: 0;
    color: #17233f;
}

.lytx-sync-title p,
.lytx-ledger-card p {
    margin: 4px 0 0;
    color: #718096;
    font-size: 12px;
}

.sync-status {
    display: inline-block;
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.sync-status.success {
    background: #dcfce7;
    color: #15803d;
}

.sync-status.running {
    background: #dbeafe;
    color: #1d4ed8;
}

.sync-status.dry_run {
    background: #ede9fe;
    color: #6d28d9;
}

.sync-status.error {
    background: #fee2e2;
    color: #b91c1c;
}

.sync-status.never {
    background: #f1f5f9;
    color: #64748b;
}

.sync-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sync-metric-grid > div {
    background: #f7f9fc;
    border-radius: 9px;
    padding: 12px;
}

.sync-metric-grid span {
    display: block;
    color: #718096;
    font-size: 10px;
    margin-bottom: 4px;
}

.sync-metric-grid strong {
    display: block;
    color: #17233f;
    font-size: 20px;
}

.sync-metric-grid strong.small-value {
    font-size: 12px;
}

.sync-time {
    margin-top: 12px;
    color: #718096;
    font-size: 11px;
}

.sync-message {
    margin-top: 14px;
    padding: 10px;
    background: #eff6ff;
    border-radius: 8px;
    color: #1e40af;
    font-size: 11px;
}

.sync-error {
    margin-top: 10px;
    padding: 10px;
    background: #fff1f2;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 11px;
}

.lytx-ledger-card {
    margin-top: 18px;
}

@media (max-width: 1000px) {
    .lytx-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lytx-sync-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .lytx-summary-grid {
        grid-template-columns: 1fr;
    }

    .sync-metric-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Mobile Login Screen Lock
   Keeps Fleet Tracker login fitted to the iPhone viewport.
   ========================================================= */

.login-body {
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.login-box {
    box-sizing: border-box;
}

@media (max-width: 650px) {
    html {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.login-body {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        margin: 0;
        padding: 16px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .login-box {
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        padding: 26px 22px;
        box-sizing: border-box;
    }

    .login-box input,
    .login-box select,
    .login-box textarea {
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px;
    }

    .login-btn {
        box-sizing: border-box;
        max-width: 100%;
    }
}
