﻿:root {
    --app-height: 100vh;
    --font-ui: "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    --bg-top: #dcecff;
    --bg-bottom: #eff5fb;
    --panel: rgba(255, 255, 255, 0.84);
    --panel-strong: rgba(255, 255, 255, 0.94);
    --border: rgba(149, 175, 206, 0.32);
    --text: #12263f;
    --muted: #6a7b90;
    --accent: #3390ec;
    --accent-deep: #1c7dd9;
    --accent-soft: #eaf4ff;
    --success: #4aaf64;
    --warning: #f59f00;
    --danger: #e45f63;
    --shadow-lg: 0 22px 48px rgba(15, 42, 76, 0.18);
    --shadow-md: 0 12px 24px rgba(16, 48, 82, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* CIOT desktop dashboard */
html.ciot-font-large {
    font-size: 18px;
}

html.ciot-font-medium {
    font-size: 16px;
}

html.ciot-font-small {
    font-size: 14px;
}

.desktop-dashboard {
    --navy: #13233c;
    --blue: #2878d3;
    --blue-dark: #1b5fae;
    --blue-soft: #eaf3ff;
    --line: #dce5ef;
    --muted: #6f7f91;
    --surface: #ffffff;
    --page: #edf2f7;
    --green: #159b61;
    --orange: #e58a18;
    --red: #d34f57;
    --shadow: 0 14px 38px rgba(22, 46, 75, 0.16);
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    color: var(--navy);
    background: var(--page);
}

.desktop-dashboard > form {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.desktop-dashboard .app-header {
    height: 76px;
    display: grid;
    grid-template-columns: 245px minmax(650px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 0 22px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 18px rgba(28, 52, 80, 0.08);
    position: relative;
    z-index: 1000;
}

.desktop-dashboard .brand-block {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.desktop-dashboard .brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 900;
    background: linear-gradient(145deg, #3a92ee, #1258a4);
    box-shadow: 0 8px 18px rgba(32, 116, 207, 0.28);
}

.desktop-dashboard .brand-block strong,
.desktop-dashboard .brand-block small {
    display: block;
    white-space: nowrap;
}

.desktop-dashboard .brand-block strong {
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

.desktop-dashboard .brand-block small {
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 1px;
}

.desktop-dashboard .main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
}

.desktop-dashboard .nav-button {
    height: 38px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #4d6076;
    background: transparent;
    font-size: 0.89rem;
    font-weight: 700;
    white-space: nowrap;
}

.desktop-dashboard .nav-button.active {
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    box-shadow: 0 7px 16px rgba(36, 111, 195, 0.25);
}

.desktop-dashboard .nav-button:disabled {
    opacity: 0.78;
    cursor: not-allowed;
}

.desktop-dashboard .nav-button:not(:disabled):not(.active) {
    cursor: pointer;
}

.desktop-dashboard .nav-button:not(:disabled):not(.active):hover {
    color: var(--blue-dark);
    border-color: #b9d6f5;
    background: var(--blue-soft);
}

.desktop-dashboard .account-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.desktop-dashboard .account-name {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #52667c;
    font-weight: 700;
    white-space: nowrap;
}

.desktop-dashboard .logout-button,
.desktop-dashboard .icon-button {
    border: 0;
    cursor: pointer;
}

.desktop-dashboard .logout-button {
    height: 38px;
    padding: 0 15px;
    border-radius: 9px;
    color: var(--blue-dark);
    background: var(--blue-soft);
    font-weight: 800;
}

.desktop-dashboard .dashboard-main {
    height: calc(100% - 76px);
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
}

.desktop-dashboard .vehicle-panel,
.desktop-dashboard .map-panel {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.desktop-dashboard .vehicle-panel {
    display: flex;
    flex-direction: column;
}

.desktop-dashboard .panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 15px 9px;
}

.desktop-dashboard .eyebrow {
    display: block;
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.desktop-dashboard .panel-heading h1 {
    margin: 1px 0 0;
    font-size: 1.18rem;
}

.desktop-dashboard .icon-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--blue-dark);
    background: var(--blue-soft);
    font-size: 1.25rem;
    font-weight: 900;
}

.desktop-dashboard .icon-button.loading {
    animation: ciot-spin 0.8s linear infinite;
}

.desktop-dashboard .vehicle-filter-grid {
    display: grid;
    grid-template-columns: 42px 6.5em minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 8px;
    margin: 0 7px 8px;
    padding: 6px 9px 7px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7f9fc;
}

.desktop-dashboard .vehicle-filter-grid > :nth-child(3),
.desktop-dashboard .vehicle-filter-grid > :nth-child(6) {
    margin-left: -4px;
}

.desktop-dashboard .filter-icon-spacer {
    min-width: 0;
}

.desktop-dashboard .filter-sort {
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 900;
}

.desktop-dashboard .filter-sort.active {
    color: var(--blue-dark);
}

.desktop-dashboard .sort-arrow {
    display: inline-block;
    min-width: 0.8em;
    font-size: 0.66rem;
}

.desktop-dashboard .vehicle-filter-grid input {
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 2px 6px;
    border: 1px solid #bcc8d5;
    border-radius: 4px;
    outline: 0;
    background: #fff;
    color: var(--navy);
    font-size: 0.82rem;
}

.desktop-dashboard .vehicle-filter-grid input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(40, 120, 211, 0.12);
}

.desktop-dashboard .list-summary {
    display: flex;
    justify-content: space-between;
    padding: 0 14px 8px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.desktop-dashboard .list-summary b {
    color: var(--red);
}

.desktop-dashboard .countdown-button {
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
}

.desktop-dashboard .countdown-button.paused {
    color: var(--red);
    text-decoration: underline;
    text-decoration-style: dotted;
}

.desktop-dashboard .vehicle-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 7px 8px;
    scrollbar-width: thin;
}

.desktop-dashboard .vehicle-card {
    width: 100%;
    min-height: 55px;
    display: grid;
    grid-template-columns: 42px max-content minmax(0, 1fr);
    align-items: center;
    column-gap: 6px;
    margin-bottom: 5px;
    padding: 5px 9px 5px 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--navy);
    background: #f7f9fc;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.desktop-dashboard .vehicle-card-name {
    margin-left: 0;
}

.desktop-dashboard .vehicle-card:hover {
    transform: translateX(2px);
    border-color: #b9d6f5;
    background: #eef6ff;
}

.desktop-dashboard .vehicle-card.selected {
    border-color: #86baf0;
    background: #e9f4ff;
    box-shadow: inset 3px 0 var(--blue);
}

.desktop-dashboard .state-badge.moving {
    background: var(--green);
}

.desktop-dashboard .state-badge.parked {
    background: var(--orange);
}

.desktop-dashboard .state-badge.off {
    background: var(--red);
}

.desktop-dashboard .vehicle-card-icon {
    width: 40px;
    height: 40px;
    display: block;
    object-fit: contain;
    border-radius: 9px;
    background: #fff;
}

.desktop-dashboard .vehicle-card-number,
.desktop-dashboard .vehicle-card-name {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
}

.desktop-dashboard .vehicle-card-number {
    width: 6ch;
    min-width: 6ch;
    font-size: 0.92rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.desktop-dashboard .vehicle-card-name {
    width: 100%;
    text-align: left;
    color: #52667c;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
    white-space: normal;
}

.desktop-dashboard .loading-state {
    padding: 32px 16px;
    color: var(--muted);
    text-align: center;
    font-size: 0.86rem;
}

.desktop-dashboard .map-panel {
    position: relative;
}

.desktop-dashboard #map {
    width: 100%;
    height: 100%;
    background: #dfe8ef;
}

.desktop-dashboard .vehicle-detail {
    position: absolute;
    z-index: 700;
    top: 14px;
    left: 14px;
    width: min(320px, calc(100% - 28px));
    max-height: calc(100% - 70px);
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 38px rgba(18, 40, 65, 0.24);
    backdrop-filter: blur(12px);
}

.desktop-dashboard .detail-empty {
    display: none;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.desktop-dashboard .vehicle-detail.is-empty .detail-empty {
    display: block;
}

.desktop-dashboard .vehicle-detail.is-empty .detail-content {
    display: none;
}

.desktop-dashboard .detail-content {
    padding: 14px;
}

.desktop-dashboard .detail-topline {
    display: block;
}

.desktop-dashboard .state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 23px;
    padding: 0 9px;
    border-radius: 999px;
    color: #fff;
    background: #8998a8;
    font-size: 1.05rem;
    font-weight: 900;
}

.desktop-dashboard .detail-topline h2 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.15;
}

.desktop-dashboard .detail-meta-row {
    margin: 4px 0 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 1.18rem;
    font-weight: 700;
}

.desktop-dashboard #detailVersion {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #52667c;
    text-align: right;
    font-size: 0.92rem;
}

