*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #4a6d8c;
  --accent-dark:  #375270;
  --accent-light: #e8eef4;
  --sidebar-w:    300px;
  --header-h:     56px;
  --gray-50:      #faf7f2;
  --gray-100:     #f3f1ea;
  --gray-200:     #ddd5c7;
  --gray-400:     #9a9284;
  --gray-600:     #66605a;
  --gray-800:     #2b2622;
  --white:        #ffffff;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --error:        #b3261e;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  margin: 0;
}

a { color: var(--accent-dark); }

h1 { font-size: 1.3rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.6rem; }

.error { color: var(--error); font-weight: 600; margin-bottom: 1rem; }
.success { color: #15803d; font-weight: 600; margin-bottom: 1rem; }

/* ── App shell (sidebar + main) ── */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh; /* echte sichtbare Höhe auf iPad/Safari (100vh zählt die von der
                     Adressleiste verdeckte Fläche mit, dadurch wirkte die Seite
                     dort zu hoch / erzwang unerwünschtes Scrollen) */
  overflow: hidden;
}

aside.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  border-bottom: 1px solid var(--gray-200);
}

.brand-logo {
  max-width: 100%;
  max-height: 128px;
  height: auto;
  width: auto;
  display: block;
}

nav.sidebar-nav { padding: 12px 10px; flex: 1; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--gray-100); color: var(--gray-800); }
.nav-item.active { background: var(--accent-light); color: var(--accent-dark); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item.disabled {
  color: var(--gray-400);
  cursor: default;
}
.nav-item.disabled:hover { background: none; color: var(--gray-400); }

.nav-divider { height: 1px; background: var(--gray-200); margin: 8px 8px; }

.soon-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--gray-100);
  color: var(--gray-400);
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--gray-400); }

.logout-form { margin-top: 8px; }
.inline-form { display: inline; }
.logout-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.logout-btn:hover { color: var(--accent-dark); }

main.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

header.app-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 12px;
}

.page-title { font-size: 18px; font-weight: 600; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.breadcrumb a { color: var(--accent-dark); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--gray-400); }
.breadcrumb-current { color: var(--gray-600); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s;
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-outline {
  background: var(--white);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-outline:hover { background: var(--gray-100); }

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row label { flex: 1 1 200px; }

/* ── Login card (no sidebar) ── */
.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
}

.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2rem;
  width: min(90vw, 360px);
}

.card h1 { text-align: center; margin-bottom: 1.5rem; }

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-600);
}

input, select, button { font-size: 1rem; font-family: inherit; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  margin-top: 0.3rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-800);
}

.card button[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
}
.card button[type="submit"]:hover { background: var(--accent-dark); }

/* ── Toolbar / filters ── */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
}

.toolbar-period-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.toolbar-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
  flex: 1 1 160px;
}

.toolbar input, .toolbar select {
  margin-top: 0;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  box-sizing: border-box;
}

.toolbar input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
  min-height: 34px;
}

.toolbar label:has(input[type="date"]) {
  flex: 0 0 150px;
}

.toolbar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.toolbar-actions-spacer {
  font-size: 11px;
  line-height: 1;
  visibility: hidden;
}

.toolbar-actions-row {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 10px;
}

.toolbar-actions a { font-size: 13px; color: var(--gray-600); }

/* ── Table card ── */
.table-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

table { width: 100%; border-collapse: collapse; }

thead { background: var(--gray-50); }

th {
  padding: 11px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.th-sort {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.th-sort:hover { color: var(--accent-dark); }

td {
  padding: 7px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  vertical-align: middle;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--gray-50); }
tbody tr:hover td { background: var(--accent-light); }
tbody tr.row-link { cursor: pointer; }
tbody tr.row-highlighted td { background: var(--accent-light); }
tbody tr.row-highlighted td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
th.amount { text-align: right; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

.action-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 8px;
  margin: 0 2px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  line-height: 0;
  text-decoration: none;
  display: inline-flex;
}
.action-btn:hover { color: var(--accent-dark); background: var(--accent-light); }
.action-btn svg { width: 19px; height: 19px; }

.table-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 12px;
  color: var(--gray-400);
}

.table-footer .amount {
  font-weight: 600;
  color: var(--gray-600);
}

.empty-state {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--gray-600);
}

