/* BASKURT AI HQ – Control Center
   Eigene visuelle Identität: ruhiges Papier-Weiß, präzise Haarlinien, Beschriftungen wie auf Planköpfen. */
:root {
  --bg: #f4f4f1;
  --bg-elev: #ffffff;
  --bg-sunk: #ecece8;
  --line: rgba(20, 20, 18, 0.08);
  --line-strong: rgba(20, 20, 18, 0.14);
  --text: #191917;
  --text-2: #5f5f5a;
  --text-3: #8d8d86;
  --ok: #2f7d4f;
  --warn: #a8661b;
  --bad: #b3372f;
  --info: #3d63a8;
  --accent: #191917;
  --accent-soft: rgba(25, 25, 23, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --radius-s: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar: 248px;
  color-scheme: light;
}
:root[data-view="atelier"] { --accent: #8a6a4f; --accent-soft: rgba(138, 106, 79, 0.1); }
:root[data-view="gmbh"] { --accent: #2f5d8a; --accent-soft: rgba(47, 93, 138, 0.1); }
:root[data-view="privat"] { --accent: #5f7f62; --accent-soft: rgba(95, 127, 98, 0.12); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --bg-elev: #1b1b1a; --bg-sunk: #0d0d0c; --line: rgba(255, 255, 255, 0.07); --line-strong: rgba(255, 255, 255, 0.13);
    --text: #ecebe6; --text-2: #a7a69f; --text-3: #75746e; --accent: #ecebe6; --accent-soft: rgba(255, 255, 255, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7); color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-view="atelier"] { --accent: #c49c78; --accent-soft: rgba(196, 156, 120, 0.13); }
  :root:not([data-theme="light"])[data-view="gmbh"] { --accent: #7ea6d4; --accent-soft: rgba(126, 166, 212, 0.13); }
  :root:not([data-theme="light"])[data-view="privat"] { --accent: #93b896; --accent-soft: rgba(147, 184, 150, 0.13); }
}
:root[data-theme="dark"] {
  --bg: #121211; --bg-elev: #1b1b1a; --bg-sunk: #0d0d0c; --line: rgba(255, 255, 255, 0.07); --line-strong: rgba(255, 255, 255, 0.13);
  --text: #ecebe6; --text-2: #a7a69f; --text-3: #75746e; --accent: #ecebe6; --accent-soft: rgba(255, 255, 255, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7); color-scheme: dark;
}
:root[data-theme="dark"][data-view="atelier"] { --accent: #c49c78; --accent-soft: rgba(196, 156, 120, 0.13); }
:root[data-theme="dark"][data-view="gmbh"] { --accent: #7ea6d4; --accent-soft: rgba(126, 166, 212, 0.13); }
:root[data-theme="dark"][data-view="privat"] { --accent: #93b896; --accent-soft: rgba(147, 184, 150, 0.13); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 26px; letter-spacing: -0.025em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------ Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 18px 12px 24px;
  background: color-mix(in srgb, var(--bg) 70%, var(--bg-elev)); display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 0; }
.brand b { font-size: 13px; letter-spacing: 0.32em; font-weight: 700; }
.brand span { font-size: 10px; letter-spacing: 0.18em; color: var(--text-3); font-weight: 600; }
/* Fünf Bereiche: Schaltflächen nach Textlänge umbrechen und die Zeile füllen. */
.switcher { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--bg-sunk); border-radius: 11px; }
.switcher button { flex: 1 1 auto; justify-content: center; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 600; color: var(--text-2); cursor: pointer; display: flex; align-items: center; gap: 5px; white-space: nowrap;
  transition: background .2s, color .2s; }
.switcher button i { flex: none; width: 6px; height: 6px; border-radius: 3px; background: var(--dot); opacity: .9; }
.switcher button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav .group { margin: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; text-decoration: none; color: var(--text-2);
  font-weight: 500; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--accent-soft); color: var(--text); }
.nav a[aria-current="page"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 10px;
  background: var(--bg-sunk); color: var(--text-2); font-variant-numeric: tabular-nums; }
.nav a .count.hot { background: var(--accent); color: var(--bg-elev); }
.nav a .plan { margin-left: auto; font-size: 9.5px; color: var(--text-3); letter-spacing: .06em; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 32px; backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.topbar .crumb { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--bg-sunk); color: var(--text-2); white-space: nowrap; }
.chip.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.chip.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.chip .dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.content { padding: 28px 32px 120px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------ Bausteine */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 10px; }
.card-head .more { margin-left: auto; font-size: 12.5px; color: var(--text-2); text-decoration: none; }
.card-head .more:hover { color: var(--text); }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text);
  padding: 7px 13px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; transition: transform .1s, background .15s; }
.btn:hover { background: var(--bg-sunk); }
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--text); color: var(--bg-elev); border-color: transparent; }
.btn.primary:hover { opacity: .88; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--bg-elev); border-radius: 10px; padding: 9px 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row.click { cursor: pointer; transition: background .12s; }
.row.click:hover { background: var(--accent-soft); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 26px 20px; color: var(--text-3); text-align: center; font-size: 13px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--bg-sunk); color: var(--text-2); white-space: nowrap; }
.tenant-dot { width: 7px; height: 7px; border-radius: 4px; flex: none; }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg-sunk); border-radius: 11px; width: fit-content; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* ------------------------------------------------ Dashboard */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.hello .date { font-size: 12.5px; color: var(--text-3); letter-spacing: .04em; margin-bottom: 4px; }
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { padding: 14px 14px 12px; position: relative; text-decoration: none; display: block; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.kpi .v { font-size: 25px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .v.small { font-size: 17px; }
.kpi .n { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.kpi.alert .v { color: var(--bad); }
.kpi.na .v { color: var(--text-3); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.briefing { padding: 20px 22px; position: relative; overflow: hidden; }
.briefing p { margin: 10px 0 0; font-size: 15px; line-height: 1.6; max-width: 70ch; }
.briefing .sig { display: flex; align-items: center; gap: 10px; }
.mini-av { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); flex: none; }
.mini-av svg { width: 16px; height: 16px; }
.feed .row { align-items: flex-start; }
.feed .when { font-size: 11.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.k-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; margin-top: 1px; background: var(--bg-sunk); color: var(--text-2); }
.k-ico svg { width: 13px; height: 13px; }
.k-ico.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.k-ico.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.k-ico.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.radar-date { width: 46px; flex: none; text-align: center; border-radius: 9px; padding: 4px 0; background: var(--bg-sunk); }
.radar-date b { display: block; font-size: 16px; line-height: 1.1; }
.radar-date span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.radar-date.soon { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.chart { width: 100%; height: 120px; display: block; }
.bar-track { height: 8px; background: var(--bg-sunk); border-radius: 4px; overflow: hidden; position: relative; }
.bar-track i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.bar-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); }
.statusline { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------ Team */
.org { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; font-size: 12.5px; color: var(--text-2); }
.org .node { padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-elev); font-weight: 600; color: var(--text); }
.org .arrow { color: var(--text-3); }
.floor { display: flex; flex-direction: column; gap: 26px; }
.zone h3 { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.zone h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.desks { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.desk { position: relative; padding: 16px 16px 14px; cursor: pointer; transition: transform .2s ease, box-shadow .2s; text-align: left; border: 1px solid var(--line);
  background: var(--bg-elev); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-height: 178px; }
.desk:hover { transform: translateY(-2px); }
.desk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.desk .who { display: flex; gap: 12px; align-items: center; }
.desk .num { font-size: 10.5px; color: var(--text-3); font-weight: 600; letter-spacing: .1em; }
.desk .name { font-weight: 600; line-height: 1.25; }
.desk .ttl { font-size: 12px; color: var(--text-2); }
.desk .station { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.desk .station svg { width: 12px; height: 12px; }
.av { width: 52px; height: 52px; flex: none; position: relative; }
.av svg { width: 100%; height: 100%; display: block; }
.av .st { position: absolute; right: -1px; bottom: 1px; width: 13px; height: 13px; border-radius: 7px; border: 2.5px solid var(--bg-elev); background: var(--text-3); }
.s-arbeitet .av .st { background: var(--ok); }
.s-arbeitet .av::before { content: ""; position: absolute; inset: -4px; border-radius: 18px; border: 1.5px solid var(--ok); opacity: 0; animation: ring 2.2s ease-out infinite; }
.s-wartet_freigabe .av .st { background: var(--warn); }
.s-wartet_daten .av .st { background: var(--info); }
.s-geplant .av .st { background: var(--info); }
.s-fehler .av .st { background: var(--bad); }
.s-offline { opacity: .55; }
.s-offline .av .st { background: transparent; border-color: var(--text-3); }
@keyframes ring { 0% { transform: scale(.92); opacity: .55; } 80%, 100% { transform: scale(1.15); opacity: 0; } }
.bubble { position: relative; font-size: 12.5px; line-height: 1.4; background: var(--bg-sunk); border-radius: 11px; padding: 8px 10px; color: var(--text); }
.bubble::before { content: ""; position: absolute; left: 20px; top: -5px; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.s-arbeitet .bubble { background: color-mix(in srgb, var(--ok) 11%, var(--bg-elev)); }
.s-fehler .bubble { background: color-mix(in srgb, var(--bad) 10%, var(--bg-elev)); }
.s-wartet_freigabe .bubble { background: color-mix(in srgb, var(--warn) 11%, var(--bg-elev)); }
.typing { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.typing i { width: 4px; height: 4px; border-radius: 2px; background: var(--ok); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.desk .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-3); }
.st-label { font-size: 11px; font-weight: 600; }

/* ------------------------------------------------ Drawer / Modal */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 9, .28); z-index: 60; animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-elev); z-index: 61; box-shadow: -20px 0 60px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; animation: slide .28s cubic-bezier(.2, .8, .2, 1); }
.drawer header { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer .body { overflow-y: auto; padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 18px; }
.drawer .close { margin-left: auto; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
pre.mail { white-space: pre-wrap; font: 13px/1.6 var(--font); background: var(--bg-sunk); padding: 14px 16px; border-radius: 11px; margin: 0; max-height: 340px; overflow: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; background: var(--text); color: var(--bg-elev); padding: 10px 16px;
  border-radius: 12px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); animation: fade .2s; max-width: calc(100vw - 32px); }

/* ------------------------------------------------ Chat */
.fab { position: fixed; right: 26px; bottom: 26px; z-index: 50; width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg-elev); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .4); display: grid; place-items: center; transition: transform .2s; }
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab svg { width: 24px; height: 24px; }
.chatpanel { position: fixed; right: 26px; bottom: 94px; z-index: 55; width: min(420px, calc(100vw - 24px)); height: min(620px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden; animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--text); color: var(--bg-elev); border-bottom-right-radius: 5px; }
.msg.coo { align-self: flex-start; background: var(--bg-sunk); border-bottom-left-radius: 5px; }
.msg .src { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.msg .src svg { width: 11px; height: 11px; vertical-align: -1px; }
.msg .src a, .msg .src span { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--bg-elev); color: var(--text-2); text-decoration: none; }
.chat form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat form input { flex: 1; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.suggest button { border: 1px solid var(--line-strong); background: var(--bg-elev); border-radius: 20px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.suggest button:hover { color: var(--text); }

/* ------------------------------------------------ Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(380px, 100%); padding: 30px 28px; display: flex; flex-direction: column; gap: 14px; }
.login .brand { padding: 0; margin-bottom: 8px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.err.hint { color: var(--text-2); }

/* ------------------------------------------------ Mobil */
.tabbar { display: none; }
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0; z-index: 70; height: 100%; width: 100%; background: var(--bg); padding-top: max(18px, env(safe-area-inset-top)); }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  .content { padding: 18px 16px 130px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { padding: 11px 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
    backdrop-filter: blur(16px) saturate(1.5); border-top: 1px solid var(--line); padding: 6px 4px max(8px, env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--text-3); text-decoration: none;
    border: 0; background: transparent; padding: 4px 0; position: relative; cursor: pointer; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--text); }
  .tabbar .count { position: absolute; top: 0; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 8px; font-size: 9.5px; padding: 0 5px; }
  .fab { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  .chatpanel { right: 0; left: 0; bottom: 0; width: 100%; height: 88vh; border-radius: 18px 18px 0 0; }
  .topbar .switch-m { display: flex; flex: none; }
  .topbar select.switch-m { max-width: 46vw; text-overflow: ellipsis; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}
.switch-m { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ------------------------------------------------ Vorgänge */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.stepper li { display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; color: var(--text-3); min-width: 0; }
.stepper li i { height: 4px; border-radius: 2px; background: var(--bg-sunk); }
.stepper li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper li.done i { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.stepper li.now i { background: var(--accent); }
.stepper li.now span { color: var(--text); font-weight: 600; }
.case-meta { display: flex; gap: 28px; padding: 4px 20px 14px; flex-wrap: wrap; font-size: 13px; }
.case-meta .label { margin-bottom: 2px; }
.case-action { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 20px 12px; padding: 10px 12px; border-radius: 11px;
  background: color-mix(in srgb, var(--warn) 9%, var(--bg-elev)); font-size: 13px; }
.case-action svg { width: 15px; height: 15px; vertical-align: -3px; color: var(--warn); }
.case-action input { width: auto; padding: 5px 8px; }
.row.item .tick { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--bg-sunk);
  font-size: 12px; font-weight: 700; color: var(--text-2); }
.row.item.ok .tick { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.row.item .tick svg { width: 14px; height: 14px; }
.sm-select { width: auto; max-width: 220px; padding: 5px 8px; font-size: 12.5px; }
.case-review { margin: 4px 20px 0; padding: 10px 12px; border-radius: 11px; background: var(--bg-sunk); font-size: 13px; }
.case-review ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.case-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 20px 16px; flex-wrap: wrap; }
.folder { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); }
.folder:first-child { border-top: 0; }
.folder svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
@media (max-width: 900px) { .stepper { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 10px; } }
.btn.disabled { opacity: .45; pointer-events: none; }
svg.inline { width: 15px; height: 15px; vertical-align: -3px; color: var(--text-3); }

/* ------------------------------------------------ Zwei-Faktor-Anmeldung */
.steps { margin: 0 0 12px; padding-left: 18px; color: var(--text-2); display: grid; gap: 6px; }
.mfa-qr { display: grid; place-items: center; padding: 10px; background: #fff; border-radius: 12px; width: fit-content; margin: 0 auto; box-shadow: var(--shadow); }
.mfa-qr svg { display: block; width: 180px; height: 180px; }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; }
.row-form input { flex: 1 1 140px; min-width: 0; }
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.recovery code { padding: 7px 10px; background: var(--bg-sunk); border-radius: 8px; text-align: center; letter-spacing: .04em; user-select: all; }

/* ------------------------------------------------ Formulare & Bauleitung */
label.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.note { padding: 10px 14px; border-radius: 10px; background: var(--bg-sunk); font-size: 13px; }
.note.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.site-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.site-project { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; text-align: left; border: 1px solid transparent; cursor: pointer;
  font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.site-project[aria-pressed="true"] { border-color: var(--text); }
.site-project .tenant-dot { margin-top: 6px; }
.site-project .grow { display: grid; gap: 2px; min-width: 0; flex: 1; }
.site-project .s { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-badges { display: grid; justify-items: end; gap: 4px; flex: none; }
.site-report .notes { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg-sunk); }
.site-report .notes textarea { background: var(--bg-elev); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumbs a, .thumb-add { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg-sunk); display: block; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-add { display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer; color: var(--text-2); font-size: 12px; font-weight: 600;
  border: 1.5px dashed var(--line-strong, var(--line)); }
.thumb-add svg { width: 20px; height: 20px; }
.site-head { flex-wrap: wrap; }
.site-new { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.site-new input { width: auto; padding-top: 5px; padding-bottom: 5px; }
@media (max-width: 560px) { .site-new { margin-left: 0; width: 100%; } .site-new input { flex: 1; } }
.budgets input { width: 90px; padding: 4px 8px; text-align: right; }
.budgets td, .budgets th { padding-left: 0; }
/* Immobilien: Kopfzeilen mit mehreren Schaltflächen umbrechen statt überlaufen */
@media (max-width: 560px) { .card-head { flex-wrap: wrap; row-gap: 8px; } .card-head > div[style*="margin-left:auto"] { margin-left: 0 !important; flex-wrap: wrap; } }