.desktop-dashboard .time-fresh {
    color: #159b61;
}

.desktop-dashboard .time-warning {
    color: #e58a18;
}

.desktop-dashboard .time-danger {
    color: #d34f57;
}

.desktop-dashboard .time-stale {
    color: #8998a8;
}

.desktop-dashboard .gps-time-live {
    color: #159b61;
}

.desktop-dashboard .gps-time-last {
    color: #0f172a;
}

.desktop-dashboard .gps-time-unfixed {
    color: #d34f57;
}

.desktop-dashboard .detail-address {
    margin-top: 7px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #764b0c;
    background: #fff6df;
    border: 1px solid #f6dfaa;
}

.desktop-dashboard .detail-address span {
    display: block;
    color: #a06d21;
    font-size: 1rem;
    font-weight: 900;
}

.desktop-dashboard .detail-address strong {
    display: block;
    margin-top: 2px;
    font-size: 1.18rem;
    line-height: 1.35;
}

.desktop-dashboard .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    margin: 9px 0 0;
}

.desktop-dashboard .detail-grid div {
    min-width: 0;
    display: grid;
    grid-template-columns: 6.2rem minmax(0, 1fr);
    align-items: baseline;
    gap: 7px;
    padding: 5px 8px;
    border-bottom: 1px solid #e7edf3;
}

