:root {
    color-scheme: light;
    --bg: #f5f6f3;
    --surface: #ffffff;
    --surface-alt: #f0f3ef;
    --line: #dce2dc;
    --text: #202b25;
    --muted: #67746b;
    --accent: #365f4c;
    --accent-hover: #294b3b;
    --soft-accent: #e5eee7;
    --green: #365f4c;
    --yellow: #946325;
    --red: #a8443b;
    --radius: 11px;
    --shadow: 0 3px 16px rgb(26 44 35 / 3%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid #a6bca9; outline-offset: 2px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 238px; flex: 0 0 238px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 15px; position: sticky; top: 0; height: 100vh; z-index: 10; }
.logo { display: flex; align-items: center; gap: 11px; margin: 3px 10px 42px; font-size: 20px; font-weight: 750; letter-spacing: -.8px; color: var(--text); }
.logo span:not(.brandmark) { color: var(--accent); }
.logo small { display: block; font-size: 9px; font-weight: 650; letter-spacing: 1.6px; color: var(--muted); }
.brandmark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 27px; }
.brandmark.small { flex-shrink: 0; width: 37px; height: 37px; font-size: 23px; border-radius: 9px; }
.sidebar nav { display: grid; gap: 3px; }
.nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; text-align: left; background: transparent; border: none; border-radius: 8px; color: #59685f; font-weight: 550; }
.nav:hover { background: #f3f6f2; color: var(--text); }
.nav.active { background: var(--soft-accent); color: var(--accent); font-weight: 700; }
.sidebottom { margin-top: auto; padding: 0 12px; display: grid; gap: 14px; color: var(--muted); font-size: 12px; }
.online-dot { color: #538269; }
.main { width: calc(100% - 238px); min-width: 0; }
.top { height: 67px; padding: 0 37px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.crumb { color: #76847c; font-size: 11px; letter-spacing: 1.1px; font-weight: 600; }
.crumb span { margin: 0 10px; color: #acb6ae; }
.crumb strong { color: var(--text); }
.right { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--soft-accent); color: var(--accent); }
.content { max-width: 1540px; margin: 0 auto; padding: 35px 37px 80px; }
.pageheading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--accent); letter-spacing: 1.4px; font-size: 10px; font-weight: 750; }
h1 { margin: 5px 0 7px; font-size: clamp(25px, 2.5vw, 32px); letter-spacing: -.9px; line-height: 1.2; }
h2, h3 { letter-spacing: -.3px; }
p { margin: 0; color: var(--muted); }
.headingactions { display: flex; gap: 9px; align-items: center; }
.btn, input, select, textarea { min-width: 0; border: 1px solid #cad4cc; border-radius: 8px; background: #fff; color: var(--text); outline-offset: 2px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 5px; padding: 10px 15px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.btn:hover { border-color: var(--accent); background: #f6f9f6; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.danger { background: #fff5f3; border-color: #e7c2bb; color: var(--red); }
.btn.small { padding: 7px 11px; font-size: 12px; }
input, select, textarea { padding: 10px 12px; width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid #d7e6db; }
select { min-width: 156px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.kpi .label { font-size: 11px; color: var(--muted); font-weight: 650; }
.kpi .value { margin: 11px 0 5px; font-size: clamp(21px, 2.3vw, 29px); font-weight: 750; letter-spacing: -.9px; overflow-wrap: anywhere; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi-icon { float: right; padding: 6px 10px; border-radius: 8px; background: var(--soft-accent); color: var(--accent); }
.sections { grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); margin-bottom: 16px; }
.cardtitle { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.cardtitle h2 { margin: 0; font-size: 16px; font-weight: 700; }
.cardtitle .muted { font-size: 12px; }
.muted { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 7px 0 10px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #486d5b; }
.dot.green { background: #c5a777; }
.chart { display: block; overflow: visible; width: 100%; height: 240px; }
.chartsaxis { font-size: 11px; fill: #77857a; }
.empty { padding: 35px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.tablewrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data th { padding: 13px 12px; border-bottom: 1px solid var(--line); color: #66766b; text-align: left; text-transform: uppercase; font-size: 10px; letter-spacing: .65px; font-weight: 750; }
.data td { padding: 13px 12px; border-bottom: 1px solid #eef0ec; color: #34433a; vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: none; }
.data tbody tr:hover { background: #f8faf7; }
.data .desc { white-space: normal; min-width: 170px; max-width: 460px; }
.amount { font-weight: 750; color: #203e2d !important; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; border-radius: 5px; padding: 3px 8px; background: #eef1ed; color: #58665c; font-size: 11px; white-space: nowrap; }
.tag.green { background: #e0f1e6; color: #2a6646; }
.tag.yellow { background: #fff1d9; color: #8b5c20; }
.tag.red { background: #ffe9e7; color: #a34039; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.actionbtn { padding: 6px 7px; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
.actionbtn:hover { text-decoration: underline; }
.danger-text { color: #af4c46; }
.vehicles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vehicle-header { display: flex; align-items: center; gap: 13px; }
.vehicle-icon { width: 48px; height: 48px; display: grid; place-items: center; font-size: 24px; border-radius: 9px; background: var(--soft-accent); }
.vehicle-header h3 { margin: 0; font-size: 18px; }
.vehicle-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.vehicle-nums strong { display: block; font-size: 19px; overflow-wrap: anywhere; }
.vehicle-nums small { color: var(--muted); }
.barrow { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.barrow span:first-child { min-width: 88px; max-width: 180px; color: #4e5e53; overflow-wrap: anywhere; }
.bartrack { height: 8px; min-width: 25px; flex: 1; background: #e7ece6; border-radius: 4px; overflow: hidden; }
.barfill { height: 100%; border-radius: 4px; background: #6c8e74; }
.barrow strong { min-width: 94px; text-align: right; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.tools input { min-width: 190px; }
.notice { padding: 13px 15px; margin: 12px 0; border: 1px solid #e5d4b7; border-radius: 8px; background: #fff9ed; color: #825d2c; }
.success { color: var(--green); }
.settingsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: grid; gap: 16px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.formgrid .wide { grid-column: 1/-1; }
label { display: grid; gap: 6px; color: #5a6b5f; font-size: 12px; font-weight: 650; }
label input, label select, label textarea { width: 100%; color: var(--text); font-size: 14px; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 9px; }
.check input { width: auto; }
.formactions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.chat { display: grid; gap: 12px; max-height: 620px; overflow: auto; padding: 10px 3px 20px; }
.bubble { max-width: 87%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; background: var(--surface-alt); white-space: pre-wrap; line-height: 1.7; }
.bubble.me { margin-left: auto; background: #e5eee7; border-radius: 12px 12px 3px 12px; }
.chatbar { display: flex; gap: 10px; }
.chatbar textarea { flex: 1; resize: vertical; min-height: 52px; }
.model-table td { font-size: 12px; }
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.authbox { width: 100%; max-width: 440px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 60px rgb(20 40 27 / 8%); }
.authbox h1 { font-size: 28px; }
.authbox p { margin-bottom: 25px; }
.authbox form { display: grid; gap: 17px; }
.authbox form .btn { margin: 9px 0 4px; }
.authbox small { display: block; margin-top: 18px; color: var(--muted); }
.alert { padding: 12px; margin: 15px 0; border: 1px solid #e4b4b1; border-radius: 8px; background: #fff0ef; color: #913830; }
dialog { width: min(640px, calc(100% - 20px)); max-height: 92vh; overflow: auto; padding: 25px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 30px 100px rgb(0 0 0 / 20%); }
dialog::backdrop { background: rgb(21 33 25 / 55%); }
dialog h2 { margin: 0 0 20px; }
.filedrop { display: grid; place-items: center; gap: 9px; padding: 25px; border: 1px dashed #b4c5b5; border-radius: 9px; text-align: center; }
.filedrop input { max-width: 100%; }
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: none; max-width: calc(100% - 40px); padding: 12px 17px; background: #284936; color: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgb(0 0 0 / 16%); }
.loading { padding: 65px 15px; text-align: center; color: var(--muted); }

.workspace { display: grid; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.section-head h2 { margin: 0 0 2px; font-size: 19px; }
.section-head p { font-size: 13px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-panel { padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.filter-grid { display: grid; grid-template-columns: minmax(170px, 2fr) repeat(2, minmax(120px, 1fr)) repeat(3, minmax(125px, 1fr)); gap: 12px; }
.filter-field { min-width: 0; }
.filter-field span { font-size: 11px; color: var(--muted); }
.filter-field input, .filter-field select { width: 100%; min-width: 0; padding: 9px 10px; }
.filter-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 15px; padding-top: 13px; border-top: 1px solid #edf0ea; }
.quick-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.quick-filters > span { margin-right: 6px; font-size: 12px; color: var(--muted); }
.filter-chip { border: 1px solid var(--line); border-radius: 20px; padding: 5px 10px; background: #fff; color: #4b6152; font-size: 12px; }
.filter-chip:hover { border-color: var(--accent); background: var(--soft-accent); }
.text-button { border: 0; padding: 7px; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
.table-summary { display: flex; flex-wrap: wrap; gap: 35px; padding: 13px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-summary > div { display: grid; align-content: center; }
.summary-value { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.summary-label { color: var(--muted); font-size: 12px; }
.workspace > .card.tablewrap { padding: 5px 10px; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 3px 2px; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; align-items: center; gap: 12px; }
.empty-row td { text-align: center; padding: 30px; color: var(--muted); }

@media (max-width: 1300px) {
    .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
    .sections, .settingsgrid { grid-template-columns: 1fr; }
    .top { padding: 0 24px; }
    .content { padding: 28px 24px 70px; }
}

@media (max-width: 760px) {
    .shell { display: block; padding-bottom: 65px; }
    .sidebar { position: fixed; inset: auto 0 0; width: 100%; height: 64px; padding: 5px; background: #fff; border-top: 1px solid var(--line); border-right: 0; }
    .sidebar .logo, .sidebar .sidebottom { display: none; }
    .sidebar nav { display: grid; grid-template-columns: repeat(6, 1fr); height: 100%; gap: 1px; }
    .nav { display: flex; flex-direction: column; justify-content: center; gap: 0; padding: 4px 1px; text-align: center; font-size: 17px; border-radius: 6px; }
    .nav span { display: block; font-size: 9px; line-height: 1.25; font-weight: 650; }
    .main { width: 100%; }
    .top { height: 52px; padding: 0 16px; }
    .content { padding: 22px 14px 55px; }
    .pageheading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
    .headingactions { width: 100%; }
    .headingactions select { min-width: 0; flex: 1; }
    .headingactions .btn { flex-shrink: 0; }
    .vehicles { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid .filter-field:first-child { grid-column: 1 / -1; }
    .table-summary { gap: 18px; }
    .section-actions { width: 100%; }
    .section-actions .btn { flex: 1; }
    .record-table, .record-table tbody, .record-table tr, .record-table td { display: block; width: 100%; }
    .record-table thead { display: none; }
    .workspace > .card.tablewrap { overflow: visible; padding: 0 12px; }
    .record-table tbody tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .record-table tbody tr:last-child { border: 0; }
    .record-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border: 0; padding: 5px 3px; white-space: normal; text-align: right; }
    .record-table td::before { content: attr(data-label); flex: 0 0 90px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; }
    .record-table .desc { min-width: 0; max-width: none; }
    .record-table td .row-actions { justify-content: flex-end; }
    .record-table .empty-row td { display: block; text-align: center; }
    .record-table .empty-row td::before { display: none; }
}

@media (max-width: 450px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .card { padding: 15px; }
    .kpi .value { font-size: 19px; }
    .kpi .hint { font-size: 11px; }
    .kpi-icon { display: none; }
    .filter-panel { padding: 12px; }
    .filter-grid { gap: 9px; }
    .filter-grid .filter-field:nth-child(6), .filter-grid .filter-field:nth-child(7) { grid-column: span 1; }
    .formgrid { grid-template-columns: 1fr; }
    .formgrid .wide { grid-column: auto; }
    .table-summary { gap: 12px; }
    .table-summary > div { min-width: 100px; }
    .summary-value { font-size: 17px; }
    .nav span { font-size: 8px; }
    .crumb { font-size: 9px; }
    .right { font-size: 11px; }
    .pagination > div { width: 100%; justify-content: space-between; }
}

.mobile-logout { display: none; }
@media (max-width: 760px) { .mobile-logout { display: inline; margin-left: 5px; font-size: 11px; } }

/* Tabellen: Kilometerfilter und Seitennavigation */
.filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filter-grid .filter-field:first-child { grid-column: span 2; }
.pagination-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.pagination-controls .btn { min-width: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.page-number { min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; font-size: 12px; }
.page-number.current { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.page-number:hover:not(.current) { background: var(--soft-accent); }
.google-chart { width: 100%; min-height: 240px; overflow: hidden; }
.google-chart.compact-chart { min-height: 220px; }
.nav i { width: 20px; text-align: center; font-size: 15px; }
@media (max-width: 760px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid .filter-field:first-child { grid-column: span 2; }
    .pagination { align-items: center; flex-direction: column; }
    .pagination-controls { justify-content: center; width: 100%; }
    .pager-label { display: none; }
    .nav i { font-size: 17px; }
}
@media (max-width: 380px) {
    .page-number { min-width: 29px; width: 29px; }
    .pagination-controls .btn { min-width: 29px; }
}

.model-group { margin: 18px 0 24px; }
.model-group h3 { font-size: 1rem; font-weight: 650; padding: 0 2px 10px; margin: 0; }
.model-group h3 small { font-size: .78rem; color: #718174; font-weight: 400; }
.model-group .tablewrap { margin: 0; }


/* 2026 UI refinement: typography, safe-area and touch targets */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; }
button, input, textarea, select { -webkit-appearance: none; appearance: none; }
input[type="checkbox"], input[type="radio"] { -webkit-appearance: auto; appearance: auto; }
button, a, select { -webkit-tap-highlight-color: transparent; }
select { padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2367746b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.btn { min-height: 42px; }
.card { box-shadow: 0 2px 12px rgb(29 51 38 / 3%); }
#modal { width: min(700px, calc(100% - 28px)); }
.calculation-note { background: #f0f5f0; color: #45614d; border-radius: 9px; padding: 12px 14px; font-size: 12px; margin-top: 12px; }
.form-intro { margin-bottom: 18px; }
.upload-panel { border: 1.5px dashed #a8bdac; border-radius: 12px; padding: 20px; background: #f7faf7; display: grid; gap: 9px; }
.upload-panel > span { font-size: 15px; color: var(--accent); font-weight: 700; }
.upload-panel > span i { margin-right: 6px; }
.upload-panel small { color: var(--muted); font-weight: 400; }
.upload-panel input { width: 100%; max-width: 100%; padding: 8px; background: #fff; }
.upload-file { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 8px 11px; font-size: 12px; overflow-wrap: anywhere; margin-top: 5px; }
.login-layout { width: min(1050px, 100%); min-height: min(660px, 88vh); display: grid; grid-template-columns: .95fr 1fr; box-shadow: 0 24px 90px rgb(24 40 32 / 10%); border: 1px solid #e0e6de; border-radius: 20px; overflow: hidden; background: #fff; }
.login-info { background: #2d4b3e; color: #fff; padding: 42px; display: flex; flex-direction: column; justify-content: space-between; }
.login-wordmark { font-size: 20px; font-weight: 750; letter-spacing: -.6px; display: flex; gap: 12px; align-items: center; }
.login-wordmark .brandmark { background: #ffffff19; }
.login-kicker { display: inline-block; font-weight: 700; font-size: 11px; letter-spacing: 1.7px; color: #79987f; margin-bottom: 14px; }
.login-info .login-kicker { color: #b6d5c1; }
.login-intro h2 { font-size: clamp(28px, 3vw, 39px); line-height: 1.17; font-weight: 740; letter-spacing: -1.6px; margin: 0 0 15px; }
.login-intro p { color: #d3e2d7; max-width: 340px; font-size: 15px; }
.login-footer { font-size: 12px; color: #d0e0d4; }
.login-footer i { margin-right: 8px; }
.login-panel { padding: 42px; display: grid; place-items: center; }
.authbox { width: 100%; max-width: 370px; padding: 0; border: 0; box-shadow: none; border-radius: 0; }
.authbox h1 { margin: 0 0 10px; font-size: 34px; letter-spacing: -1.4px; }
.authbox p { margin-bottom: 27px; }
.authbox form { gap: 18px; }
.authbox form label { font-size: 13px; font-weight: 650; }
.authbox form input { display: block; width: 100%; min-height: 48px; margin-top: 7px; }
.authbox .login-submit { display: flex; width: 100%; min-height: 49px; justify-content: space-between; padding-inline: 17px; margin-top: 5px; font-size: 14px; }
.authbox small { text-align: center; }
.authbox small i { margin-right: 5px; }
.login-mobile-brand { display: none; }
@media (max-width: 760px) {
    body.auth { min-height: 100dvh; padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
    .login-layout { min-height: auto; display: block; border: 0; border-radius: 16px; box-shadow: 0 6px 34px rgb(24 40 32 / 7%); }
    .login-info { display: none; }
    .login-panel { padding: 34px 25px 37px; }
    .login-mobile-brand { display: flex; gap: 12px; align-items: center; font-size: 20px; font-weight: 750; margin-bottom: 44px; }
    .authbox h1 { font-size: 30px; }
    .shell { padding-bottom: calc(75px + env(safe-area-inset-bottom)); }
    .sidebar { height: calc(66px + env(safe-area-inset-bottom)); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); z-index: 100; }
    .sidebar nav { display: flex; gap: 0; width: 100%; justify-content: space-between; }
    .sidebar nav .nav { flex: 1 1 0; width: 0; min-width: 0; padding: 4px 0; font-size: 13px; }
    .sidebar nav .nav span { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .sidebar nav .nav i { font-size: 18px; }
    .content { padding: 22px 14px calc(35px + env(safe-area-inset-bottom)); }
    .top { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
    .headingactions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .headingactions select, .headingactions .btn { min-width: 0; width: 100%; }
    #modal { position: fixed; width: 100%; max-width: none; max-height: min(92dvh, 920px); height: auto; margin: auto 0 0; padding: 19px 17px calc(21px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; }
    .formactions { position: sticky; bottom: 0; background: #fff; padding-top: 12px; padding-bottom: max(3px, env(safe-area-inset-bottom)); }
    .formactions .btn { flex: 1; min-height: 46px; }
    .chatbar { flex-direction: column; }
    .chatbar textarea { width: 100%; min-height: 95px; }
    .chatbar button { width: 100%; }
}
@media (max-width: 450px) {
    .formgrid { grid-template-columns: 1fr; }
    .formgrid .wide { grid-column: 1; }
    .headingactions { grid-template-columns: minmax(0, 1fr) auto; }
    .headingactions .btn { padding: 9px; font-size: 11px; }
    .crumb { max-width: 48vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .top .right > span:not(.avatar) { display: none; }
}
@supports (-webkit-touch-callout: none) {
    input, textarea, select { font-size: 16px; }
    .nav { touch-action: manipulation; }
    dialog { -webkit-overflow-scrolling: touch; }
}

/* Asynchrone KI-Anfragen: tatsächlicher Upload-Fortschritt, sonst Aktivitätsanzeige. */
.task-progress { display: grid; gap: 10px; width: 100%; padding: 14px; margin-top: 12px; border: 1px solid #d9e5dc; border-radius: 12px; background: #f6faf6; color: #344b3d; }
.task-progress-header { display: flex; gap: 10px; align-items: center; min-width: 0; font-size: 13px; }
.task-progress-label { flex: 1; min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.task-progress-time { font-variant-numeric: tabular-nums; color: #607266; }
.task-progress-spinner { display: inline-block; width: 17px; height: 17px; flex: 0 0 17px; border: 2px solid #d0dfd3; border-top-color: #3c7456; border-radius: 50%; animation: task-spin .8s linear infinite; }
.task-progress-track { height: 5px; overflow: hidden; border-radius: 9px; background: #d9e5dc; }
.task-progress-fill { width: 35%; height: 100%; background: #4c8562; border-radius: inherit; animation: task-slide 1.8s ease-in-out infinite alternate; }
.task-progress-fill.determinate { animation: none; transition: width .15s ease; }
.task-progress-detail { font-size: 12px; line-height: 1.45; color: #607266; }
#scanForm .formactions { flex-wrap: wrap; }
#scanForm .formactions .task-progress { flex: 1 1 100%; order: 3; }
#chat .task-progress { margin-bottom: 8px; }
@keyframes task-spin { to { transform: rotate(360deg); } }
@keyframes task-slide { from { transform: translateX(-85%); } to { transform: translateX(220%); } }
@media (prefers-reduced-motion: reduce) { .task-progress-spinner, .task-progress-fill { animation: none; } }

.scan-error { margin: 14px 0; padding: 13px 15px; background: #fff1ee; border: 1px solid #dba9a2; border-radius: 9px; color: #88382e; overflow-wrap: anywhere; }
.scan-error[hidden], .formactions [hidden] { display: none !important; }