/* ── Detail card (treatment form) ── */
.detail-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 720px;
  overflow: hidden;
}

/* Zwei Karten nebeneinander (z.B. Benutzer bearbeiten + 2FA) statt
   untereinander — reduziert die Gesamthöhe der Seite. flex-wrap sorgt
   dafür, dass auf schmalen Bildschirmen (iPad Hochformat, Handy) automatisch
   wieder untereinander gestapelt wird, sobald beide Karten nicht mehr
   nebeneinander passen. */
.form-cards-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
}
/* Formular braucht mehr Breite als die schmalere Zweitkarte, sonst brechen
   die zweispaltigen .form-row-Zeilen im Formular unnötig früh um
   (.form-row-Labels brauchen min. 200px + Gap, siehe dort). */
.form-cards-row form { flex: 1 1 440px; }
.form-cards-row > .detail-card { flex: 1 1 280px; }

/* Grösseres Layout speziell für die Behandlungserfassung — overflow:visible,
   damit Autocomplete-Dropdowns über den Kartenrand hinausragen dürfen. */
.detail-card.detail-card-wide {
  max-width: 1040px;
  overflow: visible;
}

.detail-card-header {
  background: var(--accent);
  color: #fff;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius) var(--radius) 0 0;
}

.detail-card-wide .detail-card-header {
  padding: 20px 28px;
  font-size: 19px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 0.7fr 2.35fr 0.55fr 0.6fr;
  border-bottom: 1px solid var(--gray-200);
}

.meta-cell {
  padding: 12px 18px;
  border-right: 1px solid var(--gray-200);
}
.meta-cell:last-child { border-right: none; }

.detail-card-wide .meta-cell { padding: 18px 24px; }

.meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.detail-card-wide .meta-label { font-size: 13px; margin-bottom: 6px; }

.meta-cell input,
.meta-cell select {
  border: none;
  padding: 2px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  width: 100%;
  background: transparent;
}
.meta-cell input:focus,
.meta-cell select:focus {
  outline: none;
  border-bottom: 1px solid var(--accent);
}

.detail-card-wide .meta-cell input,
.detail-card-wide .meta-cell select { font-size: 18px; padding: 4px 0; }

.meta-inline-group { display: flex; align-items: baseline; gap: 8px; }
.meta-inline-group select { flex: 0 0 auto; width: auto; min-width: 60px; }
.meta-inline-group input,
.meta-inline-group .autocomplete-wrap { flex: 1; min-width: 0; }
.meta-inline-group input.meta-firstname-input { flex: 0 0 140px; }

.items-table { width: 100%; border-collapse: collapse; }

.detail-card-wide .items-table { table-layout: fixed; }
.detail-card-wide .items-table col.col-type { width: 195px; }
.detail-card-wide .items-table col.col-quantity { width: 90px; }
.detail-card-wide .items-table col.col-amount { width: 160px; }
.detail-card-wide .items-table col.col-action { width: 52px; }

.items-table th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.detail-card-wide .items-table th { padding: 14px 20px; font-size: 13px; }

.items-table td {
  padding: 8px 20px;
  border-bottom: 1px solid var(--gray-100);
  white-space: normal;
}

.detail-card-wide .items-table td { padding: 14px 20px; }

.items-table tbody tr:last-child td { border-bottom: none; }

.items-table select,
.items-table input {
  border: 1px solid transparent;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 13px;
  width: 100%;
  background: transparent;
}
.items-table select:hover, .items-table input:hover { border-color: var(--gray-200); }
.items-table select:focus, .items-table input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
}
.items-table input[name="item_amount"],
.items-table .item-unit-price,
.items-table .item-quantity { text-align: right; }
.items-table .item-amount[readonly] {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
}
.items-table .item-amount[readonly]:hover,
.items-table .item-amount[readonly]:focus {
  border-color: transparent;
  background: var(--gray-50);
}

.detail-card-wide .items-table select,
.detail-card-wide .items-table input { font-size: 17px; padding: 9px 10px; }

/* Autocomplete-Dropdown (Kunde, Ware-Beschreibung) — echtes Textfeld bleibt,
   Vorschläge kommen aus einer eigenen JS-Liste statt <datalist> (auf iPad/Safari
   unzuverlässig, siehe Projekt-Memory zu Safari-Rendering-Eigenheiten). */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 80;
  margin-top: 4px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  text-align: left;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 400;
  color: var(--gray-800);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--accent-light);
}