.desktop-dashboard .detail-grid [hidden] {
    display: none !important;
}

.desktop-dashboard .detail-grid dt {
    color: var(--muted);
    font-size: 0.98rem;
    font-weight: 800;
}

.desktop-dashboard .detail-grid dd {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.desktop-dashboard .detail-state-row {
    display: grid;
    grid-template-columns: 6.2rem minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    margin-top: 4px;
    padding: 5px 8px;
}

.desktop-dashboard .detail-state-row > span {
    color: var(--muted);
    font-size: 0.98rem;
    font-weight: 800;
}

.desktop-dashboard .detail-state-row .state-badge {
    justify-self: start;
    font-size: 1.05rem;
}

.desktop-dashboard .map-status {
    position: absolute;
    z-index: 650;
    right: 14px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    color: #496078;
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 8px 24px rgba(18, 40, 65, 0.16);
    font-size: 0.72rem;
    font-weight: 800;
}

.desktop-dashboard .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(21, 155, 97, 0.15);
}

.desktop-dashboard .settings-dialog[hidden] {
    display: none;
}

.desktop-dashboard .settings-dialog {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(16, 35, 58, 0.42);
    backdrop-filter: blur(4px);
}

.desktop-dashboard .settings-dialog-card {
    width: min(430px, 100%);
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(15, 38, 66, 0.28);
}

.desktop-dashboard .settings-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.desktop-dashboard .settings-dialog-header h2 {
    margin: 2px 0 0;
    font-size: 1.35rem;
}

.desktop-dashboard .settings-close-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #52667c;
    background: #edf3f9;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.desktop-dashboard .font-size-options {
    display: grid;
    gap: 8px;
    margin: 18px 0 0;
    padding: 0;
    border: 0;
}

.desktop-dashboard .font-size-options legend {
    margin-bottom: 8px;
    color: #52667c;
    font-size: 0.9rem;
    font-weight: 900;
}

.desktop-dashboard .font-size-options label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    background: #f7f9fc;
    cursor: pointer;
}

.desktop-dashboard .font-size-options label:has(input:checked) {
    border-color: #86baf0;
    background: #e9f4ff;
    box-shadow: inset 3px 0 var(--blue);
}

.desktop-dashboard .font-size-options input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--blue);
}

.desktop-dashboard .font-size-options strong,
.desktop-dashboard .font-size-options small {
    display: block;
}

.desktop-dashboard .font-size-options strong {
    font-size: 1rem;
}

.desktop-dashboard .font-size-options small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
}

.desktop-dashboard .settings-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.desktop-dashboard .settings-secondary-button,
.desktop-dashboard .settings-primary-button {
    min-width: 88px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 900;
}

.desktop-dashboard .settings-secondary-button {
    color: #52667c;
    background: #edf3f9;
}

.desktop-dashboard .settings-primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    box-shadow: 0 7px 16px rgba(36, 111, 195, 0.25);
}

.desktop-dashboard .report-dialog[hidden] {
    display: none;
}

.desktop-dashboard .report-dialog {
    position: fixed;
    inset: 0;
    z-index: 4500;
    padding: 18px;
    background: rgba(16, 35, 58, 0.46);
    backdrop-filter: blur(4px);
}

.desktop-dashboard .report-dialog-card {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(15, 38, 66, 0.3);
}

.desktop-dashboard .report-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #edf2f7;
}

