/* colours: the variables are in theme.css (light and dark) */
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* also for elements whose class sets display */
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); }
.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 12px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.card h2 .actions { margin-left: auto; }
h1 { font-size: 22px; margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
.table-wrap { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }   /* sideways only, no up-and-down play */
.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font: inherit; font-size: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 13px; }
form.inline { display: inline; }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=tel], input[type=url], input[type=search], input[type=datetime-local], select, textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.help { color: var(--muted); font-size: 13px; margin-top: 4px; }
.form-actions { margin-top: 20px; display: flex; gap: 8px; }
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--track); color: var(--muted); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: var(--danger-bg); color: var(--danger); }
.badge-net { background: #e8f0fe; color: var(--primary); cursor: help; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.auth-box { max-width: 380px; margin: 10vh auto; }
/* Sign-in, forgotten and new password on phones and in the app: big fields (16 px text: no zoom on focus), a wide button */
@media (max-width: 640px), (pointer: coarse) {
    .auth-box { max-width: 440px; margin: 5vh auto; padding: 24px 18px; }
    .auth-box h1 { text-align: center; font-size: 26px; margin: 0 0 8px; }
    .auth-box label { font-size: 15px; margin: 16px 0 6px; }
    .auth-box input[type=email], .auth-box input[type=password], .auth-box input[type=text] { min-height: 50px; padding: 12px 14px; font-size: 16px; border-radius: 10px; box-sizing: border-box; }
    .auth-box .password-wrap input { padding-right: 54px; }
    .auth-box .password-toggle { width: 46px; height: 46px; right: 3px; border-radius: 8px; }
    .auth-box .check { margin: 14px 0 0; padding: 6px 0; font-size: 16px; font-weight: 400; }
    .auth-box .check input[type=checkbox] { width: 22px; height: 22px; margin: 0; flex: none; }
    .auth-box .form-actions { margin-top: 18px; }
    .auth-box .form-actions .btn, .auth-box button[type=submit] { display: block; width: 100%; min-height: 52px; font-size: 17px; font-weight: 600; border-radius: 10px; }
    .auth-box .help { text-align: center; font-size: 15px; margin-top: 14px; }
    .auth-box .help a { display: inline-block; padding: 10px 12px; }
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } .container { margin-top: 12px; } .card { padding: 14px; } }
.num { text-align: right; white-space: nowrap; }
.filters .form-actions { margin-top: 12px; }
.cat-business { background: var(--info-bg); color: var(--primary); }
.cat-private { background: #f3e8ff; color: #7e22ce; }
.cat-commute { background: var(--warn-bg); color: var(--warn-text); }
/* Logbook (Fahrtenbuch) */
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.lb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.lb-tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.lb-tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.lb-vehicle { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.lb-vehicle select { border: 0; width: auto; font-weight: 600; background: transparent; }
.lb-toolbar { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 8px 0 12px; }
.lb-filter summary, .lb-link { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); text-decoration: none; padding: 6px 4px; list-style: none; }
.lb-filter summary::-webkit-details-marker { display: none; }
.lb-filter-form { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 0; }
.lb-filter-form label { margin: 0; font-weight: 400; font-size: 13px; color: var(--muted); }
.lb-filter-form select { width: auto; margin-top: 2px; }
.lb-sep { width: 1px; height: 22px; background: var(--border); margin-top: 6px; }
.lb-pills { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 20px; }
.pill { display: inline-block; padding: 8px 18px; border-radius: 20px; text-decoration: none; font-size: 14px; }
.pill-yellow { background: #fcc419; color: var(--text); }
.pill-orange { background: #e8590c; color: #fff; font-weight: 600; }
.pill-help { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: #fcc419; font-size: 13px; font-weight: 700; cursor: help; margin-left: 6px; }
.lb-pills > a + .pill-help { margin-top: -32px; margin-left: 420px; }
.lb-odo { display: flex; align-items: flex-start; gap: 8px; position: relative; }
.pill-icon { list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; background: #e8590c; color: #fff; display: flex; align-items: center; justify-content: center; }
.pill-icon::-webkit-details-marker { display: none; }
.odo-form { position: absolute; right: 0; top: 42px; width: 260px; z-index: 50; margin: 0; }
.lb-day { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px 8px; flex-wrap: wrap; gap: 8px; }
.lb-day-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.lb-trip { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.lb-route { flex: 1; min-width: 0; }
.lb-row { display: flex; align-items: baseline; gap: 14px; font-size: 14px; }
.lb-time { width: 42px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-dist { align-items: center; margin: 6px 0; flex-wrap: wrap; gap: 8px; }
.lb-line { width: 42px; flex: none; height: 22px; position: relative; }
.lb-line::before { content: ""; position: absolute; left: 3px; top: -4px; bottom: -4px; width: 2px; background: #1f2933; }
.lb-line::after { content: ""; position: absolute; left: 0; bottom: -6px; width: 8px; height: 8px; border-radius: 50%; background: #1f2933; }
.lb-odo-value { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--soft); color: var(--text); text-decoration: none; list-style: none; cursor: pointer; }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn-dark { background: #3e4c59; color: #fff; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); z-index: 40; min-width: 160px; padding: 4px; }
.menu-list form { margin: 0; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 6px; font: inherit; cursor: pointer; }
.menu-list button:hover { background: var(--soft); }
.menu-list button.selected { font-weight: 600; color: var(--primary); }
@media (max-width: 640px) {
    /* Trip card: route over the full width, below it odometer and buttons */
    .lb-trip { flex-wrap: wrap; gap: 10px 12px; padding: 12px; }
    .lb-route { flex: 1 1 100%; }
    .lb-odo-value { order: 2; margin-right: auto; }
    .lb-actions { order: 3; }
    .lb-row { gap: 10px; }
    .lb-pills > a + .pill-help { margin: 0; }
    .lb-pills .pill { text-align: center; }
    .lb-odo { flex-wrap: wrap; justify-content: center; }
    .lb-odo .pill-orange { font-size: 13px; padding: 7px 14px; }
    .lb-vehicle { max-width: 100%; }
    .lb-vehicle select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
    .icon-btn { width: 40px; height: 40px; }   /* finger-sized */
    .menu-list button { padding: 12px 14px; }
}
/* Tab bars (Fahrtenbuch, Statistiken): swipe sideways instead of widening the page */
/* Sideways only: "overflow-x: auto" alone also lets the bar move up and down by the pixel its active marker sticks
   out, which wobbles while swiping; a swipe that starts on the bar never scrolls the page */
.lb-tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; overscroll-behavior-x: contain; padding-bottom: 1px; }   /* the pixel keeps the active tab's underline whole */
.lb-tabs::-webkit-scrollbar { display: none; }
.lb-tabs a { flex: none; white-space: nowrap; }
/* Tables with class "stack": one card per row on phones, the column name in front of each value */
@media (max-width: 640px) {
    table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: auto; }
    table.stack tr:first-child:has(th) { display: none; }
    table.stack tr { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
    table.stack td { border: 0; padding: 4px 0; overflow-wrap: anywhere; }
    table.stack td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
    table.stack td.stack-actions:not(:has(*)) { display: none; }
    .table-wrap:has(> table.stack) { overflow: visible; }
}
/* Vehicle battery states (always with a text label) */
.power-charging { background: var(--info-bg); color: var(--primary); }
.power-good { background: var(--ok-bg); color: var(--ok); }
.power-fair { background: var(--warn-bg); color: var(--warn-text); }
.power-weak, .power-none { background: var(--danger-bg); color: var(--danger); }
/* Alerts */
.sev-critical { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.sev-warning { background: var(--warn-bg); color: var(--warn-text); font-weight: 600; }
table.alerts tr.resolved td { color: var(--muted); }
table.alerts .alert-mail { font-size: 13px; overflow-wrap: anywhere; }
table.alerts .alert-mail .muted { display: block; font-size: 12px; }
.sidebar .tag-count { background: #c62828; color: #fff; font-weight: 600; }
.alert-settings { border: 1px solid var(--border); border-radius: 8px; padding: 4px 14px 12px; margin: 16px 0 4px; }
.alert-settings legend { font-weight: 600; padding: 0 6px; }
.alert-settings .check { align-items: flex-start; margin-top: 10px; }
.alert-settings .check input { margin-top: 4px; }
.alert-settings .minutes { margin: 4px 0 4px 26px; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-settings .minutes label { margin: 0; font-weight: 400; }
.alert-settings .minutes input { width: 90px; }
.marker-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.marker-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 400; font-size: 12px; margin: 0; cursor: pointer; width: 78px; }
.marker-choice input { position: absolute; opacity: 0; pointer-events: none; }
.marker-preview { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text); background: var(--surface); overflow: hidden; }
.marker-preview img { width: 100%; height: 100%; object-fit: cover; }
.marker-choice input:checked + .marker-preview { border-color: var(--primary); box-shadow: 0 0 0 3px #e6effd; }
.marker-choice input:focus-visible + .marker-preview { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Assets */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 16px; text-decoration: none; color: var(--text); font-size: 14px; background: var(--surface); }
.chip.active { border-color: var(--primary); background: var(--info-bg); }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; margin-left: -4px; }
.cat-form { display: flex; gap: 8px; margin-top: 12px; max-width: 420px; }
.asset-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; display: block; }
.asset-photo { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; margin-bottom: 8px; }
.asset-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
/* Tracker online state (text + dot, details on mouseover) */
.online-state { display: inline-flex; align-items: center; gap: 6px; cursor: help; white-space: nowrap; }
.online-dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa5b1; }
.is-online .online-dot { background: #2e7d32; box-shadow: 0 0 0 3px #e8f5e9; }
.is-online { color: var(--ok); font-weight: 600; }
.is-offline { color: var(--muted); }
.vehicle-photo { max-width: 320px; width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 8px; }
/* Photo crop dialog (public/js/photo-crop.js) */
.vehicle-photo { aspect-ratio: 2 / 1; max-height: none; }
.crop-dialog { border: 0; border-radius: 10px; padding: 20px; max-width: calc(100vw - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.crop-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.crop-dialog h3 { margin: 0 0 4px; }
.crop-canvas { display: block; margin: 12px 0; border-radius: 6px; cursor: grab; touch-action: none; background: var(--soft-2); }
.crop-canvas:active { cursor: grabbing; }
.crop-canvas:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.crop-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.crop-controls label { display: flex; align-items: center; gap: 8px; margin: 0; }
.crop-controls input[type=range] { width: 200px; }
.crop-info { margin: 8px 0 0; font-size: 13px; }
.crop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* Phones and touch screens: almost the full width, the zoom bar from edge to edge with a big knob, large buttons */
@media (max-width: 640px), (pointer: coarse) {
    .crop-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); padding: 14px; box-sizing: border-box; }
    .crop-dialog .help { display: none; }   /* the gestures need no explanation on a phone */
    .crop-canvas { margin: 10px auto; max-width: 100%; }
    .crop-controls { gap: 10px; }
    .crop-controls label { flex: 1 1 100%; gap: 12px; font-weight: 600; }
    .crop-controls input[type=range] { flex: 1; width: auto; min-width: 0; height: 44px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; }
    .crop-controls input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--track); }
    .crop-controls input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; margin-top: -12px; border-radius: 50%;
        background: var(--primary); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
    .crop-controls input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--track); }
    .crop-controls input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
    .crop-controls .btn { flex: 1 1 0; min-height: 46px; font-size: 18px; }
    .crop-actions { gap: 10px; margin-top: 14px; }
    .crop-actions .btn { flex: 1 1 0; min-height: 52px; font-size: 17px; font-weight: 600; }
}
/* Vehicle photo: save only the photo */
.photo-save-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
/* Notifications top right (public/js/toast.js) */
.toasts { position: fixed; top: calc(var(--topbar-height, 0px) + 16px); right: 16px; z-index: 5000; display: flex; flex-direction: column; gap: 8px;
    width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--surface); color: var(--text);
    border-left: 4px solid var(--ok); box-shadow: 0 6px 24px rgba(0,0,0,.18); pointer-events: auto;
    transform: translateX(calc(100% + 24px)); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.error { border-left-color: var(--danger); }
.toast .toast-icon { flex: none; font-weight: 700; color: var(--ok); }
.toast.error .toast-icon { color: var(--danger); }
.toast .toast-text { flex: 1; }
.toast .toast-close { flex: none; border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
/* Month picker (public/js/month-picker.js) */
.mp-wrap { position: relative; display: flex; max-width: 200px; }
.mp-wrap input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mp-toggle { flex: none; width: 40px; border: 1px solid var(--border); border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface); color: var(--text);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mp-toggle:hover, .mp-toggle[aria-expanded="true"] { background: var(--soft-2); }
.mp-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 1000; width: 252px; padding: 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mp-nav { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text); }
.mp-nav:hover { background: var(--soft-2); }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mp-month { padding: 8px 0; border: 1px solid transparent; border-radius: 6px; background: none; font: inherit; font-size: 14px; cursor: pointer; color: var(--text); }
.mp-month:hover { background: var(--soft-2); }
.mp-month.current { border-color: var(--border); }
.mp-month.selected { background: var(--primary); color: var(--primary-text); }
.mp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.mp-link { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 13px; color: var(--primary); cursor: pointer; }
.mp-link:hover { text-decoration: underline; }
.mp-nav:focus-visible, .mp-month:focus-visible, .mp-link:focus-visible, .mp-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Autosave fields (public/js/autosave.js) */
input.is-saving { background: var(--soft-2); }
input.is-saved { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(46,125,50,.2); transition: box-shadow .3s, border-color .3s; }
input[aria-invalid="true"] { border-color: var(--danger); }
.autosave-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
/* Visible to screen readers only */
.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; }
/* Asset receipts (Kaufbelege) */
.doc-name { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.doc-name .icon { flex: none; color: var(--muted); }
.doc-actions { white-space: nowrap; text-align: right; }
.doc-actions form { display: inline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 5px 7px; vertical-align: middle; }
.icon-btn .icon { width: 18px; height: 18px; }
.doc-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.doc-upload label { width: 100%; margin: 0; }
.doc-upload .help { width: 100%; margin: 0; }
.doc-modal { width: min(1000px, calc(100vw - 32px)); height: min(90vh, 1200px); padding: 0; border: 0; border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.3); overflow: hidden; }
.doc-modal[open] { display: flex; flex-direction: column; }
.doc-modal::backdrop { background: rgba(15, 23, 42, .6); }
.doc-modal-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.doc-modal-head strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-modal-body { flex: 1; overflow: auto; background: #525659; display: flex; }
.doc-modal-body iframe { flex: 1; border: 0; width: 100%; background: var(--surface); }
.doc-modal-body img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: var(--surface); }
.doc-modal-body img.full { max-width: none; max-height: none; cursor: zoom-out; }
/* doc modal body stacks the PDF frame and the hint */
.doc-modal-body { flex-direction: column; }
.doc-modal-hint { margin: 0; padding: 6px 14px; background: var(--surface); border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
/* Tracker details modal (device management) */
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .icon-btn + .icon-btn { margin-left: 4px; }
.info-modal { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.info-modal[open] { display: flex; flex-direction: column; }
.info-modal::backdrop { background: rgba(15, 23, 42, .55); }
.info-modal-body { overflow: auto; padding: 16px 18px; }
.ti-photo { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; margin-bottom: 14px; }
.ti-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px 24px; }
.ti-grid h3 { margin: 0 0 6px; font-size: 15px; }
.ti-grid dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; font-size: 14px; }
.ti-grid dt { color: var(--muted); }
.ti-grid dd { margin: 0; overflow-wrap: anywhere; }
.ti-inspection.soon { color: var(--warn-text); font-weight: 600; }
.ti-inspection.overdue { color: var(--danger); font-weight: 600; }
.ti-ok { color: var(--ok); }
.ti-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.ti-config { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.ti-config h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ti-config p { margin: 0 0 8px; }
.ti-config-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Asset position map (asset page) */
.asset-map { height: 300px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; z-index: 0; }
.asset-pin { width: 30px; height: 30px; box-sizing: border-box; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: var(--pin, #52606d); border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center; color: #fff; }
.asset-pin svg { transform: rotate(45deg); width: 15px; height: 15px; }
.asset-pin-tip { font: 13px/1.35 system-ui, sans-serif; padding: 6px 9px; border-radius: 6px; }
.map-link { font-size: 13px; }
/* Asset warranty state */
.warranty.soon { color: var(--warn-text); font-weight: 600; }
.warranty.expired { color: var(--danger); }
/* Asset form: tag address with QR scan button */
.input-with-button { display: flex; gap: 6px; }
.input-with-button input, .input-with-button select { flex: 1; min-width: 0; }
.input-with-button .icon-btn { flex: none; padding: 7px 9px; }
.tag-status.is-ok { color: var(--ok); }
.tag-status.is-error { color: var(--danger); }
.scan-modal { width: min(520px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.scan-modal::backdrop { background: rgba(15, 23, 42, .6); }
.scan-body { padding: 12px 14px 14px; }
.scan-frame { position: relative; background: #111; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-target { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-message { margin: 10px 0 0; font-size: 14px; color: var(--muted); min-height: 1.4em; }
/* QR scan: frame turns green when a code is recognised */
.scan-target { transition: border-color .15s; }
.scan-target.found { border-color: #2ecc71; box-shadow: 0 0 0 999px rgba(0,0,0,.35), 0 0 0 4px rgba(46,204,113,.5) inset; }
.scan-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.scan-info { font-size: 12px; }
/* QR scan: overlay with aiming marks and the frame around a recognised code */
.scan-frame .scan-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-frame video.mirrored { transform: scaleX(-1); }
.scan-info { font-size: 12px; margin: 4px 0 0; }
/* QR scan zoom (notebook/desktop cameras) */
.scan-frame video { transform-origin: center center; transition: transform .12s ease-out; }
.scan-zoom { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.scan-zoom[hidden] { display: none; }
.scan-zoom label { margin: 0; font-size: 14px; }
.scan-zoom input[type=range] { flex: 1; }
.scan-zoom output { min-width: 3.2em; font-variant-numeric: tabular-nums; text-align: right; }
/* Asset category dialog */
.cat-modal { width: min(420px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.cat-modal::backdrop { background: rgba(15, 23, 42, .55); }
.cat-modal-body { padding: 4px 16px 8px; }
.cat-colors { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-colors legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.cat-swatch { margin: 0; cursor: pointer; position: relative; }
.cat-swatch input { position: absolute; opacity: 0; }
.cat-swatch span:first-of-type { display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.cat-swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.cat-swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.cat-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.cat-modal-actions { display: flex; gap: 8px; padding: 12px 16px 16px; }
.cat-spacer { flex: 1; }
.btn .icon { width: 16px; height: 16px; vertical-align: -3px; }
.chip-x .icon { width: 14px; height: 14px; vertical-align: -2px; }
/* Category management list */
.cat-list { list-style: none; margin: 0; padding: 4px 16px; max-height: 50vh; overflow-y: auto; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .cat-name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.cat-row .cat-count { font-size: 13px; white-space: nowrap; }
.cat-empty { padding: 4px 16px; }
.cat-confirm { margin: 8px 0 0; line-height: 1.5; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.cat-modal .doc-modal-head strong { flex: 1; }
/* Receipts in the asset form */
.doc-edit-list { list-style: none; margin: 4px 0 10px; padding: 0; border: 1px solid var(--border); border-radius: 8px; }
.doc-edit-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.doc-edit-list li:last-child { border-bottom: 0; }
.doc-edit-list .doc-name { flex: 1; min-width: 180px; font-weight: 600; }
.doc-edit-actions { display: inline-flex; align-items: center; gap: 6px; }
.doc-edit-actions .doc-remove { margin: 0 0 0 6px; }
.doc-size-error { color: var(--danger); }
/* Company pin (settings map and main map) */
.company-pin { width: 34px; height: 34px; box-sizing: border-box; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: #1f2933; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.company-pin svg { transform: rotate(45deg); width: 17px; height: 17px; }
.company-pin.branch { background: #0b7285; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
/* Tag battery: symbol filled by charge state */
.battery { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.battery-icon { position: relative; display: inline-block; width: 22px; height: 11px; border: 1.5px solid currentColor; border-radius: 2px; box-sizing: border-box; padding: 1px; }
.battery-icon::after { content: ""; position: absolute; right: -4px; top: 2.5px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.battery-icon > span { display: block; height: 100%; background: currentColor; border-radius: 1px; }
.battery-good { color: var(--ok); }
.battery-fair { color: var(--warn-text); }
.battery-low { color: var(--danger); }
/* Asset list: battery, temperature and signal under the tag */
.tag-readings { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.tag-readings .battery-good, .tag-readings .battery-fair, .tag-readings .battery-low { font-weight: 600; }
.tag-interval { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
/* Tracker form: VIN with "Vom Fahrzeug abrufen" */
.vin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vin-row input { flex: 1 1 100%; min-width: 0; }   /* the field on its own line, its buttons below */
.vin-status { margin: 6px 0 0; font-size: 13px; }
.vin-status.ok { color: var(--ok); }
.vin-status.error { color: var(--danger); }
.vin-row .btn { white-space: nowrap; }
/* Password field with eye button (public/js/password-toggle.js) */
.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: flex;
    align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.password-toggle:hover, .password-toggle:focus-visible { color: inherit; background: rgba(0, 0, 0, .06); }
/* Message under a form field (live validation) */
.field-msg { margin: 4px 0 0; min-height: 0; font-size: 13px; color: var(--danger); }
.field-msg:empty { display: none; }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.field-msg.is-note { color: var(--muted); }
.field-note { margin: 6px 0 0; font-size: 13px; color: var(--danger); }
.field-note:empty { display: none; }

/* Page navigation of long lists */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 4px; }
.pager .btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }
.pager .btn:disabled { opacity: .45; cursor: default; }
.table-pager .table-pager-size { width: auto; margin-left: auto; }
table[data-pager] tr[hidden] { display: none; }
.pager .btn[aria-current="page"] { cursor: default; }
.pager-gap { color: var(--muted-2); padding: 0 2px; }
.pager-info { margin-left: 8px; font-size: 13px; }
.lb-trip.lb-undoc { border-style: dashed; border-color: #e8a33d; background: var(--warn-bg); }

/* Page title with its main action at the top right */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
.page-head .btn { flex: none; }
.page-head + p { margin-top: 0; }

/* Profile picture (or the first letter of the name while there is none) */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--track); color: var(--text); font-weight: 700; font-size: 14px; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 96px; height: 96px; font-size: 36px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-name { display: inline-flex; align-items: center; gap: 8px; }

/* Asset: "als verloren melden" and its state */
.asset-lost { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 12px; border-radius: 8px; background: var(--soft-2); font-size: 14px; }
.asset-lost.is-lost { background: var(--danger-bg); color: var(--danger); }
.asset-lost.is-found { background: var(--ok-bg); color: var(--ok); }
.asset-lost form { margin: 0; }

/* Text typed in German, shown translated for the reader (component x-translated): translation, then the original */
.tr-block { display: inline-flex; flex-direction: column; gap: 3px; }
.tr-orig { font-size: .85em; opacity: .75; white-space: pre-line; }
.tr-de { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 0 4px; border-radius: 3px; background: rgba(127,127,127,.22); margin-right: 3px; vertical-align: 1px; }

/* Tab bar at the top of a page (System, Winterdienst, Tonnendienst …) */
.wd-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.wd-tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.wd-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