.add-row-btn {
  margin: 10px 20px 16px;
  background: none;
  border: 1px dashed var(--gray-200);
  color: var(--gray-600);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: calc(100% - 40px);
}
.add-row-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  border-top: 2px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 15px;
  font-weight: 700;
}

.total-label { color: var(--gray-600); }
.total-amount { font-variant-numeric: tabular-nums; color: var(--gray-800); }

/* Tip section */
.tip-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  flex-wrap: wrap;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-right: 4px;
  flex: 0 0 auto;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  background: var(--white);
  transition: all .15s;
  font-family: inherit;
}

.pill-btn svg,
.pill-btn img { flex: none; }

.pill-btn.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.tip-custom {
  display: flex; align-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  overflow: hidden;
  background: var(--white);
}
.tip-custom span { padding: 5px 4px 5px 12px; font-size: 12px; font-weight: 600; color: var(--gray-400); }
.tip-custom input {
  border: none; outline: none;
  font-size: 12px; font-weight: 600;
  width: 64px;
  padding: 5px 12px 5px 0;
  background: transparent;
  color: var(--gray-800);
}

/* Payment section (pills, radio-driven) */
.payment-section {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-option {
  position: relative;
}
.payment-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.payment-option label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
  margin: 0;
}
.payment-option input[type="radio"]:checked + label {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.payment-option svg { width: 14px; height: 14px; flex-shrink: 0; }

.card-options {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 14px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--gray-200);
  background: var(--gray-50);
}
.card-options.visible { display: flex; }

.form-actions { padding: 18px 20px; display: flex; gap: 10px; }
.form-actions .btn-primary { flex: 1; width: 100%; justify-content: center; padding: 10px 14px; font-size: 14px; }
.form-actions .btn-outline { flex: 0 0 auto; justify-content: center; padding: 10px 14px; font-size: 14px; }

/* Grössere Bedienelemente in der Behandlungserfassung (Trinkgeld/Zahlungsart-
   Pills, Total, Speichern-Button) — Klassen wie .pill-btn/.section-label werden
   auch anderswo (Reports) verwendet, daher hier auf #treatment-form beschränkt. */
.detail-card-wide .add-row-btn { font-size: 14px; padding: 9px 16px; }
.detail-card-wide .total-row { font-size: 18px; padding: 16px 24px; }
.detail-card-wide .tip-section,
.detail-card-wide .payment-section { padding: 16px 24px; gap: 12px; }
.detail-card-wide .card-options { padding: 12px 24px 16px; }
#treatment-form .tip-section .section-label,
#treatment-form .payment-section .section-label,
#treatment-form .card-options .section-label { font-size: 13px; }
#treatment-form .tip-section .pill-btn,
#treatment-form .card-options .pill-btn { font-size: 14px; padding: 7px 16px; }
.detail-card-wide .tip-custom span,
.detail-card-wide .tip-custom input { font-size: 14px; }
.detail-card-wide .tip-custom input { width: 76px; }
.detail-card-wide .payment-option label { font-size: 15px; padding: 8px 16px; }
.detail-card-wide .payment-option svg { width: 16px; height: 16px; }
.detail-card-wide .form-actions .btn-primary,
.detail-card-wide .form-actions .btn-outline { font-size: 16px; padding: 13px 16px; }

/* Noch etwas grösser — nur auf breiten Desktop-Bildschirmen (min-width 1400px,
   sicher oberhalb jeder iPad-Breite inkl. 12.9" Querformat/1366px), damit die
   Grösse auf dem iPad (dort laut Nutzer "genau richtig") unverändert bleibt. */