.desktop-dashboard .report-close-button {
    position: absolute;
    z-index: 2;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #52667c;
    background: rgba(237, 243, 249, 0.96);
    box-shadow: 0 6px 16px rgba(24, 49, 78, 0.16);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

html.ciot-font-medium .desktop-dashboard .app-header {
    height: 68px;
}

html.ciot-font-medium .desktop-dashboard .dashboard-main {
    height: calc(100% - 68px);
    gap: 8px;
    padding: 8px;
}

html.ciot-font-medium .desktop-dashboard .panel-heading {
    padding: 10px 12px 6px;
}

html.ciot-font-medium .desktop-dashboard .vehicle-filter-grid {
    row-gap: 5px;
    margin-bottom: 5px;
    padding-top: 4px;
    padding-bottom: 5px;
}

html.ciot-font-medium .desktop-dashboard .list-summary {
    padding-bottom: 5px;
}

html.ciot-font-medium .desktop-dashboard .vehicle-card {
    min-height: 48px;
    margin-bottom: 3px;
    padding-top: 3px;
    padding-bottom: 3px;
}

html.ciot-font-medium .desktop-dashboard .vehicle-card-icon {
    width: 36px;
    height: 36px;
}

html.ciot-font-medium .desktop-dashboard .detail-content {
    padding: 11px;
}

html.ciot-font-medium .desktop-dashboard .detail-grid {
    gap: 2px;
    margin-top: 6px;
}

html.ciot-font-medium .desktop-dashboard .detail-grid div,
html.ciot-font-medium .desktop-dashboard .detail-state-row {
    padding-top: 3px;
    padding-bottom: 3px;
}

html.ciot-font-medium .desktop-dashboard .detail-address {
    margin-top: 4px;
    padding: 6px 8px;
}

html.ciot-font-small .desktop-dashboard .app-header {
    height: 62px;
}

html.ciot-font-small .desktop-dashboard .dashboard-main {
    height: calc(100% - 62px);
    gap: 6px;
    padding: 6px;
}

html.ciot-font-small .desktop-dashboard .panel-heading {
    padding: 7px 10px 4px;
}

html.ciot-font-small .desktop-dashboard .vehicle-filter-grid {
    row-gap: 3px;
    margin-bottom: 3px;
    padding-top: 3px;
    padding-bottom: 3px;
}

html.ciot-font-small .desktop-dashboard .list-summary {
    padding-bottom: 3px;
}

html.ciot-font-small .desktop-dashboard .vehicle-card {
    min-height: 42px;
    margin-bottom: 2px;
    padding-top: 2px;
    padding-bottom: 2px;
}

html.ciot-font-small .desktop-dashboard .vehicle-card-number {
    font-size: 1.38rem;
}

html.ciot-font-small .desktop-dashboard .vehicle-card-name {
    font-size: 1.26rem;
}

html.ciot-font-small .desktop-dashboard .vehicle-card-icon {
    width: 32px;
    height: 32px;
}

html.ciot-font-small .desktop-dashboard .detail-content {
    padding: 8px;
}

html.ciot-font-small .desktop-dashboard .detail-grid {
    gap: 0;
    margin-top: 4px;
}

html.ciot-font-small .desktop-dashboard .detail-grid div,
html.ciot-font-small .desktop-dashboard .detail-state-row {
    padding-top: 2px;
    padding-bottom: 2px;
}

html.ciot-font-small .desktop-dashboard .detail-address {
    margin-top: 3px;
    padding: 5px 7px;
}

@keyframes ciot-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1250px) {
    .desktop-dashboard .app-header {
        grid-template-columns: 210px minmax(580px, 1fr) auto;
        gap: 8px;
        padding: 0 12px;
    }

    .desktop-dashboard .main-nav {
        gap: 3px;
    }

    .desktop-dashboard .nav-button {
        padding: 0 8px;
        font-size: 0.8rem;
    }

    .desktop-dashboard .dashboard-main {
        grid-template-columns: 285px minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .desktop-dashboard::before {
        content: "此畫面供電腦瀏覽器使用";
        position: fixed;
        inset: 0;
        z-index: 99999;
        display: grid;
        place-items: center;
        background: #edf2f7;
        color: var(--navy);
        font-weight: 800;
    }
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    min-height: var(--app-height);
    overflow-x: hidden;
    margin: 0;
    font-family: var(--font-ui);
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(102, 187, 255, 0.22), transparent 26rem),
        radial-gradient(circle at left bottom, rgba(77, 179, 129, 0.16), transparent 28rem),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body {
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 85%);
}

button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell,
.chat-list-page,
.chat-thread-page,
.page-login {
    height: 100%;
    min-height: var(--app-height);
}

.page-main,
.chat-list-page,
.chat-thread-page {
    overflow: hidden;
}

.page-main > form,
.chat-list-page > form,
.chat-thread-page > form,
.page-login > form {
    height: 100%;
}

.page-main > form,
.chat-list-page > form,
.chat-thread-page > form {
    display: flex;
}

.page-login > form {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.surface-shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.page-main {
    overflow: hidden;
    padding: 16px;
}

.shell-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(var(--app-height) - 32px);
}

.shell-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 18px 22px;
    background: linear-gradient(135deg, rgba(51, 144, 236, 0.16), rgba(255, 255, 255, 0.8));
    border-bottom: 1px solid var(--border);
}

.shell-header-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 16px 6px;
}

.shell-header-compact .shell-title {
    line-height: 1.02;
}

.shell-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shell-title {
    font-size: clamp(1.15rem, 1rem + 0.8vw, 1.75rem);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.shell-subtitle,
.shell-resolution,
.panel-hint,
.chat-handle,
.chat-time,
.message-meta,
.friend-subtitle,
.login-note,
.empty-state-text,
.topbar-meta {
    color: var(--muted);
}

.shell-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 0;
}

.shell-user-name {
    font-weight: 700;
    color: var(--accent-deep);
    word-break: break-word;
}

.shell-logout,
.primary-button,
.ghost-button,
.secondary-button {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.shell-logout,
.primary-button {
    padding: 0.8rem 1.3rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 12px 22px rgba(51, 144, 236, 0.28);
}

.shell-logout:hover,
.primary-button:hover,
.ghost-button:hover,
.secondary-button:hover,
.chat-list-item:hover,
.avatar-button:hover,
.back-button:hover {
    transform: translateY(-1px);
}

.shell-frame {
    flex: 1;
    min-height: 0;
    padding: 14px;
    display: flex;
}

.shell-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.64);
}

