:root {
    --brand: #0b67b2;
    --brand-dark: #064b86;
    --accent: #ef5350;
    --accent-dark: #d94340;
    --ink: #18293a;
    --muted: #687887;
    --line: #9aa8b3;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f4f7f9;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.account-shell { min-height: 100vh; }
.account-app-bar {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    left: 0;
    height: calc(64px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    box-shadow: 0 2px 14px rgba(3, 42, 76, .2);
    font-family: Verdana, "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
    font-size: 20px;
    text-align: center;
}
.app-bar-back {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.1);
}
.app-bar-back svg {
    width: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.app-bar-options {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
}
.app-bar-options svg { width: 24px; fill: currentColor; }
.app-bar-menu,
.app-bar-add {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
}
.app-bar-menu svg,
.app-bar-add svg {
    width: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-drawer-backdrop {
    position: fixed;
    z-index: 39;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    background: rgba(11,28,42,.48);
    transition: opacity .22s ease, visibility .22s ease;
}
.my-navigation-drawer {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(82vw, 320px);
    overflow-y: auto;
    background: #fff;
    box-shadow: 8px 0 30px rgba(15,38,55,.2);
    transform: translateX(-105%);
    transition: transform .24s ease;
}
.my-drawer-open { overflow: hidden; }
.my-drawer-open .my-drawer-backdrop { visibility: visible; opacity: 1; }
.my-drawer-open .my-navigation-drawer { transform: translateX(0); }
.my-drawer-header {
    min-height: calc(132px + env(safe-area-inset-top));
    padding: calc(20px + env(safe-area-inset-top)) 20px 18px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}
.my-drawer-header img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
}
.my-drawer-avatar {
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 50%;
    flex: none;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: rgba(255,255,255,.95);
}
.my-drawer-avatar svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-drawer-header div { min-width: 0; }
.my-drawer-header strong,
.my-drawer-header div span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-drawer-header strong { font-size: 1.03rem; }
.my-drawer-header div span { margin-top: 4px; color: rgba(255,255,255,.82); font-size: .75rem; }
.my-drawer-links { padding: 8px 0 calc(18px + env(safe-area-inset-bottom)); }
.my-drawer-links a,
.my-drawer-links button {
    width: 100%;
    min-height: 48px;
    padding: 8px 20px;
    border: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #2e4354;
    background: transparent;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.my-drawer-links a.active { color: var(--brand); background: #e7edf1; }
.my-drawer-links a:hover,
.my-drawer-links button:hover { background: #f0f4f7; }
.my-drawer-links svg {
    width: 22px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-drawer-links hr { margin: 7px 0; border: 0; border-top: 1px solid #e1e7eb; }
.my-drawer-links form { margin: 0; }
.my-groups-page {
    min-height: 100vh;
    padding: calc(78px + env(safe-area-inset-top)) 10px calc(24px + env(safe-area-inset-bottom));
    background: #f5f8fa;
}
.my-groups-list {
    width: 100%;
    margin: 0 auto;
    display: grid;
    gap: 10px;
}
.my-group-card {
    border: 1px solid #dce5ea;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 3px 12px rgba(30,57,77,.06);
}
.my-group-card summary {
    min-height: 70px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 46px minmax(0,1fr) 22px;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}
.my-group-card summary::-webkit-details-marker { display: none; }
.my-group-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #e9f3fa;
}
.my-group-card-icon svg,
.my-group-chevron {
    width: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-group-card summary > span:nth-child(2) { min-width: 0; }
.my-group-card summary strong,
.my-group-card summary small { display: block; }
.my-group-card summary strong { overflow: hidden; font-size: .92rem; text-overflow: ellipsis; white-space: nowrap; }
.my-group-card summary small { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.my-group-chevron { color: #81919d; transition: transform .2s ease; }
.my-group-card[open] .my-group-chevron { transform: rotate(90deg); }
.my-group-devices {
    padding: 8px;
    border-top: 1px solid #e1e7eb;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    background: #f1f5f7;
}
.my-group-card-header {
    min-height: 70px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 46px minmax(0,1fr) 46px;
    align-items: center;
    gap: 12px;
}
.my-group-card-header > a {
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}
.my-group-card-header > a strong,
.my-group-card-header > a small { display: block; }
.my-group-card-header > a strong { overflow: hidden; font-size: .92rem; text-overflow: ellipsis; white-space: nowrap; }
.my-group-card-header > a small { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.my-group-map-chevron {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(11,103,178,.2);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #e8f3fa;
    box-shadow: 0 2px 6px rgba(11,103,178,.12);
    cursor: pointer;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.my-group-map-chevron:hover {
    color: var(--brand);
    background: #dceef9;
    box-shadow: 0 3px 8px rgba(11,103,178,.16);
}
.my-group-card:not(.open) .my-group-devices { display: none; }
.my-group-card.open .my-group-chevron { transform: rotate(180deg); }
.my-group-card.open .my-group-map-chevron { color: var(--brand); background: #dceef9; }
.my-group-device { border-bottom: 1px solid #e2e8ec; }
.my-group-device:last-child { border-bottom: 0; }
.my-group-device > a {
    min-height: 82px;
    padding: 8px 11px;
    display: grid;
    grid-template-columns: 66px minmax(0,1fr) 30px;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}
.my-group-device-photo { width: 66px; height: 66px; border-radius: 5px; object-fit: cover; background: #eaf0f3; }
.my-group-device-details { min-width: 0; }
.my-group-device-details > span:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.my-group-device-details strong { overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.my-group-device-details time { flex: none; color: var(--muted); font-size: .58rem; }
.my-group-device-details > small { margin-top: 3px; display: block; color: var(--muted); font-size: .62rem; }
.my-group-device-location {
    min-width: 0;
    margin-top: 7px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.my-group-device-location img { width: 19px; height: 19px; object-fit: contain; }
.my-group-device-location b { overflow: hidden; color: #405565; font-size: .68rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.my-group-device-battery { width: 22px; height: 22px; object-fit: contain; }
.my-group-empty { margin: 0; padding: 24px 15px; color: var(--muted); text-align: center; font-size: .75rem; }
.my-group-devices .my-group-device-card {
    min-height: 96px;
    padding: 7px;
    grid-template-columns: 78px minmax(0, 1fr) 24px;
    gap: 7px;
    border: 1px solid #d9e2e8;
    border-radius: 7px;
    cursor: pointer;
}
.my-group-device-card .my-device-photo { gap: 2px; }
.my-group-device-card .my-device-photo img {
    min-height: 64px;
    height: 64px;
}
.my-group-device-card .my-device-photo span { font-size: .62rem; }
.my-group-device-card .my-device-title strong { font-size: .82rem; }
.my-group-device-card .my-device-title time { font-size: .58rem; }
.my-group-device-card .my-device-location {
    min-height: 20px;
    font-size: .68rem;
}
.my-group-device-card .movement-marker { width: 17px; height: 17px; }
.my-group-device-card .my-device-status { min-height: 23px; }
.my-group-device-card .my-device-status a,
.my-group-device-card .my-device-status span {
    min-height: 23px;
    padding: 2px 5px;
}
.my-group-device-card .my-device-status .battery-status img { width: 17px; height: 17px; }
.my-group-device-chevron {
    width: 21px;
    margin: auto;
    fill: none;
    stroke: #8a99a5;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-group-map-wrap {
    position: fixed;
    inset: calc(64px + env(safe-area-inset-top)) 0 0;
    background: #dce5ea;
}
#myGroupMap { width: 100%; height: 100%; }
.my-group-map-count {
    position: absolute;
    z-index: 4;
    top: 12px;
    left: 12px;
    padding: 7px 11px;
    border-radius: 16px;
    color: #304b5d;
    background: rgba(255,255,255,.94);
    box-shadow: 0 2px 9px rgba(20,43,59,.25);
    font-size: .7rem;
    font-weight: 700;
}
.my-group-selected-card {
    position: absolute;
    z-index: 5;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 12px;
    min-height: 82px;
    padding: 9px 11px;
    border-radius: 10px;
    display: grid;
    grid-template-columns: 64px minmax(0,1fr) 22px;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 3px 15px rgba(14,36,52,.38);
    text-decoration: none;
}
.my-group-selected-card[hidden] { display: none; }
.my-group-selected-card > img { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; background: #edf2f5; }
.my-group-selected-card > span { min-width: 0; }
.my-group-selected-card strong,
.my-group-selected-card b,
.my-group-selected-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-group-selected-card strong { font-size: .9rem; }
.my-group-selected-card b { margin-top: 5px; color: #405767; font-size: .7rem; }
.my-group-selected-card small { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.my-group-selected-card > svg {
    width: 21px;
    fill: none;
    stroke: #8797a3;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
@media (min-width: 900px) {
    .my-group-map-wrap { left: 50%; width: min(100%, 1180px); transform: translateX(-50%); }
    .my-group-selected-card { right: auto; width: 430px; }
}
@media (max-width: 900px) {
    .my-group-devices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
    .my-group-devices { grid-template-columns: 1fr; }
}

.login-page {
    min-height: 100vh;
    padding: calc(94px + env(safe-area-inset-top)) 24px 38px;
    background: linear-gradient(180deg, #f9fbfc 0%, #eef4f7 100%);
}
.login-card { width: min(100%, 480px); margin: 0 auto; }
.login-brand { margin: 0 0 28px; text-align: center; }
.login-brand img { width: 88px; height: 88px; object-fit: contain; }
.login-brand p { margin: 7px 0 0; color: var(--muted); font-size: .9rem; font-weight: 650; }
.form-error {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid #e89a98;
    border-radius: 8px;
    color: #a52d2a;
    background: #fff3f2;
    font-size: .86rem;
    line-height: 1.4;
}
.form-success {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid #9ad1b9;
    border-radius: 8px;
    color: #176b48;
    background: #effaf5;
    font-size: .86rem;
    line-height: 1.4;
}
.form-field { position: relative; display: block; margin-bottom: 28px; }
.form-field > span:first-child {
    position: absolute;
    z-index: 1;
    top: -8px;
    left: 12px;
    padding: 0 5px;
    color: #4f6375;
    background: #f8fafb;
    font-size: .78rem;
}
.form-field input,
.form-field select {
    width: 100%;
    height: 58px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 5px;
    outline: 0;
    color: var(--ink);
    background: rgba(255,255,255,.72);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-field select { padding-right: 42px; appearance: none; }
.form-field input:focus,
.form-field select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,103,178,.12); }
.form-field select:disabled { color: var(--muted); background: #eef2f4; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 54px; }
.password-field button {
    position: absolute;
    top: 7px;
    right: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    display: grid;
    place-items: center;
    color: #929da6;
    background: transparent;
}
.password-field button.active { color: var(--brand); }
.password-field svg {
    width: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.reset-link {
    width: max-content;
    margin: -16px 0 22px auto;
    display: block;
    color: #435466;
    text-decoration: none;
    font-size: .86rem;
}
.primary-action,
.secondary-action,
.sign-out-action {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    background: var(--accent);
    text-decoration: none;
    text-transform: uppercase;
    font-size: .92rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
}
.primary-action:hover,
.secondary-action:hover { background: var(--accent-dark); }
.primary-action:disabled { cursor: wait; opacity: .78; }
.secondary-action { margin-top: 18px; }
.secondary-action svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.button-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: spin .7s linear infinite;
}
.primary-action.loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.reset-card { min-height: 440px; }
.reset-progress {
    width: 150px;
    margin: 0 auto 34px;
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
}
.reset-progress span {
    width: 32px;
    height: 32px;
    border: 2px solid #bdc7cf;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #84919d;
    background: #fff;
    font-size: .8rem;
    font-weight: 750;
}
.reset-progress span.active { border-color: var(--brand); color: #fff; background: var(--brand); }
.reset-progress span.complete { border-color: #168a5b; color: #fff; background: #168a5b; }
.reset-progress i { height: 2px; background: #d5dce2; }
.reset-intro { margin: 0 0 28px; text-align: center; }
.reset-intro h1 { margin: 0 0 7px; font-size: 1.3rem; }
.reset-intro p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.text-action {
    width: 100%;
    margin-top: 14px;
    padding: 10px;
    border: 0;
    color: var(--brand);
    background: transparent;
    cursor: pointer;
}
.reset-complete { padding: 36px 0 12px; text-align: center; }
.complete-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: #168a5b;
}
.complete-icon svg { width: 38px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.reset-complete h1 { margin: 0 0 8px; font-size: 1.4rem; }
.reset-complete p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }

.account-home {
    min-height: 100vh;
    padding: calc(88px + env(safe-area-inset-top)) 14px calc(36px + env(safe-area-inset-bottom));
    background: #f2f6f8;
}
.account-home-heading {
    padding: 4px 4px 17px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.account-home-heading span { color: var(--brand); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.account-home-heading h1 { margin: 3px 0 0; font-size: 1.55rem; letter-spacing: -.03em; }
.account-home-heading small { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.account-options-menu {
    position: fixed;
    z-index: 30;
    top: calc(58px + env(safe-area-inset-top));
    right: 12px;
    width: 220px;
    padding: 7px 0;
    border: 1px solid #e0e7ec;
    border-radius: 11px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 10px 34px rgba(19,44,63,.22);
}
.account-options-menu[hidden] { display: none; }
.account-options-menu a,
.account-options-menu button {
    width: 100%;
    min-height: 46px;
    padding: 0 15px;
    border: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    background: transparent;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-options-menu a:hover,
.account-options-menu button:hover { background: #f2f5f7; }
.account-options-menu form { margin: 0; }
.account-options-menu svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-module-grid { display: grid; gap: 11px; }
.account-module-card {
    position: relative;
    min-height: 112px;
    padding: 13px 14px;
    border: 1px solid #e1e8ed;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 5px 17px rgba(31,60,81,.07);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-module-card:hover { border-color: #c6d9e6; box-shadow: 0 7px 22px rgba(31,60,81,.11); }
.module-icon {
    width: 68px;
    height: 68px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: #0b67b2;
    background: #e8f3fa;
}
.module-icon svg { width: 38px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.charter-module { color: #168a5b; background: #e9f6f0; }
.trip-module { color: #7b57b2; background: #f1ebf8; }
.cargo-module { color: #b06a28; background: #fbf0e5; }
.account-module-card > span:nth-child(2) { min-width: 0; }
.account-module-card strong,
.account-module-card small { display: block; }
.account-module-card strong { margin-bottom: 5px; font-size: .95rem; text-transform: uppercase; }
.account-module-card small { color: var(--muted); font-size: .72rem; line-height: 1.42; }
.module-chevron { width: 21px; fill: none; stroke: #94a4b0; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.module-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 3px 7px;
    border-radius: 5px;
    color: #fff;
    background: var(--brand);
    font-size: .6rem;
    font-weight: 750;
    text-transform: uppercase;
}
.account-tools {
    margin-top: 16px;
    padding: 16px 10px 14px;
    border: 1px solid #e1e8ed;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 5px 17px rgba(31,60,81,.07);
}
.account-tools h2 { margin: 0 0 14px; text-align: center; font-size: .92rem; font-weight: 650; }
.tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 7px; }
.tools-grid a,
.tools-grid button {
    min-width: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: #344657;
    background: transparent;
    text-align: center;
    text-decoration: none;
    font-size: .68rem;
    line-height: 1.25;
    cursor: pointer;
}
.tools-grid span {
    width: 47px;
    height: 47px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #edf5fa;
}
.tools-grid svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-toast {
    position: fixed;
    z-index: 50;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    left: 18px;
    padding: 11px 15px;
    border-radius: 10px;
    color: #fff;
    background: rgba(24,41,58,.94);
    opacity: 0;
    transform: translateY(10px);
    transition: .2s ease;
    pointer-events: none;
    text-align: center;
    font-size: .82rem;
}
.account-toast.visible { opacity: 1; transform: translateY(0); }

.my-devices-page {
    min-height: 100vh;
    padding: calc(78px + env(safe-area-inset-top)) 10px calc(22px + env(safe-area-inset-bottom));
    background: #f7f9fa;
}
.my-device-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr));
    gap: 8px;
}
.my-device-card {
    position: relative;
    min-width: 0;
    min-height: 102px;
    padding: 6px 7px 6px 5px;
    border-bottom: 1px solid #d9e0e5;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 28px;
    gap: 7px;
    background: #fff;
}
.device-more-button {
    width: 28px;
    height: 38px;
    margin: auto 0;
    padding: 0;
    border: 0;
    display: grid;
    place-items: center;
    color: #5c6b76;
    background: transparent;
    cursor: pointer;
}
.device-more-button svg { width: 23px; fill: currentColor; }
.device-menu-dialog {
    width: min(calc(100% - 32px), 390px);
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 20px 55px rgba(12, 36, 54, .3);
}
.device-menu-dialog::backdrop { background: rgba(9, 26, 39, .48); }
.device-menu-header {
    min-height: 58px;
    padding: 10px 9px 10px 18px;
    border-bottom: 1px solid #e2e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 1rem;
}
.device-menu-header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.device-menu-header button {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #61717e;
    background: transparent;
    font-size: 1.6rem;
    cursor: pointer;
}
.device-menu-actions { padding: 7px 0; }
.device-menu-actions button,
.device-menu-actions a {
    width: 100%;
    min-height: 48px;
    padding: 8px 18px;
    border: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #263a4b;
    background: transparent;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.device-menu-actions button:hover,
.device-menu-actions a:hover { background: #f1f5f7; }
.device-menu-actions button.danger { color: #bd3734; }
.device-menu-actions svg {
    width: 22px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.remove-device-dialog {
    width: min(calc(100% - 32px), 390px);
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 20px 55px rgba(12,36,54,.3);
}
.remove-device-dialog::backdrop { background: rgba(9,26,39,.48); }
.remove-device-dialog-content { padding: 22px 20px 16px; }
.remove-device-dialog h2 { margin: 0 0 14px; font-size: 1.05rem; }
.remove-device-dialog p { margin: 0 0 8px; line-height: 1.45; }
.remove-device-dialog .remove-device-note { color: var(--muted); font-size: .78rem; }
.remove-device-dialog-actions {
    margin-top: 21px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.remove-device-dialog-actions button {
    min-width: 86px;
    min-height: 40px;
    padding: 7px 13px;
    border: 0;
    border-radius: 4px;
    color: #395062;
    background: #edf1f3;
    cursor: pointer;
}
.remove-device-dialog-actions button.danger { color: #fff; background: #cf403d; }
.remove-device-dialog-actions button:disabled { cursor: wait; opacity: .7; }

.logs-page {
    min-height: 100vh;
    padding: calc(76px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
    background: #f5f8fa;
}
.logs-device-name {
    padding: 9px 14px;
    overflow: hidden;
    color: #4a6071;
    background: #fff;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    font-weight: 650;
}
.logs-tabs {
    position: sticky;
    z-index: 4;
    top: calc(64px + env(safe-area-inset-top));
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #fff;
    box-shadow: 0 2px 8px rgba(20,48,68,.1);
}
.logs-tabs button {
    min-height: 48px;
    padding: 6px;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #657581;
    background: #fff;
    font-size: .78rem;
    cursor: pointer;
}
.logs-tabs button.active {
    border-bottom-color: var(--brand);
    color: var(--brand);
    font-weight: 700;
}
.logs-filter-summary {
    padding: 9px 14px 6px;
    color: var(--muted);
    text-align: center;
    font-size: .7rem;
}
.logs-results {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 0 10px;
}
.trip-stats { margin-bottom: 12px; }
.trip-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid #d8e2e8;
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
}
.trip-stat-grid > div {
    min-width: 0;
    padding: 10px 5px;
    border-right: 1px solid #e1e7eb;
    text-align: center;
}
.trip-stat-grid > div:last-child { border-right: 0; }
.trip-stat-grid strong,
.trip-stat-grid span { display: block; }
.trip-stat-grid strong {
    overflow: hidden;
    color: var(--brand);
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.trip-stat-grid span {
    margin-top: 4px;
    color: var(--muted);
    font-size: .6rem;
}
.trip-route-stats {
    margin-top: 7px;
    border: 1px solid #d8e2e8;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.trip-route-stats summary {
    min-height: 43px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    color: #385165;
    background: #edf2f5;
    font-size: .76rem;
    font-weight: 650;
    cursor: pointer;
}
.trip-route-stat {
    min-height: 57px;
    padding: 8px 10px;
    border-top: 1px solid #e3e8ec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.trip-route-stat > div { min-width: 0; }
.trip-route-stat > div strong,
.trip-route-stat > div small { display: block; }
.trip-route-stat > div strong {
    overflow: hidden;
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.trip-route-stat > div strong span { color: var(--brand); }
.trip-route-stat > div small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .65rem;
}
.trip-route-stat > b {
    min-width: 44px;
    color: var(--brand);
    text-align: center;
    font-size: .95rem;
}
.trip-route-stat > b small {
    display: block;
    color: var(--muted);
    font-size: .55rem;
    font-weight: 500;
}
.logs-loading,
.logs-empty {
    padding: 42px 18px;
    color: var(--muted);
    text-align: center;
}
.logs-results h3 {
    margin: 8px 0 0;
    padding: 9px 12px;
    color: #2f4555;
    background: #e1e7eb;
    font-size: .82rem;
    font-weight: 650;
}
.log-row {
    min-height: 48px;
    padding: 8px 10px;
    border-bottom: 1px solid #dce3e8;
    background: #fff;
}
.trip-log-row {
    display: grid;
    grid-template-columns: 58px 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
}
.log-row time { color: #586b79; font-size: .72rem; }
.trip-log-row > strong { color: #bc3936; font-size: .72rem; }
.trip-log-row > strong.start { color: #168657; }
.trip-log-row > span { overflow-wrap: anywhere; font-size: .8rem; }
.trip-log-row small { color: var(--muted); font-size: .68rem; }
.trip-log-row em { color: #4e6272; font-size: .68rem; font-style: normal; }
.account-logs-page { max-width: none; }
.logs-device-name small {
    margin-left: 6px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 500;
}
.account-trip-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.account-trip-expansion {
    margin: 8px 0;
    border: 1px solid #d8e3ea;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(29, 59, 81, .05);
}
.account-trip-expansion > summary {
    min-height: 64px;
    padding: 9px 12px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}
.account-trip-expansion > summary::-webkit-details-marker { display: none; }
.account-trip-expansion > summary:hover { background: #f8fbfd; }
.account-trip-expansion > summary > strong {
    overflow: hidden;
    color: #2f4555;
    font-size: .82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-trip-expansion > summary > strong span { color: var(--brand); }
.account-trip-event-counts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}
.account-trip-event-counts > b {
    padding: 4px 7px;
    border: 1px solid;
    border-radius: 12px;
    font-size: .58rem;
    font-weight: 700;
    white-space: nowrap;
}
.account-trip-event-counts > b strong {
    margin-left: 2px;
    font-size: .7rem;
}
.account-trip-event-counts .departure {
    color: #168657;
    border-color: #bce4d2;
    background: #e9f7f0;
}
.account-trip-event-counts .arrival {
    color: #bc3936;
    border-color: #edc7c5;
    background: #fcedec;
}
.account-trip-event-counts .alarm-count {
    color: #b15d15;
    border-color: #efd3b5;
    background: #fff2e5;
}
.account-trip-expand-icon.alarm {
    color: #b15d15;
    border-color: #efd3b5;
    background: #fff2e5;
}
.account-trip-expand-icon {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(11, 103, 178, .18);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #e8f3fa;
}
.account-trip-expand-icon svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
}
.account-trip-expansion[open] .account-trip-expand-icon svg { transform: rotate(180deg); }
.account-trip-expansion-rows { border-top: 1px solid #dce3e8; }
.account-trip-expansion-rows .log-row:last-child { border-bottom: 0; }
.account-trip-log-row {
    grid-template-columns: 58px 48px minmax(0, 1fr) auto;
}
.account-log-device {
    width: fit-content;
    max-width: 180px;
    padding: 3px 7px;
    border-radius: 10px;
    overflow: hidden;
    color: #0b67b2;
    background: #e8f3fa;
    font-size: .62rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-mileage-card h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.account-mileage-card h3 .account-log-device { display: inline-block; }
.account-mileage-comparison {
    border: 1px solid #d8e3ea;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
}
.account-mileage-row {
    padding: 13px 15px 14px;
    border-bottom: 1px solid #dce3e8;
}
.account-mileage-row:last-child { border-bottom: 0; }
.account-mileage-row-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.account-mileage-row-heading > strong {
    overflow: hidden;
    color: #2f4555;
    font-size: .92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-mileage-chips {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.account-mileage-chips > span {
    padding: 4px 7px;
    border: 1px solid #d6e2e9;
    border-radius: 12px;
    color: #536979;
    background: #f2f6f8;
    font-size: .61rem;
    white-space: nowrap;
}
.account-mileage-chips > span b {
    color: #2f4555;
    font-size: .66rem;
}
.account-mileage-chips .trips {
    border-color: #c8dcef;
    color: #376b96;
    background: #edf5fb;
}
.account-mileage-chips .distance {
    border-color: #bce4d2;
    color: #168657;
    background: #e9f7f0;
}
.account-mileage-chips .fuel {
    border-color: #efd3b5;
    color: #a95b18;
    background: #fff2e5;
}
.account-mileage-progress {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 27px;
    align-items: center;
    gap: 8px;
}
.account-mileage-progress > i {
    height: 6px;
    border-radius: 4px;
    display: block;
    overflow: hidden;
    background: #e1e6e9;
}
.account-mileage-progress > i span {
    height: 100%;
    border-radius: inherit;
    display: block;
    background: #dc4541;
    transition: width .3s ease;
}
.account-mileage-progress svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: #526b7c;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.alarm-log-row {
    display: grid;
    grid-template-columns: 155px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}
.alarm-log-row > div { min-width: 0; }
.alarm-log-row span {
    display: block;
    overflow-wrap: anywhere;
    font-size: .8rem;
}
.alarm-log-row small {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.alarm-log-row small:empty { display: none; }
.alarm-log-row small b {
    padding: 2px 5px;
    border-radius: 3px;
    color: #526676;
    background: #edf2f5;
    font-size: .6rem;
    font-weight: 600;
}
.alarm-log-row small .account-log-device {
    color: #0b67b2;
    background: #e8f3fa;
}
@media (max-width: 620px) {
    .account-trip-expansion > summary {
        grid-template-columns: 38px minmax(0, 1fr);
    }
    .account-trip-event-counts {
        grid-column: 2;
        justify-content: flex-start;
    }
    .account-trip-log-row {
        grid-template-columns: 52px 42px minmax(0, 1fr) auto;
    }
    .account-alarm-log-row {
        grid-template-columns: 112px minmax(0, 1fr);
    }
}
.mileage-log-row {
    padding: 11px 12px;
    border-bottom: 1px solid #dce3e8;
    background: #fff;
}
.mileage-log-row > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: .78rem;
}
.mileage-log-row > div span { color: #41596a; }
.mileage-log-row > i {
    height: 6px;
    margin-top: 8px;
    border-radius: 4px;
    display: block;
    overflow: hidden;
    background: #dfe6ea;
}
.mileage-log-row > i span {
    height: 100%;
    border-radius: inherit;
    display: block;
    background: var(--brand);
}
.mileage-summary-card {
    margin-bottom: 10px;
    border: 1px solid #d8e2e8;
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
}
.logs-results .mileage-summary-card h3 {
    margin: 0;
    padding: 10px 12px;
    color: #2f4555;
    background: #e7edf1;
    font-size: .82rem;
}
.mileage-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.mileage-summary-grid > div {
    min-width: 0;
    min-height: 67px;
    padding: 10px 7px;
    border-right: 1px solid #e5eaee;
    border-bottom: 1px solid #e5eaee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.mileage-summary-grid > div:nth-child(3n) { border-right: 0; }
.mileage-summary-grid strong,
.mileage-summary-grid span { display: block; }
.mileage-summary-grid strong {
    overflow: hidden;
    color: #23475f;
    font-size: .82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mileage-summary-grid span {
    margin-top: 4px;
    color: var(--muted);
    font-size: .6rem;
}
.fuel-rate-note {
    padding: 7px 10px;
    display: block;
    color: var(--muted);
    text-align: right;
    font-size: .62rem;
}

.device-info-page {
    min-height: 100vh;
    padding: calc(82px + env(safe-area-inset-top)) 16px 34px;
}
.device-info-heading,
.device-info-card {
    width: min(100%, 760px);
    margin: 0 auto 14px;
    border: 1px solid #d7e0e6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(21, 53, 76, .06);
}
.device-info-heading {
    padding: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.device-info-heading small { color: var(--muted); font-size: .7rem; }
.device-info-heading h1 { margin: 3px 0 0; font-size: 1.15rem; }
.device-info-status {
    padding: 7px 10px;
    border-radius: 20px;
    color: #a42e2b;
    background: #ffedec;
    font-size: .7rem;
    font-weight: 700;
}
.device-info-status.live { color: #13734c; background: #e7f7ef; }
.device-info-warning {
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border-radius: 5px;
    color: #9b302d;
    background: #fff0ef;
    font-size: .72rem;
}
.device-info-card { overflow: hidden; }
.device-info-card h2 {
    margin: 0;
    padding: 11px 14px;
    color: #344c5e;
    background: #e8eef2;
    font-size: .84rem;
}
.device-info-list { margin: 0; }
.device-info-list > div {
    min-height: 52px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5eaee;
    display: grid;
    grid-template-columns: minmax(125px, 35%) 1fr;
    align-items: center;
    gap: 14px;
}
.device-info-list > div:last-child { border-bottom: 0; }
.device-info-list dt { color: var(--muted); font-size: .72rem; }
.device-info-list dd {
    min-width: 0;
    margin: 0;
    color: #263f51;
    text-align: right;
    overflow-wrap: anywhere;
    font-size: .8rem;
    font-weight: 650;
}
.device-info-list dd small {
    margin-top: 3px;
    display: block;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 500;
}
.device-info-notice {
    margin: 12px;
    padding: 9px 11px;
    border: 1px solid #f1c6c4;
    border-radius: 5px;
    color: #8d3e3b;
    background: #fff4f3;
    font-size: .7rem;
}
.device-info-meter-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}
.device-info-meter {
    width: min(115px, 55%);
    height: 8px;
    border-radius: 5px;
    display: inline-block;
    overflow: hidden;
    background: #e1e7eb;
}
.device-info-meter i {
    height: 100%;
    border-radius: inherit;
    display: block;
    background: linear-gradient(90deg, #ef5350 0%, #f3c64f 42%, #31ad72 78%);
}

.my-device-card[data-device-map-href] { cursor: pointer; }
.app-bar-map-action {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.1);
}
.app-bar-map-action svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-map-body { overflow: hidden; }
.my-map-wrap {
    position: fixed;
    inset: calc(64px + env(safe-area-inset-top)) 0 calc(62px + env(safe-area-inset-bottom));
    background: #dce5ea;
}
#myDeviceMap { width: 100%; height: 100%; }
.my-map-loading {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    background: rgba(238,244,247,.9);
    transition: opacity .2s ease, visibility .2s ease;
}
.my-map-loading .button-spinner {
    border-color: #b8cad6;
    border-top-color: var(--brand);
    display: block;
}
.my-map-loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.my-map-card {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    left: 10px;
    max-height: 150px;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 11px rgba(20,37,50,.42);
    transition: max-height .25s ease;
}
.my-map-card.collapsed { max-height: 45px; }
.my-map-card[hidden],
.my-map-tool-card[hidden] { display: none; }
.my-map-card-content {
    min-height: 106px;
    padding: 10px;
    display: grid;
    grid-template-columns: 70px minmax(0,1fr) 62px;
    align-items: center;
    gap: 11px;
    transition: transform .25s ease;
}
.my-map-card.collapsed .my-map-card-content { transform: translateY(-61px); }
.my-map-card-toggle {
    position: absolute;
    z-index: 2;
    top: 1px;
    right: 2px;
    width: 29px;
    height: 27px;
    padding: 0;
    border: 0;
    display: grid;
    place-items: center;
    color: #7d8992;
    background: transparent;
}
.my-map-card-toggle svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform .25s ease;
}
.my-map-card.collapsed .my-map-card-toggle svg { transform: rotate(180deg); }
.my-map-photo { min-width: 0; text-align: center; }
.my-map-photo > img {
    width: 70px;
    height: 70px;
    border-radius: 5px;
    display: block;
    object-fit: cover;
    background: #edf2f5;
}
.my-map-photo > div {
    margin-top: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: .58rem;
    white-space: nowrap;
}
.my-map-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c4423e; }
.my-map-status-dot.connected { background: #20a267; }
.my-map-status-dot.stale { background: #c4423e; }
.my-map-details { min-width: 0; }
.my-map-details strong,
.my-map-details span,
.my-map-details small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-map-details strong { margin-bottom: 3px; font-size: 1rem; }
.my-map-details span { color: #3c5262; font-size: .75rem; font-weight: 650; }
.my-map-details small { margin-top: 2px; color: var(--muted); font-size: .65rem; }
.my-map-speed {
    padding: 8px 5px;
    border: 1px solid #d4dce2;
    border-radius: 9px;
    text-align: center;
    background: #fafafa;
}
.my-map-speed span,
.my-map-speed small { display: block; color: #526473; font-size: .62rem; }
.my-map-speed strong { margin: 2px 0; display: block; font-size: 1.2rem; }
.my-map-tool-card {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    left: 10px;
    padding: 12px;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 1px 11px rgba(20,37,50,.42);
}
.my-map-tool-heading {
    display: grid;
    grid-template-columns: 52px minmax(0,1fr);
    align-items: center;
    gap: 13px;
}
.my-map-tool-heading > img {
    width: 52px;
    height: 52px;
    border-radius: 5px;
    object-fit: cover;
    background: #edf2f5;
}
.my-map-tool-heading label,
.my-route-controls label { min-width: 0; }
.my-map-tool-heading label > span,
.my-route-controls label > span {
    margin-bottom: 4px;
    display: block;
    color: var(--muted);
    font-size: .64rem;
}
.my-map-tool-heading select,
.my-route-controls input {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    border: 1px solid #9cabb6;
    border-radius: 4px;
    color: var(--ink);
    background: #fff;
}
.my-map-metrics {
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid #dce3e8;
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
}
.my-map-metrics > div {
    min-width: 0;
    padding: 0 7px;
    border-right: 1px solid #dce3e8;
    text-align: center;
}
.my-map-metrics > div:last-child { border-right: 0; }
.my-map-metrics span,
.my-map-metrics strong,
.my-map-metrics small { display: block; }
.my-map-metrics span { color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.my-map-metrics strong {
    margin: 3px 0 1px;
    overflow: hidden;
    color: #263f51;
    font-size: 1.12rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-map-metrics small { min-height: .72rem; color: var(--muted); font-size: .6rem; }
.my-route-controls {
    display: grid;
    grid-template-columns: minmax(0,1fr) 44px;
    align-items: end;
    gap: 9px;
}
.my-route-controls button {
    width: 44px;
    height: 42px;
    padding: 0;
    border: 1px solid #a9b6c0;
    border-radius: 5px;
    display: grid;
    place-items: center;
    color: #657684;
    background: #f7f9fa;
}
.my-route-controls button.active { border-color: var(--brand); color: #fff; background: var(--brand); }
.my-route-controls svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-play-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
}
.my-play-actions button {
    min-height: 40px;
    padding: 6px 10px;
    border: 1px solid #b8c5ce;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #365064;
    background: #f8fafb;
    font-weight: 650;
}
.my-play-actions button:last-child { border-color: var(--brand); color: #fff; background: var(--brand); }
.my-play-actions svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-play-speed {
    margin-top: 11px;
    display: block;
}
.my-play-speed > span { display: block; color: #526676; font-size: .68rem; }
.my-play-speed > span strong { color: var(--brand); }
.my-play-speed input {
    width: 100%;
    height: 24px;
    margin: 2px 0 0;
    accent-color: var(--brand);
}
.my-neighbour-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.my-neighbour-heading strong,
.my-neighbour-heading small { display: block; }
.my-neighbour-heading strong { color: #2d4658; font-size: .88rem; }
.my-neighbour-heading small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.my-neighbour-heading button {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #b8c5ce;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #f7fafc;
}
.my-neighbour-heading svg {
    width: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-route-info-window {
    position: relative;
    min-width: 175px;
    padding: 7px 27px 4px 3px;
    color: #263f51;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.my-route-info-window strong,
.my-route-info-window span { display: block; }
.my-route-info-window strong { margin-bottom: 6px; font-size: .8rem; }
.my-route-info-window span { margin-top: 3px; color: #536675; font-size: .7rem; }
.my-route-info-close {
    position: absolute;
    top: -3px;
    right: -4px;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 0;
    color: #667783;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}
.my-map-tabs {
    position: fixed;
    z-index: 12;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 4px 3px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    box-shadow: 0 -2px 9px rgba(21,43,58,.15);
}
.my-map-tabs button {
    min-width: 0;
    padding: 4px 2px;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #687887;
    background: transparent;
    font-size: .6rem;
}
.my-map-tabs button.active { color: var(--brand); }
.my-map-tabs svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-map-tabs button.active svg { fill: rgba(11,103,178,.1); }
.my-map-body .account-toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
    .my-map-wrap,
    .my-map-tabs { left: 50%; width: min(100%, 1180px); transform: translateX(-50%); }
    .my-map-card,
    .my-map-tool-card { right: auto; width: min(520px, calc(100% - 20px)); }
}
.logs-filter-dialog {
    width: min(calc(100% - 32px), 430px);
    padding: 22px 20px 16px;
    border: 0;
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 20px 55px rgba(12,36,54,.3);
}
.logs-filter-dialog::backdrop { background: rgba(9,26,39,.48); }
.logs-filter-dialog h2 { margin: 0 0 24px; font-size: 1.08rem; }
.logs-filter-dialog .form-field > span:first-child { background: #fff; }
.logs-custom-dates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.logs-custom-dates[hidden] { display: none; }
.logs-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.logs-filter-actions button {
    min-width: 92px;
    min-height: 42px;
    padding: 7px 13px;
    border: 0;
    border-radius: 4px;
    color: #395062;
    background: #edf1f3;
    cursor: pointer;
}
.logs-filter-actions button.primary { color: #fff; background: var(--accent); }
.my-device-photo {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.my-device-photo img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
    flex: none;
    border-radius: 4px;
    object-fit: cover;
    background: #edf1f3;
}
.my-device-photo span { color: #526473; font-size: .65rem; }
.my-device-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1px 0;
}
.my-device-title {
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.my-device-title strong {
    overflow: hidden;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-device-title time {
    flex: none;
    color: #6b7985;
    font-size: .63rem;
    white-space: nowrap;
}
.my-device-owner {
    overflow: hidden;
    color: #63727e;
    font-size: .66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-device-location {
    min-height: 21px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #344657;
    font-size: .72rem;
}
.movement-marker {
    width: 18px;
    height: 18px;
    flex: none;
    display: block;
    object-fit: contain;
}
.my-device-status {
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.my-device-status a,
.my-device-status span {
    min-height: 23px;
    padding: 2px 6px;
    border: 1px solid #ced7dd;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    color: #405363;
    background: #fff;
    text-decoration: none;
    font-size: .65rem;
}
.my-device-status svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.my-device-status .battery-status { padding: 2px 5px; }
.my-device-status .battery-status img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}
.empty-devices {
    width: min(100%, 520px);
    margin: 48px auto 0;
    padding: 30px 24px;
    border: 1px solid #dce4e9;
    border-radius: 12px;
    background: #fff;
    text-align: center;
}
.empty-devices > svg {
    width: 56px;
    fill: none;
    stroke: var(--brand);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.empty-devices h1 { margin: 13px 0 7px; font-size: 1.15rem; }
.empty-devices p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.55; }

.edit-save-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
}
.edit-save-icon svg {
    width: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.edit-device-page {
    min-height: 100vh;
    padding: calc(92px + env(safe-area-inset-top)) 20px calc(34px + env(safe-area-inset-bottom));
    background: #f7f9fa;
}
.edit-device-form {
    width: min(100%, 680px);
    margin: 0 auto;
}
.edit-device-form .form-field > span:first-child { background: #f7f9fa; }
.edit-device-form .form-field input:disabled {
    color: #7a8791;
    background: #edf1f3;
}
.edit-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.edit-switches {
    margin: 0 0 28px;
    border-top: 1px solid #dce3e8;
}
.edit-switches label {
    min-height: 54px;
    border-bottom: 1px solid #dce3e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    cursor: pointer;
}
.edit-switches label[hidden] { display: none; }
.edit-switches input {
    width: 42px;
    height: 24px;
    accent-color: var(--brand);
}
.form-message { margin-bottom: 24px; }
.share-permission-form .form-message {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .72rem;
}

.share-page {
    min-height: 100vh;
    padding: calc(86px + env(safe-area-inset-top)) 14px calc(30px + env(safe-area-inset-bottom));
    background: #f5f8fa;
}
.share-save-success {
    width: min(100%, 760px);
    margin: 0 auto 10px;
    padding: 10px 14px;
    border: 1px solid #9fd0b7;
    border-radius: 5px;
    color: #176b48;
    background: #effaf5;
    text-align: center;
    font-size: .8rem;
}
.share-permission-form {
    width: min(100%, 680px);
    margin: 0 auto;
}
.share-device-name {
    margin: 0 0 22px;
    color: var(--brand);
    font-size: 1.05rem;
    font-weight: 750;
    text-align: center;
}
.share-permission-form .form-field > span:first-child { background: #f5f8fa; }
.share-permission-form .form-field input[readonly] {
    color: #71808b;
    background: #edf1f3;
}
.permission-section {
    margin-bottom: 10px;
    border: 1px solid #d8e0e5;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.permission-section summary {
    min-height: 52px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    color: #2f4353;
    background: #e9eef1;
    font-weight: 650;
    cursor: pointer;
}
.permission-section label {
    min-height: 58px;
    padding: 8px 14px;
    border-top: 1px solid #e5eaee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.permission-section label span,
.permission-section label strong,
.permission-section label small { display: block; }
.permission-section label strong { font-size: .86rem; }
.permission-section label small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .7rem;
}
.permission-section input {
    width: 42px;
    height: 24px;
    flex: none;
    accent-color: var(--brand);
}
.share-permission-form > .primary-action { margin-top: 22px; }
.share-list-heading {
    width: min(100%, 760px);
    margin: 0 auto 12px;
    padding: 12px 14px;
    border: 1px solid #cfe2d8;
    color: #285c43;
    background: #eef8f2;
    text-align: center;
}
.public-share-card {
    position: relative;
    width: min(100%, 760px);
    min-height: 76px;
    margin: 0 auto 10px;
    padding: 12px 16px;
    border: 1px solid #dce3e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(28,54,73,.1);
}
.public-share-card > span:first-child,
.public-share-card strong,
.public-share-card small { display: block; }
.public-share-card strong { font-size: .94rem; }
.public-share-card > span:first-child small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .72rem;
}
.toggle-switch { position: relative; width: 48px; height: 28px; flex: none; }
.toggle-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.toggle-switch > span:not(.sr-only) {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: #b9c3ca;
    cursor: pointer;
    transition: background .18s ease;
}
.toggle-switch > span:not(.sr-only)::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: transform .18s ease;
}
.toggle-switch input:checked + span { background: var(--brand); }
.toggle-switch input:checked + span::after { transform: translateX(20px); }
.toggle-switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggle-switch input:disabled + span { cursor: wait; opacity: .65; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.public-share-status {
    position: absolute;
    right: 16px;
    bottom: 3px;
    color: #238257;
    font-size: .62rem;
}
.public-share-status.error { color: #b33330; }
.share-list-heading strong,
.share-list-heading span,
.share-list-heading small { display: block; }
.share-list-heading span { margin-top: 3px; font-size: .75rem; }
.share-list-heading small {
    margin-top: 8px;
    padding-top: 7px;
    border-top: 1px solid #d4e8dc;
    font-size: .72rem;
}
.shared-user-list {
    width: min(100%, 760px);
    margin: 0 auto;
    display: grid;
    gap: 7px;
}
.shared-user-card {
    min-height: 92px;
    padding: 10px;
    border-bottom: 1px solid #d9e1e6;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    background: #fff;
}
.shared-user-card > img {
    width: 62px;
    height: 62px;
    border-radius: 5px;
    object-fit: cover;
    background: #edf1f3;
}
.shared-user-content { min-width: 0; }
.shared-user-top {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.shared-user-identity {
    min-width: 0;
    padding-top: 2px;
}
.shared-user-card strong,
.shared-user-card span,
.shared-user-card small { display: block; }
.shared-user-identity strong,
.shared-user-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shared-user-identity span { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.shared-access-box {
    width: 58px;
    min-height: 55px;
    padding: 5px;
    border: 1px solid #9eabb5;
    border-radius: 5px;
    flex: none;
    display: grid;
    place-items: center;
    text-align: center;
}
.shared-access-box small { color: #526676; font-size: .58rem; }
.shared-access-box strong { font-size: 1.22rem; font-weight: 500; }
.shared-user-actions {
    margin-top: 7px;
    display: flex;
    flex-direction: row;
    gap: 8px;
}
.shared-user-actions a,
.shared-user-actions button {
    min-width: 92px;
    padding: 5px 8px;
    border: 1px solid #cbd5dc;
    border-radius: 3px;
    color: #34495a;
    background: #fff;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    font-size: .65rem;
    cursor: pointer;
}
.shared-user-actions button { color: #a83230; }
.shared-user-actions span {
    display: inline;
    margin-right: 3px;
    color: inherit;
    font-size: .82rem;
}

@media (min-width: 760px) {
    .login-page { padding-top: calc(118px + env(safe-area-inset-top)); }
    .login-card { padding: 32px; border-radius: 20px; background: #fff; box-shadow: 0 14px 42px rgba(30,61,83,.12); }
    .form-field > span:first-child { background: #fff; }
    .account-home { padding-inline: 24px; }
    .account-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tools-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .my-devices-page { padding-inline: 18px; }
    .edit-device-form {
        padding: 30px;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 12px 36px rgba(30,61,83,.1);
    }
    .edit-device-form .form-field > span:first-child { background: #fff; }
    .share-permission-form {
        padding: 30px;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 12px 36px rgba(30,61,83,.1);
    }
    .share-permission-form .form-field > span:first-child { background: #fff; }
}

@media (max-width: 520px) {
    .edit-field-row { grid-template-columns: 1fr; gap: 0; }
    .trip-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .trip-stat-grid > div:nth-child(2) { border-right: 0; }
    .trip-stat-grid > div:nth-child(-n+2) { border-bottom: 1px solid #e1e7eb; }
    .mileage-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mileage-summary-grid > div:nth-child(3n) { border-right: 1px solid #e5eaee; }
    .mileage-summary-grid > div:nth-child(2n) { border-right: 0; }
}

@media (min-width: 1180px) {
    .account-module-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .account-module-card { grid-template-columns: 64px minmax(0, 1fr) 18px; }
    .module-icon { width: 60px; height: 60px; }
    .tools-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }
}