@media (min-width: 1400px) {
  .detail-card.detail-card-wide { max-width: 1220px; }
  .detail-card-wide .detail-card-header { padding: 22px 30px; font-size: 20px; }
  .detail-card-wide .meta-cell { padding: 22px 28px; }
  .detail-card-wide .meta-label { font-size: 14px; }
  .detail-card-wide .meta-cell input,
  .detail-card-wide .meta-cell select { font-size: 19px; }
  .detail-card-wide .items-table col.col-type { width: 215px; }
  .detail-card-wide .items-table col.col-quantity { width: 100px; }
  .detail-card-wide .items-table col.col-amount { width: 175px; }
  .detail-card-wide .items-table col.col-action { width: 56px; }
  .detail-card-wide .items-table th { padding: 16px 22px; font-size: 14px; }
  .detail-card-wide .items-table td { padding: 16px 22px; }
  .detail-card-wide .items-table select,
  .detail-card-wide .items-table input { font-size: 18px; padding: 10px 12px; }
  .detail-card-wide .total-row { font-size: 19px; padding: 18px 26px; }
  .detail-card-wide .tip-section,
  .detail-card-wide .payment-section { padding: 18px 26px; }
  .detail-card-wide .payment-option label { font-size: 16px; padding: 9px 18px; }
  .detail-card-wide .form-actions .btn-primary,
  .detail-card-wide .form-actions .btn-outline { font-size: 17px; padding: 14px 18px; }
}

/* ── Receipt (print target, no sidebar) ── */
.receipt-page { min-height: 100vh; background: var(--gray-50); }
.receipt-page .app-content { max-width: 560px; margin: 0 auto; padding-top: 32px; }

.receipt-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.receipt-print-form { display: inline-flex; }
.btn-large { padding: 14px 28px; font-size: 17px; font-weight: 600; }

/* Bewusst schmal gehalten (~80mm-Bon-Optik), auch auf dem Bildschirm —
   das ist Teil des "repräsentativen" Looks, nicht nur Print-Vorbereitung. */
.receipt-paper {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 10px 28px rgba(0,0,0,.08);
  padding: 1.6rem 1.3rem;
  max-width: 320px;
  margin: 0 auto;
  font-family: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
  color: var(--gray-800);
}

.receipt-header { text-align: center; margin-bottom: 0; }
.receipt-logo { display: block; width: 130px; height: auto; margin: 0 auto 0.6rem; }
.receipt-header p { margin: 0.1rem 0; color: var(--gray-600); font-size: 0.75rem; }

.receipt-divider {
  border-top: 1px dashed var(--gray-300);
  margin: 0.9rem 0;
}

.receipt-meta p {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.3rem 0;
  font-size: 0.8rem;
}
.receipt-meta p span:first-child { color: var(--gray-500); }
.receipt-meta p span:last-child { text-align: right; font-weight: 600; }

.receipt-items { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.receipt-items th {
  padding: 0 0 0.4rem;
  background: none;
  border-bottom: none;
  position: static;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
}
.receipt-items td {
  padding: 0.45rem 0;
  vertical-align: top;
  border-bottom: none;
}
.receipt-items th:first-child,
.receipt-items td:first-child { text-align: left; }
.receipt-items td:first-child { white-space: normal; }
.receipt-items tbody tr td { background: none; }
.receipt-item-tag {
  font-size: 0.68rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-top: 1px;
}
.receipt-items tfoot td {
  font-weight: 700;
  font-size: 0.95rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--gray-300);
}

.receipt-footer { text-align: center; margin-top: 0; color: var(--gray-600); font-size: 0.78rem; }

/* ── Reports overview ── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  color: inherit;
}

.report-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(74,109,140,.15);
  transform: translateY(-1px);
}

.report-card.disabled {
  cursor: default;
}
.report-card.disabled:hover {
  border-color: var(--gray-200);
  box-shadow: var(--shadow);
  transform: none;
}

.report-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.report-icon svg { width: 22px; height: 22px; }

.icon-blue   { background: #dbeafe; color: #1d4ed8; }
.icon-green  { background: #dcfce7; color: #15803d; }
.icon-purple { background: #ede9fe; color: #7c3aed; }
.icon-orange { background: #ffedd5; color: #c2410c; }
.icon-teal   { background: #ccfbf1; color: #0d9488; }
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-pink   { background: #fce7f3; color: #be185d; }

.report-info { flex: 1; }

.report-title {
  font-size: 14px; font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}

.report-desc {
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.5;
}

.report-arrow {
  color: var(--gray-200);
  align-self: center;
  transition: color .15s, transform .15s;
}

.report-card:hover .report-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Report detail pages (period bar, KPIs, bar chart) ──
   Compact by design: these pages should fit one screen without scrolling,
   same principle as the treatments list (fixed chrome, minimal scrolling). */