.chat-list-page,
.chat-thread-page {
    padding: 16px;
}

.chat-panel,
.thread-panel {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.chat-list-page .chat-panel {
    background: linear-gradient(180deg, rgba(240, 252, 242, 0.98), rgba(232, 247, 235, 0.96));
}

.list-topbar,
.thread-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
    border-bottom: 1px solid var(--border);
}

.topbar-main,
.friend-meta {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.topbar-title,
.friend-name,
.login-brand {
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.45rem);
    font-weight: 800;
}

.topbar-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.search-shell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(100%, 280px);
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: #f6faff;
    border: 1px solid rgba(51, 144, 236, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.search-shell span,
.countdown-label {
    flex: 0 0 auto;
}

.search-shell input,
.composer-input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
}

.search-shell input::placeholder,
.composer-input::placeholder {
    color: #8ea0b3;
}

.ghost-button,
.secondary-button,
.back-button {
    padding: 0.72rem 1.05rem;
    background: #edf4fc;
    color: var(--accent-deep);
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(56, 118, 171, 0.12);
}

.back-button {
    border-radius: 999px;
    white-space: nowrap;
}

.meta-pill,
.countdown-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.9rem;
    min-height: 2.6rem;
    border-radius: 999px;
    background: #f5f8fd;
    border: 1px solid rgba(18, 38, 63, 0.08);
    font-weight: 700;
}

.countdown-pill {
    color: var(--danger);
}

.chat-list-scroll,
.thread-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-list-scroll {
    display: flex;
    padding: 14px;
    background:
        radial-gradient(circle at top left, rgba(105, 184, 127, 0.14), transparent 18rem),
        linear-gradient(180deg, rgba(238, 249, 240, 0.96), rgba(227, 244, 230, 0.92));
}

.chat-list {
    flex: 1;
    display: grid;
    gap: 12px;
    width: 100%;
    min-height: 100%;
    align-content: start;
    grid-auto-rows: max-content;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(51, 144, 236, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 248, 255, 0.92));
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.chat-list-item:hover {
    border-color: rgba(51, 144, 236, 0.3);
    box-shadow: 0 16px 26px rgba(20, 66, 120, 0.16);
}

.avatar-button {
    width: 58px;
    height: 58px;
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(51, 144, 236, 0.18);
    background: #fff;
    flex: 0 0 auto;
    box-shadow: 0 8px 18px rgba(26, 66, 117, 0.14);
}

.chat-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-list-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
}

.chat-row-bottom {
    align-items: flex-end;
}

