/* Owntracks GPS Tracking – Layout & Login */

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    height: -webkit-fill-available;
    background: #e8e8e8;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
}

/* ----- Login ----- */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}

.login-box {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 340px;
}

.login-box h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.75rem;
    color: #2c3e50;
}

.login-subtitle {
    margin: 0 0 1.5rem 0;
    color: #7f8c8d;
    font-size: 0.95rem;
}

.login-error {
    background: #fee;
    color: #c0392b;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-form label {
    display: block;
    margin-bottom: 1rem;
}

.login-form label span {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.login-form button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.7rem 1rem;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.login-form button:hover {
    background: #2980b9;
}

/* ----- Map Page ----- */
body.map-page {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: #e8e8e8;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    padding-top: calc(0.6rem + env(safe-area-inset-top));
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    background: #2c3e50;
    color: #fff;
    flex-shrink: 0;
}

.header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header .user {
    color: #bdc3c7;
    font-size: 0.9rem;
}

.btn-refresh {
    height: 34px;
    padding: 0 0.75rem;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-refresh:hover,
.btn-refresh:focus {
    background: rgba(255,255,255,0.18);
    outline: none;
}
.btn-refresh:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Hamburger-Button */
.btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}
.btn-menu:hover, .btn-menu:focus {
    background: rgba(255,255,255,0.15);
    outline: none;
}
.btn-menu .hamburger {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 6px 0 currentColor, 0 12px 0 currentColor;
}

/* Einstellungen-Panel (Drawer von rechts) */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    max-width: 320px;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding-right: env(safe-area-inset-right);
}
.settings-panel.is-open {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.settings-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}
.btn-close-menu {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}
.btn-close-menu:hover, .btn-close-menu:focus {
    background: #eee;
    color: #333;
    outline: none;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.settings-body .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}