.report-page .app-content { padding: 16px 24px; }

.report-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 18px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* Nur dieser Bereich scrollt (Chart + Detailtabelle) — Zeitraum-Filter und
   Kennzahlen bleiben immer sichtbar, gleiches Prinzip wie bei der Behandlungsliste. */
.report-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.report-scroll-area .report-panel:last-child { margin-bottom: 0; }

.period-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.period-bar .pill-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 26px;
  line-height: normal;
}

.period-bar form.period-inline-form,
.period-bar form.period-custom-form {
  align-self: center;
}

.period-custom-form, .period-inline-form { display: flex; align-items: center; gap: 8px; }
.period-custom-form { margin-left: auto; }

.period-custom-form span { color: var(--gray-400); font-size: 12px; }

.period-custom-form input[type="date"],
.period-inline-form select {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  min-height: 26px;
  width: auto;
  padding: 0 10px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 12px;
  background: var(--white);
  color: var(--gray-800);
  cursor: pointer;
}

.period-inline-form select.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.period-custom-form button.pill-btn,
.banana-month-form button.pill-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.period-custom-form button.pill-btn:hover,
.banana-month-form button.pill-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.banana-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.banana-month-form { display: flex; align-items: center; gap: 8px; }
.banana-month-form select {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  min-height: 26px;
  width: auto;
  padding: 0 10px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 12px;
  background: var(--white);
  color: var(--gray-800);
  cursor: pointer;
}
.banana-export-btn { margin-left: auto; }
.banana-reclass-row td { background: var(--gray-50); color: var(--gray-400); font-style: italic; }
.banana-footnote { font-size: 12px; color: var(--gray-400); padding: 10px 4px 0; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 18px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: 3px;
}

.kpi-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
}

.report-panel .section-label { margin-bottom: 8px !important; }

.bar-chart { display: flex; flex-direction: column; gap: 7px; }

.bar-row { display: flex; align-items: center; gap: 10px; }

.bar-name {
  flex: 0 0 120px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  background: var(--gray-100);
  border-radius: 5px;
  height: 16px;
  overflow: hidden;
}

.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar-fill.payment-fill-green  { background: #15803d; }
.bar-fill.payment-fill-blue   { background: #1d4ed8; }
.bar-fill.payment-fill-yellow { background: #a16207; }

.bar-value {
  flex: 0 0 100px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-panel table { width: 100%; }
.report-panel th { padding: 6px 12px; font-size: 11px; }
.report-panel td { padding: 4px 12px; font-size: 13px; }
.report-panel tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--gray-200);
  background: var(--gray-50);
}

/* ── Zahlungsart-Icons ── */
.bar-name-icon { display: inline-flex; align-items: center; gap: 8px; }
.bar-name-icon svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--gray-400); }

.brand-logo-img {
  height: 20px;
  width: auto;
  max-width: 44px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: #fff;
}
.brand-logo-img.brand-logo-crop-top {
  width: 20px;
  height: 20px;
  object-fit: cover;
  object-position: top;
}

/* ── Responsive ──
   Tablets (iPad portrait is typically 768–834px) keep the same vertical
   sidebar as desktop — it has plenty of room. Only real phone-width screens
   get a different layout, and even there the sidebar stays a normal
   top-to-bottom stack (just full-width, scrollable) instead of being
   squeezed into a single horizontal row — with 5 nav items + logo + avatar,
   a horizontal row has no room and items overlap/disappear. */
@media (max-width: 860px) {
  .meta-grid { grid-template-columns: 1fr; }
  .meta-cell { border-right: none; border-bottom: 1px solid var(--gray-200); }
  .meta-cell:last-child { border-bottom: none; }
}

@media (max-width: 600px) {
  .app-shell { flex-direction: column; }
  aside.sidebar {
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  .app-content { padding: 14px; }
  .receipt-paper { padding: 1.2rem; }
  th, td { padding: 8px 10px; }
}

@media print {
  @page { size: 80mm 200mm; margin: 4mm 3mm; }
  .no-print { display: none !important; }
  body { background: #fff; }
  .receipt-page { min-height: 0; background: #fff; }
  .receipt-page .app-content { max-width: 100%; margin: 0; padding: 0; }
  .receipt-paper {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    font-size: 12px;
  }
}