.chat-name-wrap {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-name {
    font-size: 1rem;
    font-weight: 800;
}

.chat-handle {
    font-size: 0.84rem;
}

.chat-time {
    font-weight: 700;
}

.chat-preview {
    min-width: 0;
    flex: 1;
    font-size: 0.94rem;
    line-height: 1.45;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview.incoming {
    color: #516274;
}

.chat-preview.outgoing {
    color: var(--accent-deep);
}

.chat-preview.outgoing::before {
    content: "\6211\FF1A\0020";
    font-weight: 700;
}

.chat-badge {
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(51, 144, 236, 0.22);
}

.chat-badge.muted {
    background: #e8f1fb;
    color: var(--accent-deep);
    box-shadow: none;
}

.empty-state {
    margin: 14px;
    padding: 40px 24px;
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(51, 144, 236, 0.24);
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.thread-scroll {
    display: block;
    padding: 18px 14px 10px;
    background:
        radial-gradient(circle at top left, rgba(51, 144, 236, 0.08), transparent 18rem),
        linear-gradient(180deg, rgba(240, 247, 255, 0.98), rgba(236, 245, 252, 0.96));
}

.day-divider {
    display: flex;
    justify-content: center;
    margin: 12px 0 16px;
}

.day-divider span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(18, 38, 63, 0.08);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.message-row {
    display: flex;
    margin-bottom: 12px;
}

.message-row.incoming {
    justify-content: flex-start;
}

.message-row.outgoing {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(100%, 36rem);
    padding: 0.9rem 1rem 0.7rem;
    border-radius: 22px;
    box-shadow: 0 12px 24px rgba(18, 44, 76, 0.1);
    border: 1px solid rgba(18, 38, 63, 0.06);
}

.message-row.incoming .message-bubble {
    background: #fff;
    border-top-left-radius: 8px;
}

.message-row.outgoing .message-bubble {
    background: linear-gradient(180deg, #e2f4ff, #d2ebff);
    border-top-right-radius: 8px;
}

.message-text {
    font-size: 1rem;
    line-height: 1.58;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-meta {
    margin-top: 8px;
    text-align: right;
    font-size: 0.78rem;
    font-weight: 700;
}

.thread-composer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
}

.composer-shell {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px;
    border-radius: 24px;
    background: #f6fbff;
    border: 1px solid rgba(51, 144, 236, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.composer-input {
    min-height: 56px;
    max-height: 160px;
    resize: none;
    padding: 8px 10px;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: min(100%, 460px);
    padding: 34px 30px 28px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.login-brand {
    margin-bottom: 8px;
}

.login-note {
    margin-bottom: 24px;
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 14px;
}

.form-label {
    display: grid;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--muted);
}

.form-control {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(51, 144, 236, 0.18);
    background: #f7fbff;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.search-shell:focus-within,
.composer-shell:focus-within {
    border-color: rgba(51, 144, 236, 0.45);
    box-shadow: 0 0 0 4px rgba(51, 144, 236, 0.12);
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.error-msg {
    min-height: 1.25rem;
    color: var(--danger);
    font-weight: 700;
}

@media (max-width: 900px) {
    .shell-header {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand logout"
            "user logout";
        align-items: start;
        gap: 10px 12px;
    }

    .shell-brand {
        grid-area: brand;
    }

    .shell-user {
        grid-area: user;
        align-items: flex-start;
    }

    .shell-logout {
        grid-area: logout;
        align-self: start;
    }

    .topbar-tools {
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .page-main,
    .chat-list-page,
    .chat-thread-page,
    .page-login {
        padding: 2px;
    }

    .surface-shell,
    .chat-panel,
    .thread-panel {
        min-height: 0;
        height: 100%;
        border-radius: 12px;
        border-width: 0;
        box-shadow: none;
    }

    .shell-header,
    .list-topbar,
    .thread-header,
    .thread-composer {
        padding: 7px 6px 6px;
    }

    .shell-header {
        gap: 8px 10px;
    }

    .shell-header-compact {
        gap: 6px 8px;
        padding: 4px 6px 3px;
    }

    .shell-frame {
        padding: 6px;
    }

    .shell-iframe {
        border-radius: 16px;
    }

    .shell-title {
        font-size: 1.15rem;
    }

    .shell-user-name {
        font-size: 1rem;
    }

    .shell-resolution {
        display: none;
    }

    .shell-logout {
        padding: 0.5rem 0.82rem;
        font-size: 0.88rem;
        line-height: 1;
        box-shadow: 0 8px 16px rgba(51, 144, 236, 0.22);
    }

    .chat-list-scroll,
    .thread-scroll {
        padding-left: 2px;
        padding-right: 2px;
        overflow-x: hidden;
    }

    .topbar-tools,
    .composer-shell {
        width: 100%;
    }

    .list-topbar {
        gap: 4px;
        padding: 6px 4px 5px;
    }

    .topbar-main {
        display: flex;
        flex: 0 1 auto;
        min-width: 0;
    }

    .topbar-title {
        font-size: 0.98rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-tools {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
        margin-left: 6px;
        flex: 1 1 auto;
        min-width: 0;
    }

    .search-shell {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        padding: 0.38rem 0.6rem;
        gap: 6px;
        border-radius: 18px;
    }

    .search-shell span {
        font-size: 0.84rem;
    }

    .search-shell input {
        font-size: 0.82rem;
    }

    .ghost-button,
    .meta-pill,
    .countdown-pill {
        flex: 0 0 auto;
        width: 2.15rem;
        min-width: 2.15rem;
        height: 2.15rem;
        min-height: 2.15rem;
        padding: 0;
        font-size: 0.82rem;
        box-shadow: none;
    }

    .ghost-button {
        font-size: 0.94rem;
        line-height: 1;
    }

    .meta-pill,
    .countdown-pill,
    .ghost-button {
        border-radius: 999px;
    }

    .countdown-label {
        display: none;
    }

    .countdown-pill #lblCountdown {
        margin-left: 0 !important;
    }

    .chat-list-scroll {
        padding: 2px;
    }

    .chat-list {
        gap: 8px;
        overflow-x: hidden;
    }

    .chat-list-item {
        gap: 8px;
        padding: 10px;
        overflow: hidden;
    }

    .avatar-button {
        width: 46px;
        height: 46px;
    }

    .chat-list-copy {
        gap: 4px;
    }

    .chat-row {
        gap: 6px;
        align-items: flex-start;
    }

    .chat-name {
        font-size: 1.35rem;
        font-weight: 900;
    }

    .chat-time {
        flex: 0 0 4.3rem;
        max-width: 4.3rem;
        font-size: 0.9rem;
        font-weight: 800;
        line-height: 1.15;
        text-align: right;
        white-space: normal;
    }

    .chat-preview {
        font-size: 1.2rem;
        font-weight: 800;
    }

    .chat-badge {
        min-width: 1.55rem;
        height: 1.55rem;
        font-size: 0.72rem;
    }

    .composer-shell {
        flex-direction: column;
        align-items: stretch;
    }

    .composer-actions {
        justify-content: flex-end;
    }

    .message-bubble {
        max-width: 92%;
    }

    .thread-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        width: 100%;
    }

    .thread-header .friend-meta {
        min-width: 0;
    }

    .thread-header .friend-name {
        font-size: 1.05rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        writing-mode: horizontal-tb;
        word-break: keep-all;
    }

    .thread-header .topbar-tools {
        width: auto;
        margin-left: 0;
        justify-content: flex-end;
        justify-self: end;
    }

    .thread-header .meta-pill {
        width: auto;
        min-width: 3.55rem;
        height: 2.05rem;
        min-height: 2.05rem;
        padding: 0 0.6rem;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .back-button {
        padding: 0.5rem 0.78rem;
        font-size: 0.88rem;
        line-height: 1;
    }

    .thread-scroll {
        padding: 10px 8px 8px;
    }

    .thread-composer {
        padding: 8px;
    }

    .thread-panel .composer-shell {
        flex-direction: row;
        align-items: flex-end;
        gap: 8px;
        padding: 8px;
        border-radius: 18px;
    }

    .thread-panel .composer-input {
        min-height: 44px;
        max-height: 132px;
        font-size: 0.95rem;
        padding: 6px 8px;
    }

    .thread-panel .composer-actions {
        flex: 0 0 auto;
        justify-content: flex-end;
    }

    .thread-panel .primary-button {
        min-width: 4.2rem;
        padding: 0.68rem 0.95rem;
        font-size: 0.92rem;
        box-shadow: 0 8px 16px rgba(51, 144, 236, 0.2);
    }
}


/* EZFind vehicle list */
.car-list {
    flex: 1;
    display: grid;
    gap: 12px;
    width: 100%;
    min-height: 100%;
    align-content: start;
    grid-auto-rows: max-content;
}

.car-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(51, 144, 236, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 248, 255, 0.92));
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.car-card:hover {
    border-color: rgba(51, 144, 236, 0.3);
    box-shadow: 0 16px 26px rgba(20, 66, 120, 0.16);
}

.car-avatar-button {
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid rgba(51, 144, 236, 0.18);
    background: #fff;
    flex: 0 0 auto;
    box-shadow: 0 8px 18px rgba(26, 66, 117, 0.14);
}

.car-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: rgba(255, 255, 255, 0.9);
}

.car-card-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.car-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    min-width: 0;
}

.car-name-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.car-name {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
}

.car-number {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.2;
    word-break: break-all;
}

.car-time {
    min-width: 6.2rem;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: right;
    color: var(--muted);
}

.car-time.fresh {
    color: var(--success);
}

.car-time.alert {
    color: var(--danger);
}

.car-time.idle {
    color: var(--accent-deep);
}

.car-preview {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.28;
    color: #516274;
    word-break: break-word;
}

.preview-inline {
    display: inline-block;
    white-space: nowrap;
}

.car-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.38rem 0.68rem;
    border-radius: 999px;
    background: #edf4fc;
    color: var(--accent-deep);
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(56, 118, 171, 0.12);
}

.car-address {
    min-height: 1.45rem;
    padding: 0.02rem 0.1rem 0;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.28;
    color: #73511f;
    word-break: break-word;
}

.car-address-loading {
    color: #7f8ea1;
}

.car-address-error {
    color: #c14957;
}

.car-address-empty {
    color: #8ea0b3;
}

@media (max-width: 640px) {
    .car-list {
        gap: 8px;
        overflow-x: hidden;
    }

    .car-card {
        gap: 8px;
        padding: 8px;
        overflow: hidden;
        border-radius: 14px;
    }

    .car-avatar-button {
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }

    .car-card-copy {
        gap: 4px;
    }

    .car-row {
        grid-template-columns: minmax(0, 1fr) 5.35rem;
        gap: 6px;
    }

    .car-name {
        font-size: 0.98rem;
    }

    .car-number,
    .car-time {
        font-size: 0.76rem;
    }

    .car-time {
        min-width: 5.35rem;
        padding-right: 0.2rem;
        box-sizing: border-box;
        letter-spacing: -0.02em;
        white-space: normal;
    }

    .car-preview {
        font-size: 0.84rem;
        display: block;
        line-height: 1.22;
    }

    .car-stat-row {
        gap: 4px;
    }

    .stat-chip {
        min-height: 1.7rem;
        padding: 0.28rem 0.5rem;
        font-size: 0.7rem;
        box-shadow: none;
    }

    .car-address {
        min-height: 1.35rem;
        padding-top: 0;
        font-size: 0.84rem;
        line-height: 1.22;
    }
}

/* Senior-friendly accessibility adjustments */
html {
    font-size: 18px;
}

body {
    line-height: 1.6;
}

.shell-title {
    font-size: clamp(1.55rem, 1.15rem + 1.1vw, 2rem);
}

.shell-subtitle,
.shell-resolution,
.topbar-meta,
.login-note,
.form-label {
    font-size: 1rem;
}

.shell-user-name,
.shell-logout,
.primary-button,
.ghost-button,
.secondary-button,
.back-button,
.search-shell,
.search-shell input,
.meta-pill,
.countdown-pill,
.car-name,
.car-preview,
.form-control,
.error-msg {
    font-size: 1.02rem;
}

.topbar-title,
.login-brand {
    font-size: clamp(1.35rem, 1.05rem + 0.7vw, 1.7rem);
}

.car-avatar-button {
    width: 72px;
    height: 72px;
}

.car-number,
.car-time,
.stat-chip {
    font-size: 0.9rem;
}

.stat-chip,
.meta-pill,
.countdown-pill {
    min-height: 2.3rem;
}

.search-shell,
.form-control {
    min-height: 3rem;
}

.login-card {
    width: min(100%, 520px);
}

.login-row {
    font-size: 1rem;
    gap: 10px;
}

.login-row input[type="checkbox"] {
    transform: scale(1.25);
    margin-right: 10px;
}

.detail-page {
    min-height: var(--app-height);
    padding: 18px;
}

.detail-page > form {
    width: 100%;
}

.detail-panel {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    backdrop-filter: blur(18px);
}

.detail-header,
.detail-body {
    padding: 22px 24px;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
    border-bottom: 1px solid var(--border);
}

.detail-title-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.detail-title {
    font-size: clamp(1.45rem, 1.1rem + 0.9vw, 2rem);
    font-weight: 800;
    line-height: 1.3;
    word-break: break-word;
}

.detail-subtitle {
    color: var(--muted);
    font-size: 1rem;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-button {
    min-height: 3rem;
    min-width: 7.5rem;
    padding: 0.8rem 1.35rem;
}

.detail-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-card {
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(51, 144, 236, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 248, 255, 0.94));
    box-shadow: var(--shadow-md);
}

.detail-info-grid,
.field-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-pill {
    min-height: 3.25rem;
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: #edf4fc;
    color: var(--accent-deep);
    font-weight: 800;
    line-height: 1.5;
}

.address-banner {
    padding: 1rem 1.15rem;
    border-radius: 18px;
    background: rgba(242, 160, 0, 0.1);
    border: 1px solid rgba(245, 159, 0, 0.18);
    color: #8a5200;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.6;
}

.detail-map {
    width: 100%;
    height: 62vh;
    min-height: 380px;
    border-radius: 22px;
    overflow: hidden;
}

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

.field-label {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 800;
}

.field-control {
    width: 100%;
    min-height: 3rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(51, 144, 236, 0.18);
    background: #f7fbff;
    color: var(--text);
    font: inherit;
    outline: none;
}

.field-control:focus {
    border-color: rgba(51, 144, 236, 0.45);
    box-shadow: 0 0 0 4px rgba(51, 144, 236, 0.12);
}

.field-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-note,
.info-text {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.data-table-shell {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(51, 144, 236, 0.12);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-md);
}

.trajectory-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

.trajectory-grid th,
.trajectory-grid td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(18, 38, 63, 0.08);
    text-align: left;
    font-size: 0.98rem;
}

.trajectory-grid th {
    background: #edf4fc;
    color: var(--accent-deep);
    font-weight: 800;
    white-space: nowrap;
}

.trajectory-grid tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.trajectory-grid tbody tr:hover td,
.trajectory-grid tbody tr.selected-row td {
    background: rgba(51, 144, 236, 0.08);
}

.trajectory-grid th:nth-child(6),
.trajectory-grid td:nth-child(6) {
    min-width: 18rem;
    max-width: 28rem;
    word-break: break-word;
}

.utility-message {
    margin: 0;
}

@media (max-width: 640px) {
    html {
        font-size: 17px;
    }

    .page-main,
    .chat-list-page,
    .chat-thread-page,
    .detail-page {
        padding: 2px;
    }

    .detail-header,
    .detail-body {
        padding: 16px;
    }

    .detail-map {
        height: 48vh;
        min-height: 300px;
    }

    .field-actions,
    .detail-actions {
        width: 100%;
        justify-content: stretch;
    }

    .field-actions .detail-button,
    .detail-actions .detail-button,
    .detail-actions .meta-pill,
    .detail-actions .countdown-pill {
        width: 100%;
    }

    .car-avatar-button {
        width: 58px;
        height: 58px;
    }

    .car-number,
    .car-time,
    .stat-chip,
    .trajectory-grid th,
    .trajectory-grid td {
        font-size: 0.88rem;
    }

    .car-preview,
    .car-address {
        font-size: 0.88rem;
    }

    .compact-mobile-map.detail-page {
        padding: 4px;
    }

    .compact-mobile-map .detail-panel {
        border-radius: 18px;
    }

    .compact-mobile-map .detail-header {
        padding: 14px 12px 10px;
    }

    .compact-mobile-map .compact-map-body {
        padding: 10px 8px 12px;
        gap: 10px;
    }

    .compact-mobile-map .map-card-tight {
        padding: 4px;
    }

    .compact-mobile-map .detail-map {
        border-radius: 16px;
    }

    .compact-mobile-map .address-banner {
        padding: 0.8rem 0.9rem;
    }

    .compact-mobile-map .trajectory-grid {
        min-width: 820px;
    }
}
