html { background: var(--color-canvas); }
body {
    min-width: 320px;
    color: var(--color-text);
    background: var(--color-canvas);
    font-family: var(--font-sans);
}
button, input, select, textarea { font: inherit; }
.icon { display: block; flex: 0 0 auto; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns .18s ease;
}
.app-sidebar {
    position: sticky;
    z-index: 50;
    top: 0;
    height: 100vh;
    min-height: 0;
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--color-border);
    color: var(--color-text);
    background: var(--color-surface);
}
.sidebar-brand-row {
    min-height: 46px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.app-sidebar .brand {
    min-width: 0;
    min-height: var(--control-size);
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
}
.brand-mark {
    width: 34px;
    height: 34px;
    display: block;
    flex: 0 0 auto;
}
.brand-copy { min-width: 0; display: grid; gap: 1px; }
.brand-copy strong { overflow: hidden; font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.brand-name { color: #263a46; font-weight: 800; }
.brand-name span { color: #0b7fc0; }
.brand-copy small { color: var(--color-text-muted); font-size: .68rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-collapse,
.sidebar-toggle,
.command-palette-heading button {
    width: var(--control-size);
    height: var(--control-size);
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    background: transparent;
    cursor: pointer;
}
.sidebar-collapse:hover,
.sidebar-toggle:hover,
.command-palette-heading button:hover { color: var(--color-accent-strong); background: var(--color-accent-soft); }
.command-trigger {
    min-height: var(--control-size);
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    background: var(--color-surface-subtle);
    cursor: pointer;
}
.sidebar-command { width: 100%; padding: 0 10px; margin-bottom: 12px; text-align: left; }
.command-trigger span { min-width: 0; overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
kbd {
    padding: 2px 6px;
    border: 1px solid var(--color-border-strong);
    border-radius: 5px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    box-shadow: 0 1px 0 var(--color-border);
    font-family: var(--font-sans);
    font-size: .64rem;
    line-height: 1.35;
}
.sidebar-navigation {
    min-height: 0;
    padding-right: 2px;
    display: grid;
    align-content: start;
    gap: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.sidebar-navigation a {
    min-height: var(--control-size);
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: .82rem;
    font-weight: 650;
    text-decoration: none;
}
.sidebar-navigation a:hover { color: var(--color-text); background: var(--color-surface-hover); }
.sidebar-navigation a.active {
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    box-shadow: inset 3px 0 var(--color-accent);
}
.sidebar-navigation a.active .icon { color: var(--color-accent); }
.sidebar-section { margin-top: 10px; display: grid; gap: 2px; }
.sidebar-section h2 {
    margin: 0;
    padding: 8px 10px 5px;
    color: var(--color-text-muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.sidebar-section.is-active h2 { color: var(--color-accent-strong); }
.sidebar-user {
    min-height: 54px;
    margin-top: auto;
    padding: 10px 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--color-border);
}
.user-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    font-size: .76rem;
    font-weight: 800;
}
.sidebar-user > span:last-child,
.sidebar-user-name { min-width: 0; flex: 1 1 auto; display: grid; gap: 1px; color: inherit; text-decoration: none; }
.sidebar-user-name:hover strong { text-decoration: underline; }
.sidebar-logout { margin: 0; flex: 0 0 auto; }
.sidebar-logout button { padding: 5px 9px; font-size: .7rem; }
.sidebar-user strong, .sidebar-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: .76rem; }
.sidebar-user small { color: var(--color-text-muted); font-size: .67rem; }

.app-main { min-width: 0; }
.topbar.app-header {
    position: sticky;
    z-index: 40;
    top: 0;
    min-height: var(--header-height);
    padding: 0 clamp(16px, 2.5vw, 36px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    background: rgb(255 255 255 / 92%);
    box-shadow: none;
    backdrop-filter: blur(14px);
}
.app-header-context, .app-header-actions { min-width: 0; display: flex; align-items: center; gap: 12px; }
.sidebar-toggle { display: none; }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: .78rem; }
.breadcrumbs span { color: var(--color-text-muted); }
.breadcrumbs strong { overflow: hidden; color: var(--color-text); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs .icon { color: var(--color-border-strong); }
.header-command { min-width: 150px; padding: 0 9px 0 11px; }
.header-user-name { color: var(--color-text-secondary); font-size: .78rem; font-weight: 650; white-space: nowrap; text-decoration: none; }
/* KalkuLog ist ein Arbeitswerkzeug: Inhalte nutzen die volle Fensterbreite.
   Nur reine Eingabeformulare bleiben für gute Lesbarkeit schmaler. */
.container.app-content {
    width: calc(100% - clamp(32px, 3vw, 56px));
    max-width: none;
    margin: 0 auto;
    padding: clamp(20px, 2.2vw, 32px) 0 72px;
}
.container.app-content.narrow-content { width: min(var(--content-max), calc(100% - clamp(32px, 3vw, 56px))); }
/* Kartenseiten nutzen zusätzlich die volle Fensterhöhe. */
.container.app-content.fill-height-content { padding-bottom: 16px; }
.fill-height-content > .page-heading, .fill-height-content > .hero { margin-bottom: 14px; }
.fill-height-content .ptv-planner-shell { height: max(560px, calc(100dvh - 240px)); align-items: stretch; }
.fill-height-content .ptv-route-planner-form { min-height: 0; overflow-y: auto; }
.fill-height-content .ptv-planner-controls { min-height: 100%; }
.fill-height-content .ptv-map-panel { min-height: 0; display: flex; flex-direction: column; }
.fill-height-content .ptv-route-map { min-height: 0; flex: 1 1 auto; }
/* Rückmeldungen als gut sichtbare Hinweise oben rechts (bleiben beim Scrollen sichtbar). */
.toast-stack { position: fixed; z-index: 2000; top: calc(var(--header-height) + 12px); right: 20px; width: min(460px, calc(100vw - 40px)); display: grid; gap: 10px; }
.toast { padding: 12px 12px 12px 16px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--color-border-strong); border-left-width: 5px; border-radius: var(--radius-md); color: var(--color-text); background: var(--color-surface); box-shadow: var(--shadow-float); }
.toast p { margin: 0; flex: 1 1 auto; font-size: .86rem; line-height: 1.45; }
.toast button { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); color: var(--color-text-secondary); background: transparent; cursor: pointer; }
.toast button:hover { color: var(--color-text); background: var(--color-surface-subtle); }
.toast-success { border-left-color: var(--color-success); background: var(--color-success-soft); }
.toast-error { border-left-color: var(--color-danger); background: var(--color-danger-soft); }
.toast-info { border-left-color: var(--color-accent); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease; }
.sidebar-backdrop { display: none; }

/* Shared productive UI components */
.app-content h1 {
    color: var(--color-text);
    font-size: clamp(1.85rem, 3vw, 2.65rem);
    font-weight: 720;
    line-height: 1.08;
    letter-spacing: -.025em;
}
.app-content h2 { color: var(--color-text); }
.app-content .eyebrow,
.app-content .kicker { color: var(--color-accent-strong); }
.app-content .lede { color: var(--color-text-secondary); line-height: 1.55; }
.page-heading,
.hero {
    margin-bottom: 28px;
    align-items: flex-end;
}
.page-heading > div:first-child,
.hero > div:first-child { min-width: 0; }

/* Kompakter Seitenkopf: Arbeitsfläche geht vor Überschrift. */
.app-content > .page-heading,
.app-content > .hero { margin-bottom: 16px; align-items: center; }
.app-content > :is(.page-heading, .hero) h1 { font-size: clamp(1.35rem, 1.8vw, 1.7rem); line-height: 1.15; letter-spacing: -.015em; }
.app-content > :is(.page-heading, .hero) .eyebrow { margin: 0 0 2px; font-size: .66rem; }
.app-content > :is(.page-heading, .hero) .lede { max-width: 980px; margin: 4px 0 0; font-size: .84rem; line-height: 1.4; }
.app-content > :is(.page-heading, .hero) .back-link { margin-bottom: 4px; font-size: .8rem; }
.container.app-content { padding-top: 16px; }
.primary,
.secondary,
.button {
    min-height: var(--control-size);
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 720;
    line-height: 1.2;
}
.primary { border: 1px solid var(--color-accent); color: white; background: var(--color-accent); }
.primary:hover:not(:disabled) { border-color: var(--color-accent-strong); background: var(--color-accent-strong); }
.secondary { border: 1px solid var(--color-border-strong); color: var(--color-text); background: var(--color-surface); }
.secondary:hover:not(:disabled) { border-color: var(--color-accent); color: var(--color-accent-strong); background: var(--color-accent-soft); }
:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-accent) 34%, transparent);
    outline-offset: 2px;
}
.panel,
.form-card,
.profile-card,
.table-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-subtle);
}
.panel-heading {
    min-height: 62px;
    padding: 16px 20px;
    border-bottom-color: var(--color-border);
}
.panel-heading h2 { font-size: 1rem; line-height: 1.3; }
.panel-heading-with-action,
.list-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-heading p,
.list-panel-heading p { margin: 4px 0 0; color: var(--color-text-secondary); font-size: .76rem; }
.text-link { min-height: var(--control-size); display: inline-flex; align-items: center; gap: 4px; color: var(--color-accent-strong); font-size: .76rem; font-weight: 720; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.status { color: var(--color-accent-strong); background: var(--color-accent-soft); }
.status-draft { color: var(--color-warning); background: var(--color-warning-soft); }
.status-success,
.status-succeeded { color: var(--color-success); background: var(--color-success-soft); }
.status-failed,
.status-error { color: var(--color-danger); background: var(--color-danger-soft); }

/* Detailseite Kundenkalkulation */
.tab-count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; color: var(--color-text-secondary); background: var(--color-surface-subtle); font-size: .68rem; font-variant-numeric: tabular-nums; }
.detail-tab.active .tab-count { color: var(--color-accent-strong); background: var(--color-accent-soft); }
.tab-status { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .64rem; }
.sticky-action-bar-actions { display: flex; align-items: center; gap: 8px; }
.sticky-action-bar-actions .button-link { display: inline-flex; align-items: center; gap: 6px; }
.sticky-action-bar .text-link { min-height: 0; }
.overview-offer-status { margin-top: 22px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.overview-offer-status > div { min-width: 0; display: flex; align-items: center; gap: 14px; }
.overview-offer-status strong { display: block; font-size: .9rem; }
.overview-offer-status p { margin: 3px 0 0; color: var(--color-text-secondary); font-size: .8rem; }
.help-details { margin: 0 20px 18px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.help-details > summary { padding: 10px 14px; color: var(--color-accent-strong); font-size: .78rem; font-weight: 720; cursor: pointer; }
.help-details > ul { margin: 0; padding: 0 18px 12px 34px; display: grid; gap: 6px; color: var(--color-text-secondary); font-size: .78rem; line-height: 1.5; }
.table-detail-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text-secondary); font-size: .76rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.table-detail-toggle input { width: auto; margin: 0; accent-color: var(--color-accent); }
[data-detail-table]:not(.show-details) .col-detail { display: none; }
.summary-card.is-warning { border-color: #fcd34d; background: var(--color-warning-soft); }
.summary-card.is-warning strong { color: var(--color-warning); }
.offer-live-results tr.is-failed th, .offer-live-results tr.is-failed td { background: var(--color-danger-soft); }
.result-error-copy { display: block; margin-top: 4px; color: var(--color-text-secondary); font-size: .74rem; line-height: 1.4; white-space: normal; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.table-secondary-copy { max-width: 420px; color: var(--color-text-secondary); }

/* Aktionsmenü für selten genutzte Aktionen */
.action-menu { position: relative; }
.action-menu > summary { list-style: none; cursor: pointer; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu-body { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: 320px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-float); }
.action-menu-body form { display: grid; gap: 8px; }
.action-menu-body label { color: var(--color-text); font-size: .8rem; font-weight: 720; }
.segmented-filter { padding: 3px; display: inline-flex; gap: 2px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.segmented-filter a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--color-text-secondary); font-size: .78rem; font-weight: 700; text-decoration: none; }
.segmented-filter a:hover { color: var(--color-text); }
.segmented-filter a[aria-current="page"] { color: var(--color-accent-strong); background: var(--color-surface); box-shadow: var(--shadow-subtle); }
.inline-create-form { display: flex; align-items: center; gap: 8px; }

/* Routenplaner: Karte mit Tourdetails-Flyout (angelehnt an map&guide) */
.ptv-map-panel { --route-flyout-width: min(410px, 46%); position: relative; }
.ptv-map-panel .ptv-route-map { position: relative; z-index: 0; }
.ptv-map-panel.flyout-open .leaflet-bottom.leaflet-right { right: calc(var(--route-flyout-width) + 12px); }
.route-flyout {
    position: absolute;
    z-index: 900;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: var(--route-flyout-width);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-float);
}
.route-flyout[hidden] { display: none; }
.route-flyout-header { padding: 12px 10px 12px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; color: white; background: var(--color-accent); }
.route-flyout-header p { margin: 0 0 2px; font-size: .72rem; font-weight: 650; opacity: .85; }
.route-flyout-header h2 { margin: 0; color: inherit; font-size: 1.02rem; line-height: 1.3; }
.route-flyout-close { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); color: white; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.route-flyout-close:hover { background: rgb(255 255 255 / .16); }
.route-flyout-tabs { margin: 0; padding: 0 8px; flex: 0 0 auto; background: var(--color-surface); }
.route-flyout-tabs .detail-tab { padding: 0 10px; }
.route-flyout-body { min-height: 0; padding: 12px; flex: 1 1 auto; overflow-y: auto; background: var(--color-surface-subtle); }
.route-flyout-body .detail-tab-panel { display: grid; align-content: start; gap: 10px; }
.route-flyout-body .detail-tab-panel[hidden] { display: none; }
.route-flyout-body .detail-tab-panel:focus-visible { outline-offset: -2px; }
.route-flyout-open {
    position: absolute;
    z-index: 900;
    top: 12px;
    right: 12px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    border: 0;
    border-radius: var(--radius-md);
    color: white;
    background: var(--color-accent);
    box-shadow: var(--shadow-float);
    font-size: .82rem;
    font-weight: 750;
    cursor: pointer;
}
.route-flyout-open[hidden] { display: none; }
.route-flyout-open span { font-weight: 650; opacity: .9; font-variant-numeric: tabular-nums; }
.route-flyout-open:hover { background: var(--color-accent-strong); }

.route-card { padding: 0 0 10px; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.route-card h3 {
    margin: 0 0 8px;
    padding: 7px 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-left: 3px solid var(--color-accent);
    color: var(--color-accent-strong);
    background: linear-gradient(90deg, var(--color-accent-soft), transparent);
    font-size: .82rem;
}
.route-card h3 small { color: var(--color-text-secondary); font-size: .72rem; font-weight: 650; }
.route-card-values { margin: 0; padding: 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.route-card-values div:nth-child(2n) { text-align: right; }
.route-card-values dt { color: var(--color-text-secondary); font-size: .74rem; font-weight: 650; }
.route-card-values dd { margin: 2px 0 0; color: var(--color-accent-strong); font-size: 1.32rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.route-card-values dd small { color: var(--color-text-secondary); font-size: .78rem; font-weight: 650; }
.route-card-values dd.is-text { color: var(--color-text); font-size: .95rem; }
.route-cost-table { width: calc(100% - 24px); margin: 0 12px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.route-cost-table th, .route-cost-table td { padding: 5px 0; vertical-align: top; border-bottom: 1px solid var(--color-border); }
.route-flyout :is(.route-cost-table, .route-flyout-table) th { letter-spacing: normal; text-transform: none; }
.route-cost-table th { color: var(--color-text); font-size: .82rem; font-weight: 700; text-align: left; background: transparent; }
.route-cost-table th small { margin-top: 1px; display: block; color: var(--color-text-secondary); font-size: .72rem; font-weight: 600; }
.route-cost-table td { color: var(--color-text); font-size: .92rem; font-weight: 750; text-align: right; white-space: nowrap; }
.route-cost-table tfoot th, .route-cost-table tfoot td { padding-top: 8px; border-top: 2px solid var(--color-text); border-bottom: 0; }
.route-cost-table tfoot td { color: var(--color-success); font-size: 1.3rem; font-weight: 800; }

.route-flyout-alert { margin: 0; padding: 7px 10px; border-left: 3px solid var(--color-info); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-info-soft); font-size: .76rem; line-height: 1.4; }
.route-flyout-alert.is-warning, .route-flyout-alert.is-hazard { border-left-color: var(--color-warning); background: var(--color-warning-soft); }
.route-flyout-alert.is-error { border-left-color: var(--color-danger); background: var(--color-danger-soft); }
.route-flyout-heading { margin: 4px 0 0; color: var(--color-text); font-size: .82rem; }
.route-flyout-table { width: 100%; border-collapse: collapse; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: .78rem; font-variant-numeric: tabular-nums; }
.route-flyout-table :is(th, td) { padding: 5px 8px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; }
.route-flyout-table thead th { color: var(--color-text-secondary); background: var(--color-surface-subtle); font-size: .7rem; }
.route-flyout-table tbody th { max-width: 170px; font-weight: 650; }
.route-flyout-table th small { display: block; color: var(--color-text-secondary); font-size: .68rem; font-weight: 550; }
.route-flyout-table .number { text-align: right; white-space: nowrap; }
.route-flyout-table tfoot :is(th, td) { border-bottom: 0; font-weight: 800; }
.route-flyout-empty, .route-flyout-note { margin: 0; color: var(--color-text-secondary); font-size: .74rem; line-height: 1.45; }
.route-flyout-details { border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.route-flyout-details > summary { padding: 8px 10px; color: var(--color-accent-strong); font-size: .78rem; font-weight: 720; cursor: pointer; }
.route-flyout-details[open] > summary { border-bottom: 1px solid var(--color-border); }
.route-flyout-details > :not(summary) { margin: 8px; width: calc(100% - 16px); }
.route-flyout-facts { margin: 0; display: grid; gap: 0; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.route-flyout-facts div { padding: 7px 10px; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--color-border); font-size: .78rem; }
.route-flyout-facts div:last-child { border-bottom: 0; }
.route-flyout-facts dt { color: var(--color-text-secondary); font-weight: 650; }
.route-flyout-facts dd { margin: 0; color: var(--color-text); font-weight: 650; }

.route-event-list { margin: 0; padding: 0; display: grid; gap: 2px; list-style: none; }
.route-event-list button, .route-timeline-stop button {
    width: 100%;
    padding: 6px 8px;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.route-event-list button:hover, .route-timeline-stop button:hover { background: var(--color-accent-soft); }
.route-event-list strong, .route-timeline-stop strong { display: block; font-size: .78rem; font-weight: 700; }
.route-event-list small, .route-timeline-stop small { display: block; color: var(--color-text-secondary); font-size: .7rem; }
.route-event-km { color: var(--color-accent-strong); font-size: .76rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.route-timeline { margin: 0; padding: 4px 0; list-style: none; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.route-timeline-stop button { grid-template-columns: 28px minmax(0, 1fr); align-items: center; }
.route-timeline-marker { width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid white; border-radius: 999px; color: white; background: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); font-size: .72rem; font-weight: 800; }
.route-timeline-leg { margin: 0 0 0 20px; padding: 4px 10px 4px 22px; display: flex; flex-wrap: wrap; gap: 4px 14px; border-left: 2px dashed var(--color-border-strong); color: var(--color-text-secondary); font-size: .72rem; font-variant-numeric: tabular-nums; }
.route-timeline-leg span:first-child { color: var(--color-text); font-weight: 750; }
.route-timeline-leg em { color: var(--color-warning); font-style: normal; font-weight: 700; }
.route-timeline-leg.is-violated { border-left-color: var(--color-warning); }

/* Karte: Hinweis, Ebenenauswahl, Klick-Auswahl */
.ptv-map-hint { position: absolute; z-index: 800; left: 12px; bottom: 26px; max-width: calc(100% - 24px); margin: 0; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--color-text); background: rgb(255 255 255 / .92); box-shadow: var(--shadow-subtle); font-size: .76rem; pointer-events: none; }
.ptv-map-layers-control { position: relative; }
.ptv-map-layers-toggle {
    min-height: 34px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid rgb(0 0 0 / .2);
    border-radius: 4px;
    color: var(--color-text);
    background: var(--color-surface);
    background-clip: padding-box;
    font: inherit;
    font-size: .78rem;
    font-weight: 720;
    cursor: pointer;
}
.ptv-map-layers-toggle:hover, .ptv-map-layers-toggle[aria-expanded="true"] { color: var(--color-accent-strong); background-color: var(--color-accent-soft); }
.ptv-map-layers-toggle .is-active-count { min-width: 18px; padding: 0 5px; border-radius: 999px; color: white; background: var(--color-accent); font-size: .68rem; }
.ptv-map-layers { position: absolute; top: calc(100% + 6px); left: 0; width: 250px; padding: 10px 12px; display: grid; gap: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text); background: var(--color-surface); box-shadow: var(--shadow-float); font-size: .78rem; }
.ptv-map-layers[hidden] { display: none; }
.ptv-map-layers-title { margin: 0; color: var(--color-text-secondary); font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; }
.ptv-map-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ptv-map-types label { display: grid; justify-items: center; gap: 3px; font-size: .72rem; font-weight: 650; cursor: pointer; }
.ptv-map-types input { position: absolute; opacity: 0; pointer-events: none; }
.ptv-map-type-swatch { width: 100%; height: 40px; border: 2px solid var(--color-border); border-radius: var(--radius-sm); }
.ptv-map-type-swatch.is-standard { background: linear-gradient(135deg, #f6efd9 0 42%, #f9c74f 42% 50%, #e9e4cf 50% 70%, #9cc5e8 70%); }
.ptv-map-type-swatch.is-mono { background: linear-gradient(135deg, #eeeeee 0 42%, #b8b8b8 42% 50%, #e2e2e2 50% 70%, #cfd4d8 70%); }
.ptv-map-type-swatch.is-satellite { background: linear-gradient(135deg, #2f4a2a 0 35%, #6b7f4a 35% 55%, #44533a 55% 75%, #23384a 75%); }
.ptv-map-types input:checked + .ptv-map-type-swatch { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent-soft); }
.ptv-map-types input:focus-visible + .ptv-map-type-swatch { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.ptv-map-overlays { display: grid; gap: 5px; }
.ptv-map-overlays label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ptv-map-overlays input { width: auto; margin: 0; accent-color: var(--color-accent); }
.ptv-map-layers-note { margin: 0; color: var(--color-text-secondary); font-size: .7rem; line-height: 1.4; }
.ptv-map-layers-note.is-warning { color: var(--color-warning); font-weight: 700; }
.ptv-map-pick { min-width: 230px; display: grid; gap: 8px; font-family: var(--font-sans); }
.ptv-map-pick strong { color: var(--color-text); font-size: .82rem; line-height: 1.35; }
.ptv-map-pick small { color: var(--color-text-secondary); font-size: .72rem; }
.ptv-map-pick-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ptv-map-pick-actions button { min-height: 30px; padding: 0 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-accent-strong); background: var(--color-surface); font: inherit; font-size: .76rem; font-weight: 720; cursor: pointer; }
.ptv-map-pick-actions button:hover:not(:disabled) { border-color: var(--color-accent); background: var(--color-accent-soft); }
.ptv-map-pick-actions button.is-suggested { border-color: var(--color-accent); color: white; background: var(--color-accent); }
.ptv-map-pick-actions button:disabled { color: var(--color-text-muted); cursor: default; }
.ptv-map-stop-icon.is-draggable { cursor: grab; }
.ptv-map-stop-icon.is-pending span { background: #0f766e; box-shadow: 0 0 0 2px rgb(15 118 110 / .35); }
.ptv-map-focus-icon span { width: 14px; height: 14px; display: block; border: 3px solid white; border-radius: 999px; background: #dc2626; box-shadow: 0 0 0 2px rgb(220 38 38 / .4); }
.ptv-map-busy { position: absolute; z-index: 950; inset: 0; display: grid; place-items: center; background: rgb(255 255 255 / .55); color: var(--color-text); font-size: .9rem; font-weight: 750; }
.ptv-map-busy[hidden] { display: none; }
.ptv-stop-row.is-picked input { background: var(--color-accent-soft); transition: background-color .6s ease; }
.hazard-options { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.hazard-options[open] { border-color: #f59e0b; background: var(--color-warning-soft); }
.hazard-options > summary { padding: 10px 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; cursor: pointer; list-style: none; }
.hazard-options > summary::-webkit-details-marker { display: none; }
.hazard-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text); font-size: .82rem; font-weight: 750; cursor: pointer; }
.hazard-toggle input, .hazard-materials input { width: auto; margin: 0; accent-color: #d97706; }
.hazard-summary { color: var(--color-warning); font-size: .74rem; font-weight: 700; }
.hazard-options > .hazard-materials, .hazard-options > .field { margin: 0 12px 12px; }
.hazard-materials { padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; border: 0; }
.hazard-materials legend { margin-bottom: 6px; padding: 0; color: var(--color-text-secondary); font-size: .74rem; font-weight: 700; }
.hazard-materials label { display: flex; align-items: center; gap: 6px; font-size: .78rem; cursor: pointer; }
.ptv-planner-controls kbd { padding: 1px 5px; border: 1px solid var(--color-border-strong); border-radius: 4px; background: var(--color-surface); font-size: .72rem; }

/* Firmenweiter Routenplaner ohne Sidebar */
.public-shell { min-height: 100dvh; background: var(--color-canvas); }
.public-header { padding: 0 clamp(16px, 2vw, 28px); }
.public-header .app-header-context { display: flex; align-items: center; gap: 10px; }
.public-brand { display: grid; line-height: 1.15; }
.public-brand strong { font-size: .95rem; }
.public-brand small { color: var(--color-text-secondary); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Administration */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); align-items: start; gap: 22px; }
.admin-card-body { padding: 18px 20px 20px; display: grid; gap: 16px; }
.admin-form { display: grid; gap: 12px; max-width: 520px; }
.admin-form .field label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.admin-form .status { padding: 2px 8px; font-size: .68rem; }
.admin-form input:not([type="hidden"]) { width: 100%; }
.admin-form > button { justify-self: start; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-facts { margin: 0; display: grid; gap: 0; }
.admin-facts > div { padding: 10px 20px; display: grid; grid-template-columns: minmax(180px, 40%) 1fr; gap: 12px; border-bottom: 1px solid var(--color-border); }
.admin-card-body .admin-facts > div { padding-inline: 0; }
.admin-facts > div:last-child { border-bottom: 0; }
.admin-facts dt { color: var(--color-text-secondary); font-size: .8rem; font-weight: 650; }
.admin-facts dd { margin: 0; color: var(--color-text); font-size: .84rem; overflow-wrap: anywhere; }
.admin-facts-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.admin-note { margin: 0 0 18px; color: var(--color-text-secondary); font-size: .84rem; }
.danger-text { color: var(--color-danger); }
.usage-progress { height: 10px; margin: -6px 0 22px; overflow: hidden; border-radius: 999px; background: var(--color-surface-subtle); box-shadow: inset 0 0 0 1px var(--color-border); }
.usage-progress span { height: 100%; display: block; border-radius: inherit; background: var(--color-accent); }
.cost-calculator { margin-top: 22px; }
.cost-calculator-body { padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.cost-calculator-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.cost-calculator-inputs label { display: grid; align-content: start; gap: 6px; color: var(--color-text-secondary); font-size: .78rem; font-weight: 700; }
.cost-calculator-inputs input { height: 38px; min-height: 38px; padding: 0 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-text); font: inherit; font-size: .9rem; }
.cost-calculator-results { margin: 0; display: grid; gap: 0; align-content: start; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.cost-calculator-results div { padding: 9px 14px; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--color-border); }
.cost-calculator-results div:last-child { border-bottom: 0; }
.cost-calculator-results dt { color: var(--color-text-secondary); font-size: .8rem; }
.cost-calculator-results dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.cost-calculator-results .is-primary { background: var(--color-accent-soft); }
.cost-calculator-results .is-primary dd { color: var(--color-accent-strong); font-size: 1.05rem; }
.cost-calculator-note { margin: 0; padding: 0 20px 18px; }
.inline-create-form input { width: 280px; min-height: 40px; padding: 0 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface); font: inherit; font-size: .82rem; }
.inline-create-form input:focus { border-color: var(--color-accent); outline: 3px solid var(--color-accent-soft); }
.action-menu-body input { min-height: 40px; padding: 0 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font: inherit; font-size: .82rem; }

.table-wrap {
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}
.table-wrap table { min-width: 680px; font-size: .82rem; }
.table-wrap th,
.table-wrap td { padding: 13px 16px; border-bottom-color: var(--color-border); }
.table-wrap thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    color: var(--color-text-secondary);
    background: var(--color-surface-subtle);
    font-size: .68rem;
    font-weight: 780;
    letter-spacing: .055em;
}
.table-wrap tbody th { color: var(--color-text); background: var(--color-surface); font-size: .82rem; letter-spacing: 0; text-transform: none; }
.table-wrap tbody tr:hover > * { background: color-mix(in srgb, var(--color-accent-soft) 48%, white); }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
.table-wrap a { color: var(--color-accent-strong); font-weight: 720; }
.table-wrap th small,
.table-wrap td small { margin-top: 3px; display: block; color: var(--color-text-secondary); font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.row-action { width: 1%; text-align: right; }
.icon-link { width: var(--control-size); height: var(--control-size); display: inline-grid; place-items: center; border-radius: var(--radius-sm); text-decoration: none; }
.icon-link:hover { background: var(--color-accent-soft); }
.compact-button { min-height: 36px; padding-inline: 12px; }
.empty { color: var(--color-text-secondary); }
.empty h2,
.empty h3 { color: var(--color-text); }
.filtered-empty { margin: 0; padding: 36px 20px; color: var(--color-text-secondary); text-align: center; }

.form-card { padding: 20px; }
.form-card input:not([type="checkbox"]):not([type="radio"]),
.form-card select,
.form-card textarea,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
    min-height: var(--control-size);
    border-color: var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: var(--color-surface);
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--color-accent); outline-color: color-mix(in srgb, var(--color-accent) 28%, transparent); }
.ptv-planner-shell .ptv-stop-actions { grid-template-columns: repeat(2, var(--control-size)); }
.ptv-planner-shell .ptv-icon-button {
    width: var(--control-size);
    height: var(--control-size);
}
.form-card > label,
.field label { color: var(--color-text-secondary); }
.cost-form > .form-actions {
    position: sticky;
    z-index: 20;
    bottom: 12px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgb(255 255 255 / 94%);
    box-shadow: var(--shadow-float);
    backdrop-filter: blur(10px);
}

/* Dashboard */
.dashboard-heading { align-items: flex-end; }
.dashboard-stat-grid {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.dashboard-stat {
    min-width: 0;
    min-height: 142px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-subtle);
    text-decoration: none;
}
.dashboard-stat:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.dashboard-stat span { color: var(--color-text-secondary); font-size: .72rem; font-weight: 720; }
.dashboard-stat strong { margin-top: 11px; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.dashboard-stat small { margin-top: auto; color: var(--color-text-secondary); font-size: .72rem; line-height: 1.35; }
.dashboard-stat.primary-stat { border-color: color-mix(in srgb, var(--color-accent) 32%, var(--color-border)); background: var(--color-accent-soft); }
.dashboard-stat.primary-stat strong { color: var(--color-accent-strong); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr); align-items: start; gap: 18px; }
.dashboard-side { display: grid; gap: 18px; }
.dashboard-table th:first-child { min-width: 190px; }
.table-wrap .dashboard-table { min-width: 0; }
.quick-actions nav { padding: 7px; display: grid; gap: 2px; }
.quick-actions nav a {
    min-height: 64px;
    padding: 10px 11px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
}
.quick-actions nav a:hover { color: var(--color-accent-strong); background: var(--color-accent-soft); }
.quick-actions nav a > span { min-width: 0; display: grid; gap: 2px; }
.quick-actions nav strong { font-size: .78rem; }
.quick-actions nav small { color: var(--color-text-secondary); font-size: .68rem; }
.system-summary-body { padding: 18px 20px 12px; display: flex; align-items: flex-start; gap: 11px; }
.system-summary-body > div { min-width: 0; display: grid; gap: 3px; }
.system-summary-body strong { font-size: .82rem; }
.system-summary-body small { color: var(--color-text-secondary); font-size: .72rem; line-height: 1.4; }
.system-indicator { width: 9px; height: 9px; margin-top: 4px; flex: 0 0 auto; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 4px var(--color-success-soft); }
.system-indicator.is-running { background: var(--color-warning); box-shadow: 0 0 0 4px var(--color-warning-soft); }
.system-link { margin: 0 12px 8px; padding-inline: 8px; }

/* Searchable list surfaces */
.list-panel { min-width: 0; }
.list-toolbar {
    min-height: 65px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}
.list-search {
    min-width: min(100%, 360px);
    min-height: var(--control-size);
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    background: var(--color-surface-subtle);
}
.list-search:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent); }
.list-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--color-text); background: transparent; }
.density-toggle {
    min-height: var(--control-size);
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    background: var(--color-surface);
    cursor: pointer;
    font-size: .74rem;
    font-weight: 700;
}
.density-toggle:hover,
.density-toggle[aria-pressed="true"] { border-color: var(--color-accent); color: var(--color-accent-strong); background: var(--color-accent-soft); }
.list-panel[data-density="compact"] .table-wrap th,
.list-panel[data-density="compact"] .table-wrap td { padding-block: 8px; }
.list-panel[data-density="compact"] .profile-card { padding: 16px; }
.searchable-card-grid { padding: 16px; }
.profile-card { color: var(--color-text); }
.profile-card:hover { transform: none; border-color: var(--color-accent); background: var(--color-accent-soft); box-shadow: var(--shadow-subtle); }

.detail-tabs {
    margin: -8px 0 22px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    scrollbar-width: thin;
}
.detail-tab {
    min-height: var(--control-size);
    padding: 0 14px;
    flex: 0 0 auto;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    background: transparent;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 720;
}
.detail-tab:hover { color: var(--color-text); background: var(--color-surface-subtle); }
.detail-tab.active { border-bottom-color: var(--color-accent); color: var(--color-accent-strong); }
.detail-tab-panel { min-width: 0; }
.detail-tab-panel[hidden] { display: none; }
.detail-tab-panel.panel { margin-bottom: 22px; }

.command-palette {
    width: min(620px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 48px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-float);
}
.command-palette::backdrop { background: rgb(15 23 42 / 38%); backdrop-filter: blur(2px); }
.command-palette-heading { padding: 10px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--color-border); }
.command-palette-heading > div { min-width: 0; min-height: var(--control-size); padding: 0 12px; display: flex; flex: 1; align-items: center; gap: 10px; border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.command-palette-heading input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--color-text); background: transparent; }
.command-palette nav { max-height: 520px; padding: 8px; display: grid; gap: 2px; overflow-y: auto; }
.command-palette nav a { min-height: var(--control-size); padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: var(--radius-sm); color: var(--color-text); font-size: .82rem; font-weight: 700; text-decoration: none; }
.command-palette nav a:hover, .command-palette nav a:focus { color: var(--color-accent-strong); background: var(--color-accent-soft); outline: 0; }
.command-palette nav small { color: var(--color-text-muted); font-size: .68rem; font-weight: 650; }
.command-palette-empty { margin: 0; padding: 30px 20px; color: var(--color-text-secondary); text-align: center; }

.context-tabs {
    margin: -8px 0 20px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    scrollbar-width: thin;
}
.context-tabs a {
    min-height: var(--control-size);
    padding: 0 14px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
}
.context-tabs a:hover { color: var(--color-text); background: var(--color-surface-subtle); }
.context-tabs a.active { border-bottom-color: var(--color-accent); color: var(--color-accent-strong); }
.sticky-action-bar {
    position: sticky;
    z-index: 30;
    top: calc(var(--header-height) + 10px);
    min-height: 58px;
    margin-bottom: 24px;
    padding: 8px 10px 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgb(255 255 255 / 94%);
    box-shadow: var(--shadow-subtle);
    backdrop-filter: blur(12px);
}
.sticky-action-bar > div { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--color-text-secondary); font-size: .76rem; font-weight: 650; }
.sticky-action-bar > div > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-anchor { scroll-margin-top: calc(var(--header-height) + 84px); }
.version-audit-panel { margin-top: 22px; }
.version-audit-panel .panel-heading > div { display: grid; gap: 3px; }
.version-audit-panel .eyebrow { margin: 0; }
.horizontal-version-history { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.horizontal-version-history li { min-width: 0; }
.horizontal-version-history li a { min-height: 72px; }

/* MSW planner stays dense, but never at the expense of legibility. */
.container.app-content.msw-workspace-container {
    width: 100%;
    max-width: none;
    padding: 12px clamp(12px, 1.5vw, 26px) 26px;
}
.msw-workspace-page .msw-workspace-title-row h1 { font-size: 1.15rem; letter-spacing: -.015em; }
.msw-workspace-page .msw-workspace-header .lede { margin-top: 3px; font-size: .75rem; line-height: 1.35; }
.msw-workspace-page .msw-settings-drawer { padding: 0; }
.msw-workspace-page .app-content :is(p, small, label, button, input, select, summary) { font-size: .75rem; }
.msw-workspace-page .app-content button { min-height: var(--control-size); }
.msw-workspace-page :is(
    .msw-workspace-title-row .eyebrow,
    .msw-workspace-header .status,
    .msw-settings-title .kicker,
    .msw-settings-toggle,
    .msw-settings-group-heading .kicker,
    .msw-settings-group-heading p:not(.kicker),
    .msw-settings-drawer .input-with-unit > span,
    .msw-settings-drawer .optional,
    .msw-route-block legend,
    .msw-live-summary span,
    .msw-live-summary strong,
    .msw-save-state,
    .msw-pool-tabs button,
    .msw-pool-tabs button strong,
    .msw-pool-filters label,
    .msw-pool-count,
    .msw-candidate-copy span,
    .msw-candidate-copy small,
    .msw-candidate-copy .msw-candidate-meta,
    .msw-unlocated-note,
    .msw-stop-pool > .panel-heading p:last-child,
    .msw-map-legend,
    .msw-map-legend i,
    .msw-tour-sequence,
    .msw-tour-identity strong,
    .msw-tour-identity span,
    .msw-tour-identity .msw-stop-kind
) { font-size: .75rem; }
.msw-workspace-page .msw-map-legend i { width: 1rem; height: 1rem; }
.msw-workspace-page .msw-candidate-copy strong { font-size: .8rem; }
.msw-workspace-page .msw-pool-tabs button { min-height: var(--control-size); }
.ptv-planner-shell :is(
    .ptv-stop-marker,
    .ptv-stop-hint,
    .ptv-resolved-address,
    .ptv-suggestion small,
    .ptv-map-stop-icon span,
    .ptv-map-border-icon span,
    .ptv-resolved-stops li > span,
    .ptv-resolved-stops small,
    .ptv-maneuver-list small
) { font-size: .75rem; }
.msw-planning-overview .msw-settings-drawer > summary,
.msw-stop-service-details > summary,
.ptv-detail-panel > summary,
.form-section > summary,
.input-audit > summary,
.form-card > summary,
.msw-tank-summary > summary { min-height: var(--control-size); }
.msw-workspace-page .msw-candidate-card { grid-template-columns: minmax(0, 1fr) var(--control-size); }
.msw-workspace-page .msw-candidate-add,
.msw-workspace-page .msw-toolbar-icon,
.msw-workspace-page .msw-supplier-dialog-close,
.msw-workspace-page .ptv-icon-button {
    width: var(--control-size);
    height: var(--control-size);
}
.msw-workspace-page .msw-checkbox-field > label,
.msw-workspace-page .msw-active-toggle,
.msw-workspace-page .msw-trailer-site-actions button { min-height: var(--control-size); }
.msw-workspace-page .msw-draft-toolbar { min-height: 52px; }

/* Kennzahlen umbrechen statt abschneiden */
.msw-workspace-page .msw-live-summary { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0; overflow: hidden; background: #f5f7ff; }
.msw-workspace-page .msw-live-summary article { border-radius: 0; box-shadow: inset -1px 0 #e0e7ff, inset 0 -1px #e0e7ff; }
.msw-tour-form > .msw-plan-actions { position: static; box-shadow: none; }
.msw-workspace-page .msw-live-summary span { font-size: .7rem; }
.msw-workspace-page .msw-live-summary strong { font-size: .86rem; }
.msw-workspace-page .msw-settings-title strong { white-space: normal; }
.msw-workspace-page .msw-planning-overview .msw-settings-drawer:not([open]) .msw-settings-toggle { font-size: 0; gap: 0; }

/* Stopp-Aktionen: Ziehen und Entfernen immer, der Rest bei Hover/Fokus */
.msw-tour-stop:not(:hover, :focus-within) .msw-tour-actions :is([data-msw-stop-up], [data-msw-stop-down], .msw-supplier-edit-link) { display: none; }
.msw-workspace-page .msw-tour-actions .ptv-icon-button { width: 30px; height: 30px; }
/* Stoppzeile einzeilig: Buchstabe · Eingabe · Ziehen · Entfernen */
.ptv-planner-shell .ptv-stop-list { gap: 6px; }
.ptv-planner-shell .ptv-stop-row { padding: 6px 6px 6px 8px; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.ptv-planner-shell .ptv-stop-marker { width: 24px; height: 24px; }
.ptv-planner-shell .ptv-stop-field label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.ptv-planner-shell .ptv-stop-field input { min-height: 36px; padding: 6px 10px; }
.ptv-planner-shell .ptv-resolved-address { margin-top: 3px; font-size: .68rem; }
.ptv-planner-shell .ptv-stop-actions { display: flex; align-items: center; gap: 4px; }
.ptv-planner-shell .ptv-stop-actions :is([data-stop-up], [data-stop-down]) { display: none; }
.ptv-planner-shell .ptv-stop-actions .ptv-icon-button { width: 30px; height: 30px; }
.ptv-planner-shell .ptv-stop-list-actions { margin: 8px 0 14px; display: flex; justify-content: space-between; gap: 8px; }
.text-button { min-height: 0; padding: 4px 6px; border: 0; border-radius: var(--radius-sm); color: var(--color-accent-strong); background: transparent; font: inherit; font-size: .8rem; font-weight: 720; cursor: pointer; }
.text-button:hover:not(:disabled) { background: var(--color-accent-soft); }
.text-button:disabled { color: var(--color-text-muted); cursor: not-allowed; }
.fill-height-content .ptv-planner-shell { grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); }

/* Planer-Kopf: Stammdatenmenü und Legende */
.msw-pool-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.msw-menu-trigger { padding: 6px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-accent-strong); background: var(--color-surface); font-weight: 720; white-space: nowrap; }
.action-menu-links { width: 230px; padding: 6px; display: grid; gap: 2px; }
.action-menu-links a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--color-text); font-size: .8rem; font-weight: 650; text-decoration: none; }
.action-menu-links a:hover { color: var(--color-accent-strong); background: var(--color-accent-soft); }
.msw-map-legend-toggle { position: relative; }
.msw-map-legend-toggle > summary { padding: 6px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-accent-strong); background: var(--color-surface); font-weight: 720; cursor: pointer; list-style: none; }
.msw-map-legend-toggle > summary::-webkit-details-marker { display: none; }
.msw-map-legend-toggle[open] > .msw-map-legend { position: absolute; z-index: 1100; top: calc(100% + 6px); right: 0; width: 300px; max-width: none; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-float); }
.msw-workspace-page .msw-draft-controls .msw-calculate-button { min-height: 0; }

@media (min-width: 1501px) {
    .msw-workspace-page .msw-planner-grid { height: calc(100dvh - 218px); }
    .msw-workspace-page .msw-draft-toolbar + .msw-planner-grid { height: calc(100dvh - 260px); }
}

body[data-sidebar-collapsed="true"] .app-shell { grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr); }
body[data-sidebar-collapsed="true"] .brand-copy,
body[data-sidebar-collapsed="true"] .sidebar-command span,
body[data-sidebar-collapsed="true"] .sidebar-command kbd,
body[data-sidebar-collapsed="true"] .sidebar-section h2,
body[data-sidebar-collapsed="true"] .sidebar-user > span:last-child,
body[data-sidebar-collapsed="true"] .sidebar-user-name,
body[data-sidebar-collapsed="true"] .sidebar-logout { display: none; }
body[data-sidebar-collapsed="true"] .sidebar-navigation a > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
}
body[data-sidebar-collapsed="true"] .sidebar-brand-row { justify-content: center; }
body[data-sidebar-collapsed="true"] .app-sidebar .brand { display: none; }
body[data-sidebar-collapsed="true"] .sidebar-collapse { display: inline-grid; }
body[data-sidebar-collapsed="true"] .sidebar-command,
body[data-sidebar-collapsed="true"] .sidebar-navigation a { justify-content: center; padding-inline: 0; }
body[data-sidebar-collapsed="true"] .sidebar-section { margin-top: 5px; }
body[data-sidebar-collapsed="true"] .sidebar-user { justify-content: center; padding-inline: 0; }

