﻿: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;
}

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;
    }
}
