@import url('crm-design-tokens.css?v=2026102501');

/* YV Media application shell. Shared tokens, compact controls, calm surfaces. */
button, input, select, textarea { font-family: var(--app-font); }
body :is(.refresh h1, .refresh h2, .refresh h3, .dashboard-h1, .editorial-h,
    h2.editorial, #dashboard-content h2, #dashboard-content h3, .modal h3,
    .detail-section-title, .topbar h1) { font-family: var(--app-font); }
body :is(.card, .stat-card, .kpi-flat, .section-card, .tracker-card, .umsatz-card, .zahlungen-card) {
    border-radius: var(--radius);
    box-shadow: none;
    backdrop-filter: none;
}
body .kpi-flat:hover { transform: none; box-shadow: none; }
body :is(.modal-content, .modal, .detail-modal) { border-radius: var(--radius) !important; }
body.dark-mode .modal { background: var(--card) !important; backdrop-filter: none; }
body.dark-mode .modal-header { background: var(--card) !important; }
body .ap-app, body .ap-dialog { --ap-blue: var(--primary); --ap-green: var(--primary); font-family: var(--app-font); }
body .ap-primary { background: var(--brand,#1fae8c); border-color: var(--brand,#1fae8c); color: var(--on-brand,#04110d); }
body .ap-primary:hover { background: var(--brand-hover,#38c8a3); border-color: var(--brand-hover,#38c8a3); }
body :is(.btn-flat, .tbl-btn, .btn-sm, .filter-select, .search-wrap input,
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
    border-radius: var(--radius-sm);
    font-family: var(--app-font);
}
body :is(.btn-flat, .tbl-btn):hover { transform: none; box-shadow: none; }
body .btn-flat-primary { background: var(--brand,#1fae8c); border-color: var(--brand,#1fae8c); color: var(--on-brand,#04110d); box-shadow: none; }
body .btn-flat-primary:hover { background: var(--brand-hover,#35c4a0); border-color: var(--brand-hover,#35c4a0); }
body :is(input, select, textarea, .search-wrap input):focus {
    box-shadow: 0 0 0 3px color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 13.33%,transparent) !important;
    border-color: var(--primary) !important;
}
body :is(button, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell-icon { width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }

/* Sidebar: fixed account area, independently scrolling navigation. */
body .sidebar, body.dark-mode .sidebar {
    width: var(--sidebar-width);
    min-height: 0;
    height: 100dvh;
    padding: 0;
    gap: 0;
    background: #101211 !important;
    border-right: 1px solid #ffffff12 !important;
    color: #a9b2ad;
    overflow: hidden;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.sidebar .sidebar-brand { min-height: 76px; flex: 0 0 auto; padding: 18px 18px 14px; border: 0; gap: 10px; }
.sidebar .brand-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius); background: #000; border: 1px solid #ffffff12; overflow: hidden; }
.brand-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sidebar .brand-text { min-width: 0; }
.sidebar .brand-text strong { color: #f3f5f3; font-size: 14px; font-weight: 600; line-height: 1.45; letter-spacing: -.025em; }
.sidebar .brand-text span { color: #949f98; font-size: 10px; letter-spacing: .025em; }
.sidebar-create { padding: 0 14px 14px; }
.sidebar-create[hidden], .nav-group[hidden] { display: none; }
.sidebar .btn-add-lead {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 36px;
    width: 100%;
    background: var(--brand,#1fae8c);
    color: var(--on-brand,#04110d);
    font: 600 12px/1.5 var(--app-font);
    border: 1px solid var(--brand,#1fae8c);
    border-radius: var(--radius);
    padding: 7px 10px;
    box-shadow: none;
}
.sidebar .btn-add-lead:hover { background: var(--brand-hover,#38c8a3); border-color: var(--brand-hover,#38c8a3); transform: none; box-shadow: none; }
.sidebar .sidebar-nav { flex: 1 1 auto; min-height: 60px; gap: 10px; padding: 2px 12px 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3b433e transparent; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 0 10px 3px; color: #88958d; font-size: 9px; line-height: 1.5; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; }
.sidebar .nav-item {
    min-height: 32px;
    padding: 5px 10px;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: #adb7b0;
    font: 400 13px/1.5 var(--app-font);
    transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
    box-shadow: none;
    text-decoration: none;
}
.sidebar .nav-item:hover { color: #f3f5f3; background: #ffffff06; transform: none; }
.sidebar .nav-item.active { background: color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 9.41%,transparent) !important; border: 1px solid color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 13.33%,transparent) !important; color: var(--brand-on-dark,#51d6b5) !important; font-weight: 500; box-shadow: none; }
.sidebar .nav-item.active::after { content: ''; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--brand-hover,#38c8a3); margin-left: auto; }
.sidebar .nav-item .nav-label { min-width: 0; overflow-wrap: anywhere; }
.sidebar :is(.today-badge, .shell-count) { min-width: 20px; padding: 1px 5px; margin-left: auto; border-radius: var(--radius); background: #ffffff0a; color: #becac2; font: 500 10px/1.5 var(--app-font); text-align: center; font-variant-numeric: tabular-nums; }
.sidebar .shell-count:empty { display: none; }
.sidebar .nav-item.active:has(.shell-count:not(:empty))::after,
.sidebar .nav-item.active:has(.today-badge:not(:empty))::after { display: none; }
.sidebar-account { margin: 0 14px; padding: 12px 0 max(10px, env(safe-area-inset-bottom)); border-top: 1px solid #ffffff0d; flex: 0 0 auto; }
.sidebar-identity { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid #ffffff14; border-radius: var(--radius); background: #202521; color: #d5ded8; font-size: 10px; font-weight: 500; }
.account-copy { min-width: 0; flex: 1; }
#sidebar-username { color: #dfe6e1; font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar-role { color: #89968e; font-size: 10px; }
.account-actions { display: flex; gap: 6px; margin: 9px 0 0 44px; }
.account-actions button { display: grid; place-items: center; width: 30px; height: 28px; border: 0; border-radius: var(--radius); background: transparent; color: #95a299; cursor: pointer; }
.account-actions button:hover { color: #f3f5f3; background: #ffffff0a; }
.account-actions .shell-icon { width: 16px; height: 16px; }
.shell-close { display: none; }

/* Shared header and control geometry. */
body .main { margin-left: var(--sidebar-width); min-width: 0; }
body .view { padding: var(--app-gutter); }
body .topbar, body.dark-mode .topbar { min-height: 65px; padding: 14px 28px; gap: 12px; background: var(--bg) !important; backdrop-filter: none; border-bottom: 1px solid var(--border); }
body .topbar-left { gap: 24px; min-width: 0; }
body .topbar-left h1 { font: 500 14px/1.5 var(--app-font); letter-spacing: -.015em; overflow-wrap: anywhere; }
/* From 900 px the title gets a fixed column, so the search field keeps its place on every view (with auto width
   it moved by up to 88 px from view to view, 13.10.2026). The longest title, "Aufträge & Rangliste", fits; anything
   longer ends with an ellipsis. Narrower windows keep the auto width: there the fixed column would push the
   presentation switch of the pipeline and leads views into a second row. Phones put the search on its own row. */
@media (min-width: 900px) {
    body .topbar-left h1 { flex: 0 0 152px; width: 152px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
}
body .search-wrap input { width: 220px; min-height: 34px; font-size: 11px; padding: 7px 10px 7px 32px; background: var(--card); }
body .search-wrap i { font-size: 12px; left: 11px; }
body .topbar-right { gap: 8px; }
body .topbar-filters { position: relative; }
body .topbar-filters summary { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); background: var(--card); font-size: 11px; cursor: pointer; list-style: none; }
body .topbar-filters summary::-webkit-details-marker { display: none; }
body .topbar-filters summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body .topbar-filters[open] summary { color: var(--primary); border-color: var(--primary); }
body .topbar-filters .topbar-right { position: absolute; top: calc(100% + 8px); right: 0; width: min(540px, calc(100vw - 300px)); padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-lg); display: flex; flex-wrap: wrap; }
body #dashboard-content { padding: 0 !important; }
body .filter-select { min-height: 34px; padding: 6px 26px 6px 10px; font-size: 11px; }
body .topbar .stat-pill { border-radius: var(--radius); background: var(--surface); color: var(--muted); border: 1px solid var(--border); font-size: 10px; font-weight: 500; padding: 6px 9px; }
body :is(.umsatz-kpi, .umsatz-panel, .umsatz-deal, .umsatz-rank-row) { border-radius: var(--radius); background: var(--card); }
body .umsatz-kpi { gap: 10px; }
body .umsatz-kpi-primary { background: var(--primary-light); color: var(--text); border-color: color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 25.1%,transparent); }
body .umsatz-kpi-primary .umsatz-kpi-label, body .umsatz-kpi-primary .umsatz-kpi-meta { color: var(--muted); }
body .umsatz-kpi-value { font-weight: 600; }
body .umsatz-kpi-primary .umsatz-kpi-value { color: var(--primary); }
body .umsatz-kpi-label { min-height: 32px; font-size: 10px; font-weight: 500; letter-spacing: .04em; }
body .umsatz-panel-heading h3 { font-family: var(--app-font); font-size: 13px; font-weight: 500; }
body .umsatz-change { border-radius: var(--radius); font-weight: 500; }
body .umsatz-change.is-down { color: #9d3b2b; background: #fff1ed; }
body.dark-mode .umsatz-change.is-down { color: #f1b2a5; background: #412a25; }
body .umsatz-change.is-up { color: var(--primary); background: var(--primary-light); }
body .umsatz-month-fill { background: #65776b; }
body .umsatz-month.is-current .umsatz-month-fill { background: var(--brand,#1fae8c); }
body .umsatz-deal-info strong, body .umsatz-rank-name strong { font-weight: 500; }
body .umsatz-you { background: var(--primary-light); border-radius: var(--radius); }
body .umsatz-rank-row.is-me { background: var(--primary-light); }

/* Analytics use the same neutral surfaces and readable number alignment. */

body .workspace-metric { background: var(--card) !important; color: var(--text) !important; border: 1px solid var(--border) !important; border-radius: var(--radius) !important; }
body .workspace-metric > div:first-child { font-weight: 500 !important; font-variant-numeric: tabular-nums; }
.workspace-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
body #view-stats .bar-item { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: center; }
body #view-stats .bar-label { min-width: 0 !important; width: auto; white-space: normal; overflow-wrap: anywhere; font-size: 11px; }
body #view-stats .bar-val { width: auto; min-width: 24px; white-space: nowrap; font-size: 11px; }
body #view-stats .bar-track { width: 100%; }
body #track-conversion-stats > div > div { border: 1px solid var(--border) !important; border-radius: var(--radius) !important; padding: 16px !important; }

/* Collapsible navigation. Work tools live in their corresponding groups. */
.sidebar .sidebar-nav { gap: 7px; }
.nav-group { display: block; }
.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 30px; border: 0; background: transparent; color: #8e9d94; padding: 4px 10px; font: 500 10px/1.5 var(--app-font); letter-spacing: .025em; text-align: left; cursor: pointer; border-radius: var(--radius); }
.nav-group-toggle:hover { color: #f3f5f3; background: #ffffff05; }
.nav-chevron { width: 13px; height: 13px; flex: 0 0 13px; transition: transform var(--motion-fast) var(--ease-standard); }
.nav-group-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group-items[hidden] { display: none; }
.sidebar .sidebar-action-btn { width: 100%; text-align: left; background: transparent; cursor: pointer; }
.sidebar .sidebar-appearance { flex: 0 0 auto; margin: 0 14px; padding: 9px 0; border-top: 1px solid #ffffff0d; }
.sidebar .theme-toggle-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius); color: #ced9d1; background: transparent; cursor: pointer; font: 400 11px/1.5 var(--app-font); box-shadow: none; }
.sidebar .theme-toggle-btn:hover { background: #ffffff06; transform: none; }
.theme-caption { display: flex; gap: 11px; align-items: center; text-align: left; }
.theme-caption small { display: block; color: #8e9d94; font-size: 10px; }
.theme-track { display: flex; align-items: center; width: 34px; height: 20px; border: 1px solid #ffffff2e; border-radius: var(--radius); padding: 2px; background: #333d36; }
.theme-track > span { width: 14px; height: 14px; border-radius: 50%; background: #d4ddd6; transition: transform var(--motion-panel) var(--ease-standard), background-color var(--motion-panel) var(--ease-standard); }
.theme-toggle-btn[aria-checked="true"] .theme-track { background: color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 25.1%,transparent); border-color: color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 50.2%,transparent); }
.theme-toggle-btn[aria-checked="true"] .theme-track > span { transform: translateX(13px); background: var(--brand-on-dark,#51d6b5); }
.sidebar-account { position: relative; padding-top: 9px; }
.account-menu > summary { cursor: pointer; list-style: none; min-height: 46px; border-radius: var(--radius); padding: 6px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: #ffffff06; }
.account-menu .nav-chevron { transform: rotate(-90deg); color: #8e9d94; }
.account-menu[open] .nav-chevron { transform: rotate(90deg); }
.account-menu .account-copy > span { display: block; }
.account-menu .account-actions { position: absolute; bottom: calc(100% + 7px); left: 0; right: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 6px; background: #1b221d; border: 1px solid #3a473e; border-radius: var(--radius); box-shadow: 0 10px 30px #0005; z-index: 5; }
.account-menu:not([open]) .account-actions { display: none; }
.account-menu .account-actions button { display: flex; justify-content: flex-start; align-items: center; gap: 10px; width: 100%; height: auto; min-height: 36px; padding: 8px 10px; color: #d3ddd6; font: 400 11px/1.5 var(--app-font); }
.account-menu > summary:focus-visible, .nav-group-toggle:focus-visible { outline: 2px solid var(--brand-on-dark,#51d6b5); outline-offset: -2px; }

/* Shared workspace language, based on the planning module. */
body .view { width: 100%; box-sizing: border-box; max-width: 1600px; margin-inline: auto; font-size: 13px; }
body .view > [id$="-content"] { padding: 0 !important; }
body .view :is(.chart-card, .cc-karte, .cc-kpi, .zahlungen-stat-card, .leads-table-wrap, .zahlungen-table-wrap, .zg-kunde, .zg-projekt) { border-radius: var(--radius); background: var(--card); border-color: var(--border); box-shadow: none; }
body .view :is(.chart-card:hover, .stat-card:hover) { transform: none; box-shadow: none; }
body :is(.btn-flat, .cc-btn, .ra-knopf) { min-height: 38px; border-radius: var(--radius); padding: 8px 13px; font: 500 12px/1.5 var(--app-font); box-shadow: none; }
body .tbl-btn { width: 34px; height: 34px; min-height: 34px; border-radius: var(--radius); }
body :is(.leads-table, .zahlungen-table, .cc-tbl) { font-size: 12px; }
body :is(.leads-table, .zahlungen-table, .cc-tbl) thead th { color: var(--muted); font-weight: 500; font-size: 10px; letter-spacing: .045em; background: var(--surface-2); }
body :is(.cc-h3, .chart-card h3, .detail-section-title) { font-weight: 550; }
body :is(.cc-kpi-v, .zahlungen-stat-value, .s-num) { font-size: clamp(23px, 2.2vw, 30px); font-weight: 500; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
body :is(.cc-kpi-l, .zahlungen-stat-label, .s-label) { font-weight: 500; letter-spacing: .04em; }
body .cc-range-btn.an { background: var(--primary-light); color: var(--primary); }
body .cc-kpi, body .stat-card, body .zahlungen-stat-card { padding: 20px; }
body .modal-header h2 { font-size: 20px; font-weight: 550; letter-spacing: -.5px; }
body .modal-tab { font-size: 12px; font-weight: 500; }
body .stat-card.accent, body .stat-card.red { background: var(--card); }
body #forecast-cards > div, body #conversion-funnel > div:first-of-type > div { background: var(--card) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: var(--radius) !important; text-align: left !important; }
body #forecast-cards > div > div:last-child, body #conversion-funnel > div:first-of-type > div > div:first-child { font-weight: 500 !important; font-variant-numeric: tabular-nums; }
body #forecast-cards > div > div:first-child { color: var(--muted); font-size: 10px !important; }
body .bar-fill { border-radius: var(--radius-sm); background: var(--primary); }
body .bar-track { border-radius: var(--radius-sm); }
body .topbar-filters[hidden] { display: none !important; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 8px 0 28px; }
.workspace-eyebrow { font-size: 10px; letter-spacing: .10em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0 0 7px; }
.workspace-heading h2 { font-size: var(--ui-title-size); font-weight: var(--ui-title-weight); letter-spacing: var(--ui-title-tracking); margin: 0; line-height: 1.3; }
.workspace-heading h2 > span { display: block; color: var(--muted); font-weight: 400; }
.workspace-actions { display: flex; gap: 8px; flex-shrink: 0; }
.workspace-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.workspace-section-heading h3, .dash-pipeline > h3 { font-size: 16px; font-weight: 550; margin: 0; letter-spacing: -.3px; }
.workspace-section-heading h3 > span { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.workspace-section-heading .btn-flat { background: transparent; white-space: nowrap; }
.dash-overview { max-width: 1380px; margin: auto; }
body .dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; padding: 22px 0; border-block: 1px solid var(--border); margin-bottom: 30px; }
body .dash-kpis .kpi-flat { display: flex; flex-direction: column; gap: 8px; background: transparent; padding: 0 20px; border: 0; border-left: 1px solid var(--border); border-radius: 0; min-width: 0; }
body .dash-kpis .kpi-flat:first-child { border-left: 0; padding-left: 0; }
body .dash-kpis .kpi-stat-label { color: var(--muted); font-size: 10px; line-height: 1.5; font-weight: 400; letter-spacing: .02em; text-transform: none; min-height: 30px; }
body .dash-kpis .kpi-stat-value { font-size: clamp(24px, 2vw, 30px); font-weight: 500; letter-spacing: -.5px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
body .dash-kpis .positive .kpi-stat-value { color: var(--primary); }
body .dash-kpis .attention .kpi-stat-value { color: var(--app-warning); }
.dash-metric-note { font-size: 10px; color: var(--muted); }
body .dash-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; margin-bottom: 30px; }
body .app-section { background: transparent; border: 0; border-radius: 0; padding: 0; min-width: 0; }
.dash-contact-row { display: flex; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.dash-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dash-record { display: block; font: 500 13px/1.5 var(--app-font); text-align: left; color: var(--text); border: 0; background: transparent; padding: 0; cursor: pointer; overflow-wrap: anywhere; }
.dash-record:hover { color: var(--primary); }
.dash-row-main > span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.dash-due { font-size: 10px; color: var(--muted); white-space: nowrap; }
.dash-due.is-overdue, .dash-task-dot.is-overdue { color: var(--app-warning); }
.dash-contact-actions { display: flex; gap: 4px; }
.dash-contact-actions:empty { display: none; }
.dash-task-row { display: flex; align-items: center; gap: 10px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.dash-task-dot { height: 6px; width: 6px; border-radius: var(--radius-sm); flex-shrink: 0; background: currentColor; color: var(--muted); }
.dash-caption, .dash-empty { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 16px 0 0; }
.dash-empty { padding: 15px 0; }
.dash-text-link { color: var(--primary); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.dash-disclosure { border-top: 1px solid var(--border); }
.dash-disclosure > summary { display: flex; align-items: center; gap: 12px; padding: 21px 0; list-style: none; cursor: pointer; font-size: 13px; font-weight: 500; }
.dash-disclosure > summary::-webkit-details-marker { display: none; }
.dash-disclosure > summary > span:nth-child(2) { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: auto; }
.dash-disclosure > summary i { color: var(--muted); font-size: 10px; transition: transform var(--motion-fast) var(--ease-standard); }
.dash-disclosure[open] > summary i { transform: rotate(180deg); }
.dash-disclosure > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.dash-disclosure > .dash-columns { padding-top: 12px; }
/* Opening and closing glide instead of snapping (240 ms in, 160 ms out; content below moves along with it).
   Chrome and Edge only (::details-content with interpolate-size); other engines open at once, as before.
   Reduced motion: no transition, the content simply opens. */
@supports (interpolate-size: allow-keywords) and selector(::details-content) {
    @media (prefers-reduced-motion: no-preference) {
        .dash-disclosure { interpolate-size: allow-keywords; }
        .dash-disclosure::details-content {
            block-size: 0;
            overflow-y: clip;
            transition: block-size var(--motion-slow-out) var(--ease-in), content-visibility var(--motion-slow-out) allow-discrete;
        }
        .dash-disclosure[open]::details-content {
            block-size: auto;
            transition: block-size var(--motion-slow) var(--ease-standard), content-visibility var(--motion-slow) allow-discrete;
        }
    }
}
.dash-focus { min-width: 0; }
body .dash-lead-row { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; color: var(--text); text-align: left; border: 0; border-bottom: 1px solid var(--border); padding: 15px 0; cursor: pointer; font: inherit; }
.dash-lead-row strong { font-weight: 500; font-size: 13px; overflow-wrap: anywhere; }
.dash-score { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--primary); }
.dash-score small { color: var(--muted); font-size: 9px; }
.dash-stage-list { display: grid; gap: 12px; margin-top: 22px; }
.dash-stage-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; font-size: 11px; }
.dash-stage-list strong { font-weight: 500; }
.dash-stage-track { grid-column: 1 / -1; background: var(--border); height: 3px; border-radius: var(--radius-sm); }
.dash-stage-track i { display: block; height: 100%; background: var(--primary); border-radius: var(--radius-sm); }
.dash-notice { display: flex; gap: 14px; border-top: 1px solid var(--border); padding: 22px 0; }
.dash-notice > i { color: var(--app-warning); margin-top: 5px; }
.dash-notice > div { flex: 1; min-width: 0; }
.dash-notice strong { font-size: 13px; font-weight: 550; }
.dash-notice p { font-size: 11px; color: var(--muted); margin: 5px 0 12px; }
.dash-inline-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 11px; }
.dash-invoice-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.dash-invoice-row > div { flex: 1; min-width: 0; }
.dash-invoice-row span { display: block; color: var(--muted); font-size: 11px; }
.dash-team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; padding: 10px 0 24px; }
.dash-team-header { display: flex; gap: 12px; align-items: center; }
.dash-team-header strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.dash-team-header > div { flex: 1; min-width: 0; }
.dash-team-header > div > span { display: block; color: var(--muted); font-size: 11px; }
.dash-team-metrics { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.dash-recent:empty { display: none; }
/* Dashboard "Tag und Woche" (16.10.2026, layout B): one lane, today first, then the week, then tasks and money. */
.dash-heute, .dash-woche { margin-bottom: 30px; }
.dash-day-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.dash-day-row.is-past { opacity: .62; }
.dash-time { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.dash-time.is-past, .dash-time.is-muted { color: var(--muted); font-weight: 400; font-size: 11px; }
.dash-time.is-overdue { color: var(--app-warning); font-size: 11px; }
.dash-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dash-tag { font-size: 10px; line-height: 1.5; padding: 0 7px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--muted); background: var(--bg); white-space: nowrap; }
.dash-tag.is-ok { color: #15803d; border-color: rgba(21, 128, 61, .35); background: rgba(21, 128, 61, .08); }
.dash-tag.is-due { color: var(--app-warning); border-color: rgba(180, 83, 9, .35); background: rgba(180, 83, 9, .08); }
body.dark-mode .dash-tag.is-ok { color: #86efac; }
.dash-mini { padding: 6px 10px; font-size: 11px; white-space: nowrap; }
.dash-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 6px 0 14px; }
.dash-week-day { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 6px; text-align: center; min-width: 0; }
.dash-week-day.is-today { border-color: var(--primary); background: var(--surface); }
.dash-week-day span { display: block; font-size: 10px; color: var(--muted); }
.dash-week-day strong { display: block; font-size: 15px; font-weight: 500; }
.dash-week-day small { display: block; font-size: 10px; margin-top: 3px; color: var(--text); overflow-wrap: anywhere; }
.dash-day-label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 14px 0 0; }
.dash-task-check { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; margin: 0; }
.dash-fold { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; border-top: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.dash-fold > span:first-child { white-space: nowrap; }
.dash-fold > span:last-child { font-size: 11px; color: var(--muted); font-weight: 400; text-align: right; }
.dash-geld .dash-invoice-row .dash-contact-actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 768px) {
    .dash-day-row { grid-template-columns: 44px minmax(0, 1fr); row-gap: 8px; }
    .dash-day-row .dash-contact-actions { grid-column: 2; flex-wrap: wrap; }
    .dash-week { gap: 4px; }
    .dash-week-day { padding: 6px 2px; border-radius: var(--radius); }
    .dash-week-day small { font-size: 9px; }
    .dash-geld .dash-invoice-row { flex-wrap: wrap; }
    .dash-fold { flex-direction: column; align-items: flex-start; gap: 4px; }
    .dash-fold > span:last-child { text-align: left; }
}
/* Mail preview before any customer mail goes out (16.10.2026): warning, editable text, explicit click. */
.crm-mail-dialog { box-sizing: border-box; padding: 0; margin: auto; inset: 0; width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card, var(--surface)); color: var(--text); font: 400 13px/1.5 var(--app-font, inherit); box-shadow: 0 30px 120px rgba(0, 0, 0, .5); overflow: hidden; }
.crm-mail-dialog[open] { display: flex; flex-direction: column; }
.crm-mail-dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.crm-mail-dialog > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px 14px; border-bottom: 1px solid var(--border); }
.crm-mail-dialog > header h2 { margin: 2px 0 0; font-size: 18px; font-weight: 500; }
.crm-mail-dialog > header p:not(.workspace-eyebrow) { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.crm-mail-dialog .mail-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.crm-mail-dialog .mail-body { padding: 18px 24px 22px; overflow: auto; }
.crm-mail-dialog .mail-form { display: grid; gap: 6px; }
.crm-mail-dialog label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.crm-mail-dialog input, .crm-mail-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.crm-mail-dialog textarea { resize: vertical; min-height: 180px; line-height: 1.55; }
.crm-mail-dialog .mail-warn { margin: 0 0 6px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid rgba(180, 83, 9, .4); background: rgba(180, 83, 9, .08); color: var(--text); }
.crm-mail-dialog .mail-warn strong { color: var(--app-warning, #b45309); }
.crm-mail-dialog .mail-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.crm-mail-dialog .mail-status { margin: 6px 0 0; min-height: 1.2em; color: var(--muted); }
.crm-mail-dialog .mail-status.is-error { color: var(--app-danger, #dc2626); }
.crm-mail-dialog .mail-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.crm-mail-dialog .mail-footer .btn-flat { min-height: 40px; padding: 8px 16px; }
@media (max-width: 768px) {
    .crm-mail-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
    .crm-mail-dialog > header, .crm-mail-dialog .mail-body { padding-left: 16px; padding-right: 16px; }
    .crm-mail-dialog input, .crm-mail-dialog textarea { font-size: 16px; }
    .crm-mail-dialog textarea { height: 38dvh; min-height: 140px; }
    .crm-mail-dialog .mail-footer { flex-direction: column-reverse; }
    .crm-mail-dialog .mail-footer .btn-flat { width: 100%; min-height: 48px; }
}
.dash-recent { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 22px; border-top: 1px solid var(--border); }

@media (max-width: 1024px) and (min-width: 769px) {
    body .topbar { padding: 14px 20px !important; }
    body .topbar-left { gap: 16px !important; }
    body .topbar-right { flex-wrap: wrap !important; }
}
@media (max-width: 768px) {
    /* One page gutter. Lists share the same edge instead of nesting cards. */
    body { --app-gutter: 12px !important; }
    body #main-content .view { padding: 20px max(var(--app-gutter), env(safe-area-inset-right)) 24px max(var(--app-gutter), env(safe-area-inset-left)) !important; }
    body .view > [id$="-content"] { padding: 0 !important; min-width: 0 !important; }
    body :is(.app-section, .umsatz-panel, .contract-list-section) {
        background: transparent !important;
        border: 0 !important;
        border-top: 1px solid var(--border) !important;
        border-radius: 0 !important;
        padding: 20px 0 0 !important;
        box-shadow: none !important;
        min-width: 0 !important;
    }
    body .umsatz-overview { gap: 24px !important; }
    body .umsatz-panel-heading { margin-bottom: 16px !important; }
    body .umsatz-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 20px 16px !important; }
    body .umsatz-kpi { border: 0 !important; border-radius: 0 !important; background: transparent !important; padding: 0 !important; gap: 7px !important; }
    body .umsatz-kpi-primary { grid-column: 1 / -1 !important; padding: 16px !important; background: var(--primary-light) !important; border: 1px solid color-mix(in srgb,var(--brand,var(--brand,#1fae8c)) 25.1%,transparent) !important; border-radius: var(--radius) !important; }
    body .umsatz-kpi:last-child { grid-column: 1 / -1 !important; border-top: 1px solid var(--border) !important; padding-top: 16px !important; }
    body .umsatz-kpi:not(.umsatz-kpi-primary) .umsatz-kpi-label { min-height: 30px !important; align-items: flex-start !important; }
    body .umsatz-kpi-label i { margin-top: 3px !important; }
    body .umsatz-kpi:last-child .umsatz-kpi-label { min-height: 0 !important; }
    body .umsatz-kpi-value { font-size: clamp(23px, 6vw, 30px) !important; }
    body .umsatz-kpi-primary .umsatz-kpi-value { font-size: 30px !important; }
    body .umsatz-deals { gap: 0 !important; padding: 2px !important; max-height: none !important; }
    body .umsatz-deal { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; padding: 14px 0 !important; background: transparent !important; }
    body .umsatz-deal:first-child { padding-top: 0 !important; }
    body .umsatz-deal:last-child { border-bottom: 0 !important; }
    body .umsatz-deal:hover { background: var(--primary-light) !important; }
    body .umsatz-ranking { gap: 0 !important; }
    body .umsatz-rank-row { border: 0 !important; border-bottom: 1px solid var(--border) !important; background: transparent !important; border-radius: 0 !important; padding: 14px 0 !important; gap: 10px !important; }
    body .umsatz-rank-row:last-child { border-bottom: 0 !important; }
    body .umsatz-rank-row.is-me .umsatz-rank-name { color: var(--primary) !important; }

    body .workspace-heading { align-items: flex-start !important; flex-direction: column !important; padding: 4px 0 24px !important; gap: 18px !important; }
    body .workspace-heading h2 { font-size: 26px !important; }
    body .workspace-section-heading { gap: 10px !important; flex-wrap: wrap !important; }
    body .workspace-section-heading h3 { font-size: 16px !important; }
    body .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 18px 16px !important; padding: 18px 0 !important; }
    body .dash-kpis .kpi-flat { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; margin: 0 !important; min-width: 0 !important; }
    body .dash-kpis .kpi-stat-label { min-height: 30px !important; line-height: 1.5 !important; }
    body .dash-kpis .kpi-stat-value { font-size: clamp(23px, 5.8vw, 28px) !important; overflow-wrap: anywhere !important; }
    body .dash-columns { grid-template-columns: minmax(0, 1fr) !important; gap: 26px !important; }
    body .dash-columns > .app-section:first-child { border-top: 0 !important; padding-top: 0 !important; }
    body .dash-contact-row { display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; gap: 8px 10px !important; }
    body .dash-contact-actions { grid-column: 1 / -1 !important; }
    body .dash-record { min-height: 44px !important; font-size: 13px !important; }
    body .dash-task-row { align-items: flex-start !important; flex-wrap: wrap !important; }
    body .dash-task-dot { margin-top: 10px !important; }
    body .dash-task-row .dash-due { flex-basis: 100% !important; margin-left: 16px !important; }
    body .dash-lead-row { padding: 14px 0 !important; }
    body .dash-disclosure > summary { min-height: 56px !important; flex-wrap: wrap !important; }
    body .dash-disclosure > summary > span:nth-child(2) { font-size: 10px !important; }
    body .dash-invoice-row { align-items: flex-start !important; flex-direction: column !important; }
    body .dash-team-grid { grid-template-columns: minmax(0, 1fr) !important; }
    body .dash-team-header > div { min-width: 0 !important; }
    body .dash-text-link { min-height: 28px !important; }
    body :is(.chart-card, .cc-karte, .zahlungen-table-wrap) { padding: 18px 0 !important; border: 0 !important; border-top: 1px solid var(--border) !important; background: transparent !important; border-radius: 0 !important; box-shadow: none !important; }
    body :is(.stats-grid, .cc-kpis, .zahlungen-stats) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 20px 16px !important; }
    body :is(.stat-card, .cc-kpi, .zahlungen-stat-card) { background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; padding: 0 0 16px !important; border-radius: 0 !important; min-width: 0 !important; }
    body #forecast-cards { grid-template-columns: minmax(0, 1fr) !important; }
    body #forecast-cards > div { padding: 14px 0 !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; background: transparent !important; border-radius: 0 !important; }
    body .stats-charts { grid-template-columns: minmax(0, 1fr) !important; }
    body .leads-table-wrap { border-radius: var(--radius) !important; max-width: 100% !important; overflow-x: auto !important; }
    body :is(.btn-flat, .tbl-btn, .ra-knopf) { min-height: 44px !important; }
    body .tbl-btn { width: 44px !important; }

    /* Customer detail is one sheet; its sections do not need more boxes. */
    body .modal-overlay { padding: 0 !important; }
    body .modal-overlay .modal { width: 100% !important; max-width: 100% !important; max-height: calc(100dvh - 8px) !important; border-radius: var(--radius) var(--radius) 0 0 !important; margin: 0 !important; }
    /* The sheet slides up from the bottom edge (240 ms) and back down (160 ms) instead of fading in place;
       the overlay behind it fades (crm-style.css). translateY(0), not none: keeps the containing block. */
    body .modal-overlay .modal { transform: translateY(100%); opacity: 1; transition: transform var(--motion-slow-out) var(--ease-in), background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard); }
    body .modal-overlay.open .modal { transform: translateY(0); transition: transform var(--motion-slow) var(--ease-out), background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard); }
    body :is(.modal-header, .modal-body) { padding: 16px max(var(--app-gutter), env(safe-area-inset-right)) 16px max(var(--app-gutter), env(safe-area-inset-left)) !important; }
    body .detail-section { background: transparent !important; border: 0 !important; border-top: 1px solid var(--border) !important; border-radius: 0 !important; padding: 18px 0 !important; margin: 0 !important; box-shadow: none !important; }
    body .detail-section:first-child { border-top: 0 !important; padding-top: 0 !important; }
    body .detail-section-title { border: 0 !important; padding-bottom: 0 !important; }
    body .contract-history { border: 0 !important; border-radius: 0 !important; background: transparent !important; padding: 12px 0 0 !important; }
    body #contracts-list { gap: 0 !important; }
    body #contracts-list > tr { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; background: transparent !important; padding: 16px 0 !important; }

    /* Planning keeps time blocks and independently draggable tasks as cards. */
    body .ap-capacity { background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--ap-line) !important; border-radius: 0 !important; padding: 0 0 20px !important; }
    body .ap-finance-section { border: 0 !important; border-top: 1px solid var(--ap-line) !important; border-radius: 0 !important; background: transparent !important; }
    body .ap-finance-section > header { background: transparent !important; }
    body .ap-finance-section > header, body .ap-finance-row, body .ap-finance-empty { padding: 16px 0 !important; }
    /* Visible slide in (240 ms) and out (160 ms). visibility flips only after the slide-out, so the drawer
       stays visible while it moves; a transition beats the !important declaration. Children have no
       visibility transition of their own, so no button is left behind on screen. */
    body .sidebar { width: min(292px, calc(100vw - 28px)) !important; height: 100dvh !important; min-height: 0 !important; visibility: hidden !important; transition: transform var(--motion-slow-out) var(--ease-in), visibility 0s linear var(--motion-slow-out); }
    body .sidebar.mobile-open { visibility: visible !important; transition: transform var(--motion-slow) var(--ease-out), visibility 0s; }
    .sidebar-is-open { overflow: hidden !important; }
    .sidebar .sidebar-brand { min-height: 76px !important; padding-right: 10px !important; }
    .sidebar .brand-text { flex: 1 !important; }
    .shell-close { display: grid !important; place-items: center !important; width: 44px !important; height: 44px !important; flex: 0 0 44px !important; border: 0 !important; border-radius: var(--radius) !important; background: transparent !important; color: #a9b2ad !important; cursor: pointer !important; }
    .sidebar .nav-item, .sidebar .btn-add-lead { min-height: 44px !important; font-size: 13px !important; }
    .sidebar .sidebar-nav { min-height: 44px !important; }
    .sidebar :is(.sidebar-action-btn, .theme-toggle-btn) { min-height: 44px !important; font-size: 12px !important; }
    .sidebar .nav-group-toggle { min-height: 44px !important; }
    .sidebar .theme-toggle-btn { min-height: 48px !important; }
    .sidebar-account { display: block !important; padding-top: 8px !important; }
    .sidebar-identity { flex: 1 !important; min-width: 0 !important; }
    .account-menu .account-avatar { display: grid !important; }
    .account-actions { margin: 0 !important; gap: 0 !important; }
    .account-menu .account-actions button { width: 100% !important; min-height: 44px !important; }
    /* Clip horizontal overflow without creating an unscrollable sticky ancestor. */
    html, body, body #main-content { overflow-x: clip !important; }
    body .main { margin-left: 0 !important; width: 100% !important; }
    body .topbar { position: sticky !important; top: 0 !important; z-index: 60 !important; flex-shrink: 0 !important; padding: calc(10px + env(safe-area-inset-top)) max(var(--app-gutter), env(safe-area-inset-right)) 10px max(var(--app-gutter), env(safe-area-inset-left)) !important; gap: 10px !important; }
    body .topbar-left { width: 100% !important; gap: 10px !important; }
    body .topbar-left h1 { flex: 1 !important; font-size: 14px !important; }
    body .hamburger-btn { width: 44px !important; height: 44px !important; border-radius: var(--radius) !important; }
    body .search-wrap { flex: 1 0 100% !important; min-width: 0 !important; }
    body .search-wrap input { width: 100% !important; min-height: 44px !important; font-size: 16px !important; }
    body .topbar-right { flex-wrap: wrap !important; width: 100% !important; }
    body .topbar-filters { width: 100% !important; }
    body .topbar-filters summary { min-height: 44px !important; font-size: 12px !important; width: fit-content !important; }
    body .topbar-filters .topbar-right { position: static !important; width: 100% !important; margin-top: 10px !important; box-shadow: none !important; padding: 12px !important; }
    body .filter-select { min-height: 44px !important; max-width: 100% !important; font-size: 14px !important; }
}

@media (prefers-reduced-motion: reduce) {
    body .view.active, body .kpi-flat { animation: none !important; }
    .theme-track > span, .nav-chevron, .dash-disclosure > summary i { transition: none !important; }
}
