/* MILOVITAL workspace: shared components and responsive everyday workflows. */
:root {
  --bg: #f4f7f6; --panel: #fff; --text: #20332d; --muted: #61736c;
  --border: #dce5e0; --brand: #146b54; --brand-soft: #e8f4ed;
  --sidebar: #123c31; --sidebar-text: #d3e4db; --accent: #91d4b3;
  --radius: 12px; --shadow: 0 2px 8px rgb(23 48 37 / 4%);
  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px; --space-5: 32px;
  --field-height: 48px; --workspace-top: 0px;
}
[hidden] { display: none !important; }
body { font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
:is(a, button, input, select, textarea):focus-visible { outline: 3px solid #479c79; outline-offset: 3px; }
.app { grid-template-columns: 232px minmax(0, 1fr); align-items: start; }
.sidebar { height: 100vh; height: 100dvh; padding: 24px 0 0; z-index: 40; }
.logo { display: flex; align-items: center; justify-content: space-between; padding: 0 24px 24px; margin-bottom: 16px; gap: 16px; }
.logo b { font-size: 18px; letter-spacing: .06em; }
.logo span { color: #bdd6c8; font-size: 12px; margin-top: 4px; }
.nav { padding: 0 12px 24px; overscroll-behavior: contain; }
.nav a { min-height: 48px; padding: 12px; border: 0; border-radius: 8px; margin: 0 0 4px; gap: 12px; font-size: 14px; }
.nav a.active { background: #d9efe3; color: #164f3c; }
.nav a.active:hover { background: #e5f5ec; color: #164f3c; }
.nav-group[data-g] { width: 100%; min-height: 48px; background: none; border: 0; padding: 16px 12px 8px; margin: 8px 0 0; color: #b7d3c3; font-size: 11px; text-align: left; font-weight: 600; letter-spacing: .055em; }
.nav-sek { padding: 0 0 8px 8px; }
.nav-sek a { font-weight: 400; font-size: 13px; }
.sidebar .user { padding: 16px 24px max(16px, env(safe-area-inset-bottom)); }
.sidebar .user b { overflow-wrap: anywhere; font-size: 13px; }
.sidebar .user button { border: 0; background: none; color: #d3e4db; min-height: 44px; padding: 8px 0; font-size: 13px; text-decoration: underline; }
.workspace-mobilebar, .nav-backdrop, .nav-close { display: none; }
main { max-width: 1520px; padding: 32px 32px 64px; margin: 0 auto; width: 100%; min-width: 0; }
.workspace-content { min-width: 0; }
#visit-context { max-width: 1520px; margin: 0 auto; padding: 24px 32px 0; }
#visit-context .tour-rueck { position: static; margin: 0; }
#visit-context .tour-rueck.collapsed { padding-block: 8px; }
.visit-existing-measurements { margin-bottom: 24px; padding: 16px; background: var(--brand-soft); border-radius: var(--radius); }
.visit-existing-measurements h3 { margin: 0 0 12px; }
.visit-existing-measurements p { margin: 12px 0 0; }
@media (max-width: 1100px) {
  #visit-context { padding: calc(var(--workspace-top) + 16px) 24px 0; }
  #visit-context:not([hidden]) ~ main { padding-top: 24px !important; }
}
@media (max-width: 600px) {
  #visit-context { padding-left: 16px; padding-right: 16px; }
  #visit-context .tour-rueck.collapsed { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; align-items: stretch; }
  #visit-context .tour-rueck.collapsed > span { grid-column: 1 / -1; }
}
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 24px; margin: 0 0 24px; }
.pagehead > :is(h1,p,.crumb) { flex-basis: 100%; min-width: 0; overflow-wrap: anywhere; }
.pagehead h1 { font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -.025em; }
.pagehead p { margin: 0; max-width: 80ch; }
.pagehead .crumb { margin: 0; font-size: 13px; }
.pagehead .actions { float: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 100%; margin: 0; order: 2; }
.pagehead .actions > * { min-width: 0; }
.pagehead.akte-kopf { display: block; }
.akte-kopf .akte-kopf-zeile { margin: 0 0 24px; }
.akte-kopf .actions { justify-content: flex-start; }
.akte-name { align-items: center; gap: 16px; }
.btn, .btn.sm, .btn.big, .seg button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; font-size: 14px; line-height: 1.35; font-weight: 600; vertical-align: middle; text-align: center; }
.btn:not(.sm), .seg button { min-height: var(--field-height); }
.btn.ghost, .btn.danger { border: 1px solid var(--border); }
.btn.big { min-height: 52px; padding: 16px 24px; font-size: 16px; }
.btn:disabled { cursor: not-allowed; }
.block, .kpi, .vital-card, .wiz-card, .ef-sec, .mt-ziel, .mt-kachel { border-radius: 12px; }
section.block { margin-bottom: 24px; }
section.block > h2 { padding: 16px 24px; font-size: 14px; line-height: 1.5; text-transform: none; letter-spacing: 0; color: var(--text); flex-wrap: wrap; }
section.block > h2 .h2-action { display: flex; flex-wrap: wrap; gap: 8px; }
.block-body { padding: 24px; }
.grid, .ef-g3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px 16px; align-items: start; }
.grid > * { min-width: 0; }
.grid > :is(.c2,.c3,.c4,.c5,.c6,.c8,.c9,.c12):not(.field) { grid-column: 1 / -1; flex-wrap: wrap; }
.grid > .field, .u-box .grid > .field { min-width: 0; grid-column: auto !important; }
.grid > .field.c12, .grid > .field:has(textarea), .u-box .grid > .field.c12 { grid-column: 1 / -1 !important; }
.field { gap: 8px; min-width: 0; }
.field:empty { display: none; }
.field label { display: block; color: #485e54; font-size: 13px; line-height: 1.45; font-weight: 600; }
.field > label:first-child { min-height: 38px; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
:is(.field,.filters,.frage,.mt-nachtrag,.ef-eingabe,.pg-freq,.login-card) input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]),
:is(.field,.filters,.frage,.pg-freq) select,
.mt-input:not(textarea), .mt-vital-feld input, .mt-eingabe input {
  display: block; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%;
  height: var(--field-height); min-height: var(--field-height); padding: 10px 12px;
  border: 1px solid #c8d6ce; border-radius: 8px; background: var(--panel);
  color: var(--text); font-size: 16px; line-height: 24px; font-weight: 400;
}
.field textarea, .frage textarea, textarea.mt-input { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 120px; padding: 12px; border: 1px solid #c8d6ce; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 16px; line-height: 1.5; }
input[type=date], input[type=time], input[type=datetime-local] { -webkit-appearance: none; appearance: none; box-sizing: border-box; min-width: 0; height: 48px; min-height: 48px; padding: 10px 12px; border: 1px solid #c8d6ce; border-radius: 8px; font-size: 16px; line-height: 24px; background: var(--panel); color: var(--text); }
input::-webkit-date-and-time-value { text-align: left; min-height: 24px; }
input:disabled, select:disabled, textarea:disabled { background-color: #f0f4f1 !important; color: #64766f; opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); flex-shrink: 0; }
.filters { padding: 16px 24px; gap: 16px; align-items: center; }
.filters > input, .filters > select { flex: 1 1 180px; width: auto; }
.filters input[type=search] { width: auto; }
.filters > label { flex: 1 1 180px; min-width: 0; }
.callout { padding: 16px; margin-bottom: 24px; align-items: flex-start; font-size: 14px; overflow-wrap: anywhere; }
.kpis, .score-grid, .vital-grid { gap: 16px; margin-bottom: 24px; }
.kpi { padding: 24px; }
.kpi .value { font-size: 28px; }
th, td { padding: 16px; font-size: 13px; }
th { text-transform: none; letter-spacing: 0; background: #f7faf8; }
td { overflow-wrap: anywhere; }
.empty { padding: 32px 24px; }
.pill { font-size: 12px; padding: 4px 10px; }
.wiz-shell { max-width: 1000px; }
.wiz-top { gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.wiz-top h1 { min-width: 0; font-size: 24px; }
.wiz-top .btn { flex-shrink: 0; }
.wiz-card { padding: 24px; }
.wiz-steps { gap: 8px; margin-bottom: 24px; }
.wiz-steps span { display: inline-flex; align-items: center; min-height: 44px; white-space: normal; padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.frage { padding: 24px 0; }
.frage .flabel { font-size: 16px; }
.frage .fhilfe, .wiz-card .wiz-hilfe { font-size: 14px; }
.frage .opts { gap: 8px; margin-top: 16px; }
.opt { min-height: 48px; padding: 12px 16px; font-size: 15px; border-radius: 8px; text-align: left; }
.skala-punkte { position: static; flex-wrap: wrap; gap: 16px; padding: 16px 0; }
.check-row, .check-grid .check-row { min-height: 48px; padding: 12px; }
.kontr-test > input { min-width: 0; min-height: 48px; font-size: 16px !important; }
.wiz-nav { gap: 16px; margin-top: 24px; }
.wiz-nav .btn { min-width: 120px; }
.tour-rueck { top: var(--workspace-top); border-radius: 8px; gap: 16px; padding: 12px 16px; margin-bottom: 24px; }
.tour-rueck span { min-width: 0; flex: 1 1 240px; }
.tour-dot { width: 44px; height: 44px; }
.tour-dots { gap: 12px; margin-bottom: 24px; }
.tour-start .block-body, .tour-schritt, .tour-liste { gap: 16px; }
.tour-aufgabe { padding: 16px; gap: 16px; }
.tour-grund textarea, .ek-bericht textarea { min-height: 120px; }
.ta-grund { width: 100%; min-width: 0; height: 48px; padding: 10px 12px; font-size: 16px; }
.tour-grund textarea { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.ta-text { gap: 12px; }
.ta-btns { gap: 8px; flex-wrap: wrap; }
.dd-menu a { min-height: 44px; padding: 12px; }
.dd-menu { max-width: calc(100vw - 32px); }
.visit-task-group { display: grid; gap: 16px; margin-bottom: 24px; }
.visit-task-group > h3 { margin: 0; padding: 8px 0; font-size: 17px; color: var(--text); }
.visit-measure-status { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.visit-measure-program { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 8px; }
.visit-measure-program legend { padding: 0 8px; font-size: 14px; font-weight: 600; }
.visit-measure-program .opts { margin: 0; gap: 8px; }
.visit-measure-choice { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px; background: var(--bg); border-radius: 8px; font-size: 14px; }
.visit-measure-choice input { width: 20px; height: 20px; }
.ek-kopf, .ek-aktion { flex-wrap: wrap; gap: 16px; }
.ek-aufgaben, .ek-bericht { gap: 16px; margin-top: 16px; }
.ef-overlay, .u-overlay, .sicher-overlay { padding: 24px; overscroll-behavior: contain; }
.ef-modal { max-width: 1000px; max-height: calc(100dvh - 48px); border-radius: 16px; }
.ef-modal-kopf { padding: 16px 24px; gap: 16px; border-radius: 16px 16px 0 0; }
.ef-modal-kopf h2 { min-width: 0; overflow-wrap: anywhere; }
.ef-x { width: 44px; height: 44px; min-width: 44px; }
.ef-modal-body { padding: 24px; gap: 24px; scrollbar-gutter: stable; }
.ef-sec-kopf { padding: 16px 24px; flex-wrap: wrap; }
.ef-sec-kopf h3 { min-width: 0; }
.ef-sec-body { padding: 24px; gap: 16px; }
.ef-g2 { gap: 24px 16px; }
.ef-modal .field input, .ef-modal .field select { height: 48px; }
.ef-modal .field textarea { min-height: 120px; }
.ef-fuss { padding: 16px 24px; gap: 16px; }
.ef-fuss-knoepfe .btn { min-height: 48px; }
.ef-zusammenfassung { min-width: 0; flex-basis: 240px; }
.ef-eingabe { gap: 8px; align-items: center; }
.ef-eingabe input { height: 48px; }
.ef-eingabe button { min-width: 48px; }
.ef-item { min-height: 64px; padding: 12px 16px; gap: 12px; }
.ef-item-weg { width: 44px; height: 44px; }
.ef-bausteine { gap: 8px; }
.ef-baustein { min-height: 48px; padding: 12px; font-size: 13px; }
.sicher-box, .u-box { max-height: calc(100dvh - 48px); overflow-y: auto; padding: 24px; }
.sicher-actions { flex-wrap: wrap; }
.mt-kacheln, .mt-vital-grid { gap: 16px; }
.mt-kachel { min-height: 128px; padding: 16px; }
.mt-kachel-sub { white-space: normal; overflow: visible; }
.mt-nachtrag { gap: 16px; align-items: flex-end; }
.mt-nachtrag > label { flex: 1 1 180px; }
.mt-nachtrag input { margin-top: 8px; }
.mt-vital-feld { gap: 8px; }
.mt-vital-feld input { text-align: left; }
.mt-vital-feld span { min-height: 38px; display: flex; align-items: flex-end; }
.mt-leiste { gap: 8px; }
.mt-leiste a { min-height: 48px; }
.toast { max-width: calc(100vw - 32px); bottom: calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.login-card { width: min(420px, calc(100% - 32px)); padding: 32px; }
.login-card label { margin-top: 24px; margin-bottom: 8px; font-size: 13px; }
.login-card button { margin-top: 24px; }

/* CRM views: the client stays in context while work changes. */
.crm-header { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-bottom: 24px; }
.crm-identity { display: flex; gap: 16px; align-items: center; flex: 1 1 280px; min-width: 0; }
.crm-identity > div { min-width: 0; }
.crm-avatar { flex: none; width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-size: 22px; font-weight: 600; }
.crm-identity h1 { font-size: 26px; line-height: 1.3; letter-spacing: -.025em; margin: 0 0 8px; overflow-wrap: anywhere; }
.crm-identity p { margin: 0; }
.crm-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 13px; }
.crm-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; min-width: 0; max-width: 100%; }
.crm-actions > details { min-width: 0; max-width: 100%; }
.crm-actions > details[open] { flex-basis: 100%; width: 100%; }
.crm-actions > details > summary { width: 100%; }
.crm-actions > details > .crm-card-body { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; min-width: 0; }
.crm-actions > details > .crm-card-body > .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.crm-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 16px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.crm-tab { min-height: 48px; padding: 12px 16px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.crm-tab:hover { color: var(--brand); background: var(--brand-soft); }
.crm-tab.active, .crm-tab[aria-selected=true] { color: var(--brand); background: var(--panel); border-color: var(--border); box-shadow: var(--shadow); }
.crm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 24px; align-items: start; }
.crm-main, .crm-aside { min-width: 0; display: grid; gap: 24px; }
.crm-main > *, .crm-aside > * { min-width: 0; margin-bottom: 0; }
.crm-card { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.crm-card-head { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.crm-card-head :is(h2,h3) { font-size: 16px; margin: 0; }
.crm-card-body { padding: 24px; }
#akte-sektionen { display: grid; gap: var(--space-4); min-width: 0; }
#akte-sektionen > :is(.block,.crm-card),
#akte-sektionen > :is(#diag-slot,#hm-slot) > section.block { margin: 0; }
#akte-sektionen > :is(#diag-slot,#hm-slot):empty { display: none; }
#akte-sektionen > section.block > h2 { font-size: 16px; }
#akte-sektionen .empty { padding: 24px !important; margin: 0; text-align: left; }
.crm-card-body > .crm-empty { padding: 0; margin: 0; }
.crm-next { background: var(--brand-soft); border: 1px solid #b9d9c8; border-radius: 12px; padding: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.crm-card.crm-next { padding: 0; }
.crm-next :is(h2,h3) { margin: 0 0 8px; font-size: 18px; }
.crm-next p { margin: 0; }
.crm-next .crm-status { margin-bottom: 8px; }
.crm-next .crm-card-body > .btn { margin-top: 16px; }
.crm-next > div { flex: 1 1 240px; min-width: 0; }
.crm-status { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.crm-list { display: grid; }
.crm-row { display: flex; gap: 16px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.crm-row:last-child { border-bottom: none; }
.crm-row-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.crm-row-main :is(h3,p) { margin: 0; }
.crm-row-main h3 { font-size: 15px; }
.crm-row-main p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.crm-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-empty { padding: 24px; margin: 0; text-align: left; color: var(--muted); }
.crm-timeline { display: grid; gap: 0; }
.crm-event { padding: 16px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 16px; }
.crm-event:last-child { border-bottom: 0; }
.crm-event time { color: var(--muted); font-size: 13px; }
.crm-event p { margin: 0; overflow-wrap: anywhere; }

/* Client master data use named topic cards instead of a mixed field grid. */
.stamm-workspace { display: grid; gap: 24px; min-width: 0; }
.stamm-intro { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.stamm-intro h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.stamm-intro p { margin: 8px 0 0; color: var(--muted); }
.stamm-card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: stretch; gap: 24px; }
.stamm-card .crm-card-head { align-items: flex-start; gap: 16px; }
.stamm-card .crm-card-head > div { flex: 1 1 180px; min-width: 0; }
.stamm-card .crm-card-head p { margin: 4px 0 0; min-height: 39px; color: var(--muted); font-size: 13px; }
.stamm-card .crm-card-head > .btn { flex: none; }
.stamm-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 16px; padding: 24px; margin: 0; }
.stamm-item { min-width: 0; }
.stamm-wide { grid-column: 1 / -1; }
.stamm-item dt { margin: 0 0 6px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.stamm-item dd { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; white-space: pre-wrap; }
.stamm-missing { font-weight: 400; color: var(--muted); }
.stamm-note { padding: 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stamm-card-actions { padding: 0 24px 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.stamm-card-actions:empty { display: none; }
.stamm-map { border-top: 1px solid var(--border); padding: 0 24px; }
.stamm-map summary { min-height: 48px; padding: 12px 0; cursor: pointer; color: var(--brand); font-size: 14px; font-weight: 600; }
.stamm-map .karte-klein { height: 240px; margin-bottom: 24px; }
.stamm-import { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.stamm-import > summary { min-height: 56px; padding: 16px 24px; cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.stamm-import > summary > .mut { font-weight: 400; font-size: 13px; margin-left: 16px; }
.stamm-import[open] > summary { border-bottom: 1px solid var(--border); }
.stamm-import .stamm-facts { grid-template-columns: repeat(4,minmax(0,1fr)); }
.stamm-import-hint { margin: 0; padding: 0 24px 24px; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .stamm-card-grid { grid-template-columns: minmax(0,1fr); }
  .stamm-import .stamm-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  #akte-sektionen, .stamm-workspace, .stamm-card-grid { gap: 16px; }
  #akte-sektionen .empty { padding: 16px !important; }
  .stamm-intro > .btn { width: 100%; }
  .stamm-facts, .stamm-note { padding: 16px; }
  .stamm-card-actions { padding: 0 16px 16px; }
  .stamm-card-actions > .btn { flex: 1 1 160px; }
  .stamm-map { padding: 0 16px; }
  .stamm-map .karte-klein { margin-bottom: 16px; }
  .stamm-import > summary { padding: 16px; }
  .stamm-import > summary > .mut { display: block; margin: 4px 0 0; }
  .stamm-import-hint { padding: 0 16px 16px; }
}

@media (max-width: 1100px) {
  .crm-layout { grid-template-columns: minmax(0,1fr); }
  .crm-aside { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  :root { --workspace-top: calc(72px + env(safe-area-inset-top)); }
  .app { display: block; }
  .workspace-mobilebar { display: flex; position: fixed; inset: 0 0 auto; z-index: 60; align-items: center; gap: 16px; padding: calc(12px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left)); min-height: var(--workspace-top); background: var(--panel); border-bottom: 1px solid var(--border); }
  .workspace-brand { text-decoration: none; color: var(--brand); font-size: 15px; line-height: 1.3; letter-spacing: .04em; font-weight: 700; }
  .workspace-brand span { display: block; font-size: 11px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
  .burger { display: inline-flex; justify-content: center; align-items: center; position: static; width: 48px; height: 48px; min-width: 48px; padding: 0; box-shadow: none; border-radius: 8px; font-size: 20px; background: var(--brand-soft); color: var(--brand); }
  .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: min(320px,calc(100vw - 48px)); height: 100vh; height: 100dvh; padding-top: calc(24px + env(safe-area-inset-top)); z-index: 80; transform: translateX(-100%); visibility: hidden; transition: transform .18s ease, visibility .18s; }
  .sidebar.offen { transform: translateX(0); visibility: visible; box-shadow: 8px 0 32px rgb(0 0 0 / 20%); }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 70; border: 0; border-radius: 0; background: rgb(9 28 19 / 45%); }
  .nav-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; padding: 0; color: #e4f3eb; border: 1px solid #527563; border-radius: 8px; background: none; font-size: 18px; }
  body.nav-offen { overflow: hidden; }
  main { padding: calc(var(--workspace-top) + 24px) max(24px,env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left)) !important; }
  .grid, .ef-g3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .visit-measure-status { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid > .field, .u-box .grid > .field { grid-column: auto !important; }
  .grid > .field.c12, .grid > .field:has(textarea), .u-box .grid > .field.c12 { grid-column: 1 / -1 !important; }
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ef-g2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ef-bausteine { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pagehead h1 { font-size: 24px; }
  .pagehead .actions { margin-bottom: 0; }
  .mt-leiste { position: fixed; left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); bottom: max(8px,env(safe-area-inset-bottom)); z-index: 40; margin: 0; box-shadow: 0 4px 24px rgb(23 48 37 / 12%); }
  main.mt-seite { padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important; }
  .mt-kacheln { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  main { padding-left: max(16px,env(safe-area-inset-left)) !important; padding-right: max(16px,env(safe-area-inset-right)) !important; }
  .grid, .ef-g2, .ef-g3, .ef-bausteine, .crm-aside { grid-template-columns: minmax(0,1fr); }
  .visit-measure-status { grid-template-columns: minmax(0,1fr); }
  .visit-measure-choice { flex: 1 1 100%; }
  .field > label:first-child, .mt-vital-feld span { min-height: 0; }
  .block-body, .wiz-card, .crm-card-body { padding: 16px; }
  section.block > h2, .crm-card-head, .crm-row { padding: 16px; }
  .filters { padding: 16px; }
  .pagehead h1, .crm-identity h1 { font-size: 23px; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions > .btn { flex: 1 1 140px; }
  .crm-header { padding: 16px; gap: 16px; }
  .crm-identity { flex-basis: 100%; }
  .crm-avatar { width: 48px; height: 48px; border-radius: 12px; font-size: 18px; }
  .crm-actions { width: 100%; }
  .crm-actions > .btn, .crm-actions > details { flex: 1 1 140px; }
  .crm-actions > .btn, .crm-actions > details > summary { height: 56px; min-height: 56px; padding: 8px 12px; line-height: 20px; }
  .crm-actions > details[open] { flex-basis: 100%; }
  .crm-actions > details > .crm-card-body > .btn { flex: 1 1 140px; }
  .crm-tabs { flex-wrap: nowrap; gap: 8px; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scroll-padding-inline: 4px; padding: 4px 4px 12px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
  .crm-tab { flex: 0 0 auto; min-width: 0; min-height: 48px; white-space: nowrap; padding: 12px 16px; scroll-margin-inline: 4px; }
  .crm-next { padding: 16px; }
  .crm-next > .btn { width: 100%; }
  .crm-row { flex-wrap: wrap; }
  .crm-row-main { flex-basis: 180px; }
  .crm-row-actions { width: 100%; }
  .crm-row-actions > .btn { flex: 1; }
  .crm-event { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .ef-overlay { padding: 0; }
  .ef-modal { width: 100%; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .ef-modal-kopf { padding: calc(16px + env(safe-area-inset-top)) 16px 16px; border-radius: 0; }
  .ef-modal-body { padding: 16px; gap: 16px; scrollbar-gutter: auto; }
  .ef-sec-kopf, .ef-sec-body { padding: 16px; }
  .ef-fuss { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 0; }
  .ef-fuss-knoepfe { display: flex; width: 100%; }
  .ef-fuss-knoepfe .btn { flex: 1; }
  .u-overlay, .sicher-overlay { padding: 16px; }
  .sicher-box, .u-box { max-height: calc(100dvh - 32px); padding: 24px 16px; }
  .sicher-actions > .btn { flex: 1; }
  .mt-vital-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mt-kacheln { gap: 8px; }
  .mt-kachel { padding: 16px; }
  .mt-leiste { left: max(8px,env(safe-area-inset-left)); right: max(8px,env(safe-area-inset-right)); gap: 0; }
  .mt-leiste a { font-size: 11px; padding: 8px 2px; }
  .tour-rueck { position: static; }
  .tour-rueck .btn { flex: 1 1 100%; }
  .ta-text .btn { width: 100%; margin-left: 0; }
  .ta-btns .btn { flex-basis: 100%; }
  .dd-menu { left: 0; right: auto; min-width: min(270px,calc(100vw - 32px)); }
  .kpi { padding: 16px; }
  .login-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .workspace-mobilebar, .nav-backdrop, .sidebar, .crm-tabs, .crm-actions { display: none !important; }
  .app { display: block; }
  main { padding: 0 !important; max-width: none; }
  .crm-layout { display: block; }
  .crm-header, .crm-card { box-shadow: none; break-inside: avoid; margin-bottom: 16px; }
  .grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .pb-tab th,.pb-tab td { padding: 4px 5px; }
}

/* Keep the allergy label readable above the value on narrow client headers. */
@media (max-width: 600px) {
  .crm-allergy-status { display: block; }
  .crm-allergy-status > b { display: block; margin-bottom: 8px; }
}

.legacy-document { display:flex; flex-wrap:wrap; align-items:center; gap:16px; padding:16px 0; border-top:1px solid var(--border); }
.legacy-document > div { flex:1 1 240px; min-width:0; }