/* Drei Spalten (Pool · Karte · Tourliste), solange es irgendwie passt: Die
   Tourliste ist das Arbeitsergebnis und gehört nicht unter die Karte. */
@media (max-width: 1500px) {
    .msw-workspace-page .msw-planner-grid {
        grid-template-columns: minmax(250px, .8fr) minmax(300px, 1.2fr) minmax(320px, 1.1fr);
    }
}

@media (max-width: 1180px) {
    .msw-workspace-page .msw-planner-grid,
    .msw-workspace-page .msw-draft-toolbar + .msw-planner-grid {
        height: auto;
        min-height: 0;
        grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
        grid-template-areas: "pool tour" "map map";
    }
    .msw-workspace-page .msw-stop-pool { grid-area: pool; height: 640px; }
    .msw-workspace-page .msw-tour-board { grid-area: tour; height: 640px; }
    .msw-workspace-page .msw-map-panel { grid-area: map; height: auto; }
    .msw-workspace-page .msw-tour-map { min-height: 480px; }
}

@media (max-width: 1200px) {
    .dashboard-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .app-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-102%);
        visibility: hidden;
        width: min(var(--sidebar-width), calc(100vw - 48px));
        box-shadow: var(--shadow-float);
        transition: transform .18s ease, visibility 0s linear .18s;
    }
    body[data-sidebar-open="true"] { overflow: hidden; }
    body[data-sidebar-open="true"] .app-sidebar {
        transform: translateX(0);
        visibility: visible;
        transition-delay: 0s;
    }
    .sidebar-collapse { display: none; }
    .sidebar-toggle { display: inline-grid; }
    .sidebar-backdrop {
        position: fixed;
        z-index: 45;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgb(15 23 42 / 42%);
        cursor: pointer;
    }
    body[data-sidebar-open="true"] .sidebar-backdrop { display: block; }
    .topbar.app-header { padding-inline: 12px 18px; }
    .header-user-name { display: none; }
    body[data-sidebar-collapsed="true"] .app-shell { grid-template-columns: minmax(0, 1fr); }
    body[data-sidebar-collapsed="true"] .brand-copy,
    body[data-sidebar-collapsed="true"] .sidebar-command span,
    body[data-sidebar-collapsed="true"] .sidebar-command kbd,
    body[data-sidebar-collapsed="true"] .sidebar-navigation span,
    body[data-sidebar-collapsed="true"] .sidebar-section h2,
    body[data-sidebar-collapsed="true"] .sidebar-user > span:last-child { display: initial; }
    body[data-sidebar-collapsed="true"] .sidebar-brand-row { justify-content: space-between; }
    body[data-sidebar-collapsed="true"] .sidebar-command,
    body[data-sidebar-collapsed="true"] .sidebar-navigation a { justify-content: flex-start; padding-inline: 10px; }
    .dashboard-layout { grid-template-columns: 1fr; }
    .dashboard-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .msw-workspace-page .msw-workspace-header > .hero { align-items: stretch; }
    .msw-workspace-page .msw-workspace-title,
    .msw-workspace-page .msw-workspace-title-row { width: 100%; }
    .msw-workspace-page .msw-planner-grid { grid-template-columns: 1fr; }
    .msw-workspace-page .msw-stop-pool { height: auto; }
    .msw-workspace-page .msw-tour-map { min-height: 420px; }
}

@media (max-width: 640px) {
    .header-command { min-width: var(--control-size); width: var(--control-size); padding: 0; justify-content: center; }
    .header-command span, .header-command kbd { display: none; }
    .breadcrumbs span, .breadcrumbs .icon { display: none; }
    .container.app-content { width: min(100% - 28px, var(--content-max)); padding-top: 24px; }
    .sticky-action-bar { position: static; align-items: stretch; flex-direction: column; }
    .sticky-action-bar .button-link { width: 100%; }
    .dashboard-stat-grid,
    .dashboard-side { grid-template-columns: 1fr; }
    .dashboard-stat { min-height: 124px; }
    .list-toolbar { align-items: stretch; flex-direction: column; }
    .list-search { min-width: 0; width: 100%; }
    .density-toggle { width: 100%; justify-content: center; }
    .panel-heading-with-action { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