.settings-body .tid-checkboxes {
    flex-direction: column;
}
.settings-body #vehicle-tid-checkboxes {
    flex-direction: column;
}
.settings-body .btn-apply {
    margin-top: 0.5rem;
    margin-left: 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.tid-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.tid-check {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
}

.tid-check input {
    margin-right: 0.35rem;
}

select, input[type="date"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.btn-apply {
    padding: 0.5rem 1rem;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-left: auto;
}

.btn-apply:hover {
    background: #219a52;
}

.btn-secondary {
    width: 100%;
    padding: 0.5rem 1rem;
    background: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #dfe6e9;
}

.settings-exploration-manual {
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.settings-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: #777;
    line-height: 1.35;
}

.exploration-manual-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1102;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.exploration-manual-modal.is-open {
    display: flex;
}

.exploration-manual-card {
    width: min(400px, 100%);
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.exploration-manual-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.exploration-manual-title {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

.exploration-manual-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
}

.exploration-manual-close:hover {
    background: #eee;
}

.exploration-manual-desc {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.exploration-manual-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    color: #444;
}

.exploration-manual-form input[type="date"],
.exploration-manual-form input[type="time"] {
    width: 100%;
    box-sizing: border-box;
}

.exploration-manual-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.exploration-manual-times label {
    margin-bottom: 0;
}

.exploration-manual-error {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: #c0392b;
}

.exploration-manual-success {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: #27ae60;
}

.exploration-manual-form .btn-apply {
    width: 100%;
    margin-left: 0;
}

.world-track-persons {
    margin: 0 0 1rem;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}
.world-track-persons legend {
    padding: 0 0.25rem;
    font-size: 0.85rem;
    color: #555;
}
.world-track-persons .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.world-track-persons .checkbox-label:last-child {
    margin-bottom: 0;
}

.world-track-range-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.world-track-range-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #f7f9fb;
    border: 1px solid #e6eaef;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.35;
    color: #333;
}
.world-track-range-text {
    flex: 1;
    min-width: 0;
}
.world-track-range-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #c0392b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.world-track-range-remove:hover,
.world-track-range-remove:focus {
    background: #fdecea;
    outline: none;
}
.world-track-range-empty {
    margin: 0;
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.map {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    position: relative;
}

body.map-page #map.map,
body.map-page #map.leaflet-container {
    height: 100%;
    width: 100%;
}

/* Leaflet-Layer-Switcher oben rechts */
.leaflet-top.leaflet-right .leaflet-control-layers {
    margin-top: 10px;
    margin-right: 10px;
}
.leaflet-control-layers-toggle {
    width: 36px;
    height: 36px;
    background-size: 22px 22px;
}
.leaflet-control-layers-expanded {
    padding: 6px 10px 6px 8px;
    font-size: 13px;
    line-height: 1.35;
}
.leaflet-control-layers-expanded label {
    margin-bottom: 4px;
}
.leaflet-control-layers-expanded label:last-child {
    margin-bottom: 0;
}

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

.last-points {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    padding: 0.4rem 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
    font-size: 0.85rem;
    background: #fff;
    border-top: 1px solid #eee;
}
.last-points:empty { display: none; }
.last-points .error { color: #c0392b; }

/* Gesamt-km Overlay unten rechts */
.summary-km {
    position: fixed;
    right: calc(0.75rem + env(safe-area-inset-right));
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(44, 62, 80, 0.92);
    color: #ecf0f1;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    z-index: 900;
    max-width: 260px;
    transition: bottom 0.2s ease;
}

body.has-vehicle-sheet-open #summary-km:not(.hidden) {
    bottom: calc(var(--vehicle-sheet-height, 122px) + 0.65rem + env(safe-area-inset-bottom));
}

.summary-km.hidden {
    display: none;
}
.summary-km-title {
    font-weight: 600;
    margin-bottom: 0.1rem;
}
.summary-km-total {
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.summary-km-meta {
    font-size: 0.72rem;
    opacity: 0.85;
    margin-top: 0.2rem;
}
.summary-km-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.6rem;
}
.summary-km-item {
    white-space: nowrap;
}
.summary-km-tid {
    font-weight: 500;
}

/* Leaflet: Geschwindigkeit (Tooltip + Popup für Tippen) */
.speed-tooltip {
    font-size: 12px;
    padding: 2px 6px;
}
.speed-popup .leaflet-popup-content-wrapper {
    padding: 0.4em 0.6em;
    font-size: 14px;
    font-weight: 500;
}
.speed-popup .leaflet-popup-content { margin: 0; }

/* Letzter Standort: dauerhaft sichtbares Label am Marker */
.last-marker-label {
    font-size: 12px !important;
    padding: 4px 8px !important;
    white-space: nowrap;
    pointer-events: none;
}
.last-marker-label strong { font-weight: 600; }

/* Ausgewähltes Objekt: Geschwindigkeits-Sprechblase (> 10 km/h) */
.leaflet-tooltip.selected-speed-bubble {
    background: #fff;
    border: 1px solid rgba(44, 62, 80, 0.22);
    border-radius: 12px;
    padding: 5px 11px;
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    white-space: nowrap;
}

.leaflet-tooltip-top.selected-speed-bubble::before {
    border-top-color: #fff;
}

.vehicle-icon-marker {
    background: transparent !important;
    border: 0 !important;
}

.vehicle-icon-rotator {
    width: 56px;
    height: 56px;
    transform-origin: 50% 50%;
}

.vehicle-icon-image {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
    transform-origin: 50% 50%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
    pointer-events: none;
}

.quick-jump-stack {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.quick-jump-control {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 6px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.quick-jump-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-jump-item {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(44, 62, 80, 0.2);
    border-radius: 8px;
    background: #fff;
    padding: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-jump-item:hover,
.quick-jump-item:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.22);
    outline: none;
}

.quick-jump-item.quick-jump-on {
    background: #27ae60;
    border-color: #1e8449;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.quick-jump-item.quick-jump-on:hover,
.quick-jump-item.quick-jump-on:focus {
    border-color: #145a32;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.35);
}

.exploration-quick-control .quick-jump-emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.exploration-quick-control .quick-jump-exploration-wappen {
    width: 28px;
    height: 28px;
}

.quick-jump-image {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.quick-jump-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.point-time-label {
    font-size: 10px !important;
    font-weight: 600;
    padding: 2px 5px !important;
    border-radius: 4px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(44, 62, 80, 0.25);
    color: #2c3e50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

/* GPS-Punkt: ID, Geschwindigkeit, Zeit (bei Option + hohem Zoom) */
.gps-point-detail-label {
    font-size: 10px !important;
    font-weight: 500;
    line-height: 1.35;
    padding: 4px 6px !important;
    border-radius: 4px;
    white-space: normal !important;
    max-width: 220px;
    text-align: left;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(44, 62, 80, 0.3);
    color: #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}
.gps-point-detail-tooltip {
    margin: 0;
}
.speed-popup .gps-point-detail-tooltip {
    font-size: 13px;
    line-height: 1.4;
}

.segment-speed-label {
    font-size: 10px !important;
    font-weight: 700;
    padding: 2px 5px !important;
    border-radius: 4px;
    white-space: nowrap;
    background: rgba(44, 62, 80, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ecf0f1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.exploration-success-label {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}

.exploration-success-label-city span {
    font-size: 13px !important;
}
.exploration-success-label span {
    font-size: 12px !important;
    font-weight: 700;
    padding: 0 !important;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff,
        0 0 6px rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

.vehicle-detail-sheet {
    --vehicle-sheet-thumb: 100px;
    position: fixed;
    left: calc(0.5rem + env(safe-area-inset-left));
    right: calc(0.5rem + env(safe-area-inset-right));
    bottom: calc(0.5rem + env(safe-area-inset-bottom));
    height: 122px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    z-index: 980;
    display: none;
    grid-template-columns: var(--vehicle-sheet-thumb) 1fr;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    font-size: 11px;
    line-height: 1.35;
    transition: height 0.22s ease;
}

.vehicle-detail-sheet.is-open {
    display: grid;
}

.vehicle-detail-sheet.is-expanded {
    --vehicle-sheet-thumb: 132px;
    padding: 0.65rem 0.75rem;
    gap: 0.65rem;
    font-size: 13px;
    line-height: 1.4;
}

.vehicle-sheet-media {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vehicle-sheet-media img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.vehicle-sheet-content {
    display: grid;
    grid-template-rows: repeat(5, auto);
    align-content: center;
    gap: 0.15rem;
    min-width: 0;
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-content {
    gap: 0.28rem;
    align-content: start;
}

.vehicle-sheet-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 0;
    font-size: inherit;
    line-height: inherit;
}

.vehicle-sheet-row:empty {
    display: none;
}

.vehicle-sheet-value-btn {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.vehicle-sheet-value-btn:hover,
.vehicle-sheet-value-btn:focus {
    text-decoration: underline;
    outline: none;
}

.vehicle-sheet-title-row {
    justify-content: space-between;
    font-weight: 600;
    gap: 0.3rem;
    flex-wrap: nowrap;
}

.vehicle-sheet-title-left {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.vehicle-sheet-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-size: 13px;
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-title {
    font-size: 16px;
}

.vehicle-sheet-title-right {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.vehicle-sheet-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.vehicle-sheet-time {
    color: #8f98a1;
    font-weight: 500;
    font-size: 10px;
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-time {
    font-size: 12px;
}

.vehicle-sheet-icon-btn {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: #e6ebef;
    color: #334155;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-icon-btn {
    width: 26px;
    height: 26px;
    font-size: 16px;
}

.vehicle-sheet-expand-icon {
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-1px);
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-expand-icon {
    transform: rotate(180deg) translateY(1px);
}

.vehicle-sheet-icon-btn:hover,
.vehicle-sheet-icon-btn:focus {
    background: #d8e0e7;
    outline: none;
}

.vehicle-sheet-icon-btn[hidden] {
    display: none;
}

.vehicle-sheet-muted {
    color: #66707a;
}

.vehicle-sheet-battery {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.vehicle-sheet-sensor {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

/* Gleiche Icon-Farbe wie Fließtext im Sheet (kein Link-Blau, kein Browser-Default) */
.vehicle-detail-sheet .material-symbols-outlined {
    color: inherit;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.vehicle-sheet-battery .material-symbols-outlined {
    font-size: 13px;
}

.vehicle-sheet-sensor .material-symbols-outlined {
    font-size: 13px;
}

.vehicle-detail-sheet.is-expanded .vehicle-sheet-battery .material-symbols-outlined,
.vehicle-detail-sheet.is-expanded .vehicle-sheet-sensor .material-symbols-outlined {
    font-size: 16px;
}

/* Personen: HA-Sensorzeit links (gleiche Typo-Farbe wie .vehicle-sheet-time) */
.person-ha-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}

.person-ha-line-time {
    flex: 0 0 auto;
    min-width: 3.5em;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.person-ha-line .vehicle-sheet-sensor {
    flex: 1 1 auto;
    min-width: 0;
}

.vehicle-sheet-row4 {
    display: flex;
    align-items: center;
}

.vehicle-sheet-row5 {
    display: none;
}

.vehicle-sheet-row5.is-open {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.vehicle-fuel-percent {
    min-width: 3ch;
    font-weight: 600;
    color: #334155;
}

.vehicle-fuel-bar {
    flex: 1 1 auto;
    height: 8px;
    border-radius: 999px;
    background: #dfe6eb;
    overflow: hidden;
}

.vehicle-detail-sheet.is-expanded .vehicle-fuel-bar {
    height: 11px;
}

.vehicle-detail-sheet.is-expanded .vehicle-fuel-percent {
    font-size: 14px;
}

.vehicle-fuel-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71 0%, #27ae60 100%);
}

.vehicle-history-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.vehicle-history-modal.is-open {
    display: flex;
}

.vehicle-history-card {
    width: min(680px, 100%);
    background: #fff;
    border-radius: 12px;
    padding: 0.65rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    position: relative;
}

.vehicle-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.vehicle-history-title {
    font-weight: 600;
    color: #1f2937;
}

.vehicle-history-range {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.vehicle-history-range-btn {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    line-height: 1;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
}

.vehicle-history-range-btn:hover,
.vehicle-history-range-btn:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

.vehicle-history-range-btn.is-active {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
}

.vehicle-history-close {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: #e6ebef;
    color: #334155;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.vehicle-history-legend {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.vehicle-history-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.vehicle-history-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.vehicle-history-canvas {
    width: 100%;
    height: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.vehicle-history-point-popup {
    position: absolute;
    display: none;
    z-index: 5;
    min-width: 150px;
    max-width: 240px;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    font-size: 0.78rem;
    line-height: 1.35;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.vehicle-history-point-popup.is-open {
    display: block;
}

.vehicle-history-point-popup-line-value {
    font-weight: 600;
}

.vehicle-history-empty {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: #64748b;
    min-height: 1em;
}
