/* Praxis-Software: ruhiges Petrol für Kopf und Akzente, warme Koralle nur für "jetzt" und Hinweise.
   Systemschriften (keine externen Dienste, DSGVO). */
:root {
  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #eaf0f1;
  --text: #13252b;
  --muted: #5a6d73;
  --border: #d8e1e3;
  --border-strong: #b9c7ca;
  --brand: #0d3b44;
  --brand-ink: #ffffff;
  --accent: #0f7c7b;
  --accent-ink: #ffffff;
  --accent-soft: #dcefee;
  --hot: #e2603f;
  --ok: #1d7f4e;
  --ok-soft: #dcf1e5;
  --warn: #a2620a;
  --warn-soft: #fbedd6;
  --err: #c0392b;
  --err-soft: #fbe2df;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(13, 59, 68, .06), 0 4px 16px rgba(13, 59, 68, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1719; --surface: #142225; --surface-2: #1b2d31; --text: #e3eef0; --muted: #93a9ae;
    --border: #25393d; --border-strong: #35504f; --brand: #0a2a31; --accent: #3fb8b2; --accent-ink: #062022;
    --accent-soft: rgba(63, 184, 178, .15); --hot: #f08a6c; --ok: #6fd39d; --ok-soft: rgba(111, 211, 157, .14);
    --warn: #f0b85a; --warn-soft: rgba(240, 184, 90, .14); --err: #f2867b; --err-soft: rgba(242, 134, 123, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
.hidden, [hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.pre { white-space: pre-line; }

/* ---------- Kopf und Navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 0 20px; min-height: 58px; background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 0 14px; border: 0; background: none; cursor: pointer;
  color: rgba(255, 255, 255, .72); font: inherit; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--hot); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: rgba(255, 255, 255, .85); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; display: inline-block; }
.topbar .btn { border-color: rgba(255, 255, 255, .3); color: #fff; background: transparent; }
.topbar .btn:hover { background: rgba(255, 255, 255, .1); }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar h2 { margin-right: 6px; }
.toolbar .grow { flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Bausteine ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.grid-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; }
.section-title:first-child { margin-top: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.warns { margin: 4px 0 0; padding: 0; list-style: none; font-size: .82rem; }
.warns li { color: var(--warn); }
.warns li.err { color: var(--err); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.kpi .value { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; }

/* Fortschritt einer Verordnung: erschienen | geplant | frei */
.units { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.units-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; }
.units-bar .u { background: var(--accent); }
.units-bar .p { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.units-txt { font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field label, .label { font-size: .8rem; font-weight: 700; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 7px 10px; min-height: 38px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 64px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; margin: 4px 0 10px; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.actions .left { margin-right: auto; }
.hint { font-size: .8rem; color: var(--muted); margin: -6px 0 10px; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 2px; margin: 0 0 12px; }
legend { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 0 4px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.inactive td { opacity: .55; }
td.r, th.r { text-align: right; }

/* ---------- Dialog ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(8, 22, 26, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px 18px; overflow: auto; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--err); color: #fff; }

/* ---------- Anmeldung ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); }
.login-card .brand { color: var(--text); margin-bottom: 14px; }
.login-card h1 { margin-bottom: 4px; }
.login-card p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Kalender ---------- */
.cal-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 170px); }
.cal { --h: 64px; --head: 46px; display: grid; min-width: 760px; }
.cal-axis { position: sticky; left: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--border); }
.cal-axis-head { position: sticky; top: 0; z-index: 5; height: var(--head); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; right: 6px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-hours span:first-child { transform: translateY(2px); }
.cal-hours span:last-child { transform: translateY(-100%); }
.cal-col { border-left: 1px solid var(--border); min-width: 0; }
.cal-col:nth-child(2) { border-left: 0; }
.cal-head {
  position: sticky; top: 0; z-index: 3; height: var(--head); display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 0 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap; overflow: hidden;
}
.cal-head .sub { font-weight: 500; color: var(--muted); font-size: .8rem; }
.cal-col.today .cal-head { box-shadow: inset 0 3px 0 var(--hot); color: var(--hot); }
.cal-body {
  position: relative; cursor: cell;
  background: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--h)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--h) / 2), var(--surface-2) calc(var(--h) / 2) calc(var(--h) / 2 + 1px), transparent calc(var(--h) / 2 + 1px) var(--h));
}
.appt {
  --c: var(--accent); --t: var(--accent);
  position: absolute; margin-left: 1px; overflow: hidden; padding: 3px 6px; z-index: 1; text-align: left; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); border-left: 4px solid var(--c); border-radius: 7px;
  background: color-mix(in srgb, var(--t) 14%, var(--surface)); color: var(--text); font: inherit; display: flex; flex-direction: column; gap: 0;
}
.appt:hover { z-index: 2; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.appt .t { font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.appt .n { font-size: .84rem; font-weight: 650; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.appt .m { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.short { flex-direction: row; align-items: center; gap: 6px; padding: 0 6px; }
.appt.short .t { flex: none; }
.appt.short .n { white-space: nowrap; font-size: .8rem; }
.appt.short .m { display: none; }
.appt.group .n::after { content: attr(data-count); margin-left: 4px; font-size: .72rem; font-weight: 700; color: var(--muted); }
.appt.full { border-style: solid; }
.appt.done { opacity: .78; }
.appt.cancelled { opacity: .5; text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--hot); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--hot); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Dienstplan (Physio / Sportstudio) ---------- */
.dp-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: start; }
.dp-layout.readonly { grid-template-columns: minmax(0, 1fr); }
.dp-main { min-width: 0; }
.dp-wrap { max-height: calc(100vh - 200px); }
.dp-cal { --h: 44px; min-width: 820px; }
.dp-palette { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 100px); overflow: auto; }
.dp-pal-sec h3 { display: flex; align-items: center; justify-content: space-between; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.dp-pal-sec h3 .btn { text-transform: none; letter-spacing: 0; }
.dp-pal-row { display: flex; gap: 4px; align-items: stretch; }
.dp-pal-row .dp-pal-item { flex: 1; min-width: 0; }
.dp-pal-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; margin-bottom: 6px; padding: 7px 10px; text-align: left;
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; cursor: grab;
}
.dp-pal-row .dp-pal-item { flex-direction: row; align-items: center; justify-content: space-between; }
.dp-pal-item:hover { border-color: var(--accent); }
.dp-pal-item.picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.dp-pal-name { display: flex; align-items: center; gap: 6px; font-weight: 650; }
.dp-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 6px 6px 6px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.gpill { display: inline-block; max-width: 100%; padding: 0 8px; border-radius: 99px; font-size: .72rem; font-weight: 700; line-height: 1.6; color: #fff; background: var(--c, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-body.drop-on { background-color: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.dp-shift {
  --gc: var(--accent);
  position: absolute; margin-left: 1px; overflow: hidden; z-index: 1; padding: 3px 6px; cursor: grab; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font: inherit; color: var(--text);
  border: 1px solid var(--border-strong); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--surface);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.dp-shift.has-group { border: 2px solid var(--gc); border-left-width: 5px; background: color-mix(in srgb, var(--gc) 12%, var(--surface)); }
.dp-shift.open { border-style: dashed; border-left-style: solid; background: var(--surface); }
.dp-shift.error { background: var(--err-soft); }
.dp-shift.mine { box-shadow: inset 0 0 0 2px var(--hot); }
.dp-shift:hover { z-index: 2; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.dp-shift > * { max-width: 100%; position: relative; z-index: 1; }
.dp-shift .t { font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-shift .n { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-shift .n em { color: var(--muted); }
.dp-shift .l { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-shift .flag { position: absolute; top: 3px; right: 5px; font-size: .75rem; }
.dp-shift.cont { border-top-style: dashed; opacity: .85; }
.dp-shift.narrow { padding: 3px 4px; }
.dp-shift.narrow .t { font-size: .7rem; }
.dp-shift.narrow .n { font-size: .74rem; }
.dp-shift.narrow .gpill { font-size: .62rem; padding: 0 5px; }
.dp-shift.dragging { opacity: .4; cursor: grabbing; }
.dp-shift.resizing { z-index: 4; box-shadow: 0 0 0 2px var(--accent); }
.readonly .dp-shift { cursor: default; }
.dp-rs { position: absolute !important; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 3 !important; }
.dp-rs.top { top: 0; }
.dp-rs.bot { bottom: 0; }
.dp-rs::after { content: ""; position: absolute; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--accent); opacity: 0; }
.dp-rs.top::after { top: 2px; }
.dp-rs.bot::after { bottom: 2px; }
.dp-shift:hover .dp-rs::after { opacity: .9; }
.dp-brk {
  position: absolute !important; left: 0; right: 0; z-index: 0 !important; pointer-events: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px);
  border-top: 1px dashed var(--border-strong); border-bottom: 1px dashed var(--border-strong);
}
.dp-brk span { font-size: .66rem; font-weight: 650; color: var(--muted); background: var(--surface); padding: 0 6px; border-radius: 99px; white-space: nowrap; }
.dp-sel {
  position: absolute; left: 2px; right: 2px; z-index: 5; pointer-events: none; padding: 2px 6px; font-size: .8rem; font-weight: 700;
  background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 8px; color: var(--accent); font-variant-numeric: tabular-nums;
}
.dp-sel.moving { box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
@media (max-width: 860px) {
  .dp-layout { grid-template-columns: 1fr; }
  .dp-palette { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .dp-pal-sec { flex: 1 1 240px; }
  .dp-rs { height: 14px; }
}

/* Termin-Details: Teilnehmer */
.parts { display: flex; flex-direction: column; gap: 8px; }
.part { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.part-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.part-top .name { font-weight: 700; margin-right: auto; }
.status-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.status-seg button { border: 0; background: var(--surface); padding: 4px 9px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.status-seg button + button { border-left: 1px solid var(--border); }
.status-seg button[aria-pressed="true"].s-erschienen { background: var(--ok); color: #fff; }
.status-seg button[aria-pressed="true"].s-geplant { background: var(--accent-soft); color: var(--accent); }
.status-seg button[aria-pressed="true"].s-abgesagt { background: var(--warn-soft); color: var(--warn); }
.status-seg button[aria-pressed="true"].s-nicht_erschienen { background: var(--err-soft); color: var(--err); }
.part-more { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.part textarea { min-height: 44px; margin-top: 8px; }
.add-part { display: grid; grid-template-columns: 2fr 2fr auto; gap: 8px; align-items: end; margin-top: 12px; }
.appt-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }

/* Patient: Kopf */
.pat-head { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .9rem; margin: -4px 0 14px; }
.visits td { font-size: .88rem; }

/* Abrechnung */
.bill-group { margin-bottom: 14px; }
.bill-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.bill-head .grow { flex: 1; min-width: 200px; }
.bill-sum { text-align: right; font-variant-numeric: tabular-nums; }
.bill-sum strong { font-size: 1.15rem; }
details.bill-items summary { cursor: pointer; color: var(--accent); font-size: .88rem; margin-top: 8px; }
details.bill-items table { margin-top: 8px; font-size: .86rem; }

/* Rechnung (Druck) */
.invoice { background: #fff; color: #111; padding: 28px 32px; border-radius: 8px; font-size: 13px; line-height: 1.45; }
.invoice .inv-top { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.invoice .inv-from { font-size: 11px; color: #555; text-align: right; white-space: pre-line; }
.invoice .inv-to { white-space: pre-line; margin-bottom: 22px; min-height: 80px; }
.invoice h2 { font-size: 18px; margin-bottom: 6px; }
.invoice table { font-size: 12px; margin: 14px 0; }
.invoice th { background: #f0f0f0; color: #333; }
.invoice td, .invoice th { border-bottom: 1px solid #ddd; padding: 5px 7px; }
.invoice .totals { margin-left: auto; width: 300px; }
.invoice .totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.invoice .totals .sum { border-top: 2px solid #111; font-weight: 700; font-size: 14px; margin-top: 4px; padding-top: 6px; }
.invoice .foot { margin-top: 28px; font-size: 11px; color: #555; white-space: pre-line; }

@media print {
  body > *:not(.print-me) { display: none !important; }
  .modal-backdrop.print-me { position: static; background: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-height: none; width: 100% !important; border-radius: 0; }
  .modal-head, .no-print { display: none !important; }
  .modal-body { padding: 0; overflow: visible; }
  .invoice { padding: 0; }
}

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 8px 14px 0; gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .tab { padding: 10px 10px; }
  .user-chip span.name { display: none; }
  main { padding: 14px; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .add-part { grid-template-columns: 1fr; }
  .cal-wrap { max-height: calc(100vh - 230px); }
}
@media (max-width: 520px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  input, select, textarea { font-size: 16px; }
}
