/* Change the variables and the logo to rebrand. */
:root {
  --accent: #f7931a;
  --accent-dark: #b86600;
  --bg: #f6f6f6;
  --surface: #fff;
  --text: #222;
  --muted: #5f5f5f;
  --line: #e2e2e2;
  --error: #b3261e;
  --success: #1b7f4b;
  --radius: 12px;
}

@font-face { font-family: Montserrat; font-weight: 400; font-display: swap; src: url('/fonts/Montserrat-Regular.ttf') format('truetype'); }
@font-face { font-family: Montserrat; font-weight: 600; font-display: swap; src: url('/fonts/Montserrat-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-display: swap; src: url('/fonts/PlayfairDisplay-Bold.woff2') format('woff2'); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 Montserrat, system-ui, sans-serif;
}

h1, h2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; line-height: 1.2; margin: 0 0 8px; outline: none; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 12px; }
a { color: var(--accent-dark); }

.brand { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 440px; margin: 8px 0 20px; }
.brand a { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 50%; }

.card { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: 0 2px 12px rgb(0 0 0 / 7%); }

.legal { display: flex; gap: 16px; margin-top: auto; padding-top: 24px; font-size: .85rem; }
.legal a { color: var(--muted); }

label { display: block; margin: 16px 0 4px; font-weight: 600; font-size: .9rem; }
input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #b5b5b5;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
}
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #b5b5b5;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #b5b5b5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: 600 1rem/1.2 Montserrat, system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--text); }
button:disabled { opacity: .6; cursor: progress; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #1f1300; }
button.primary:hover, .button.primary:hover { background: #e8850f; border-color: #e8850f; }
button.link { min-height: 32px; padding: 4px 0; border: 0; background: none; color: var(--accent-dark); font-weight: 600; font-size: .9rem; text-decoration: underline; }
.card > form > .primary, .card > .primary, .card > .button { width: 100%; margin-top: 20px; }
.card > .primary + .button { margin-top: 10px; }
section > .link { display: block; margin: 16px auto 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { margin: 12px 0 0; color: var(--error); font-weight: 600; font-size: .92rem; }
.eyebrow { margin: 0; color: var(--muted); font-size: .85rem; font-weight: 600; word-break: break-word; }
.amount { margin: 2px 0 16px; font: 700 2rem/1.2 'Playfair Display', Georgia, serif; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.method-list { display: grid; gap: 10px; margin: 12px 0 16px; }
.method { display: grid; justify-content: stretch; justify-items: start; gap: 2px; width: 100%; padding: 12px 16px; text-align: left; }
.method:hover { border-color: var(--accent); background: #fff8ef; }
.method span { color: var(--muted); font-weight: 400; font-size: .85rem; }

.sats { margin: -12px 0 12px; color: var(--muted); font-weight: 600; }
.qr { display: block; width: min(100%, 280px); margin: 0 auto 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr img { display: block; width: 100%; height: auto; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .button { padding: 10px 6px; font-size: .95rem; }
.copy-text { margin: 12px 0; padding: 8px 10px; border-radius: 6px; background: #f1f1f1; color: var(--muted); font: .75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 4.4em; overflow: auto; overflow-wrap: anywhere; }
.status { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: #fff4e5; font-weight: 600; font-size: .92rem; }
.status[data-kind='pending'] { background: #e8f4ec; color: var(--success); }
.status[data-kind='warning'] { background: #fdecea; color: var(--error); }

.done-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 16px; border-radius: 50%; background: var(--success); color: #fff; font-size: 2rem; }

/* Admin: ruhige Flächen, Reiter statt Endlosseite, Tabellen werden am Handy zu Karten. */
body.admin { padding-top: 8px; }
body.admin .brand { max-width: 1040px; margin-bottom: 12px; }
#app-view { width: 100%; max-width: 1040px; }
#paydesk-view, #masterbach-view { width: 100%; }
body.admin h1 { font-size: 1.6rem; margin: 0; }
body.admin h2 { font-size: 1.2rem; margin: 0 0 12px; }
.zwischentitel { margin: 20px 0 8px; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.panel > .zwischentitel:first-child, .kasten > .zwischentitel:first-child { margin-top: 0; }

/* Hauptbereiche als Umschalter */
.admin-bereiche { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 0 20px; padding: 4px; border-radius: 12px; background: #e9e9e9; }
.admin-bereiche a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 9px; color: var(--text); font-weight: 600; text-decoration: none; }
.admin-bereiche a:hover { background: rgb(255 255 255 / 60%); }
.admin-bereiche a[aria-current='page'] { background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }

.bereich-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; }
.modus { margin: 0; padding: 4px 12px; border-radius: 99px; background: #eee; font-size: .8rem; font-weight: 600; }
.modus[data-modus='test'] { background: #fdecea; color: var(--error); }
.modus[data-modus='live'] { background: #e8f4ec; color: var(--success); }

/* Reiter: ein Wechsel beginnt oben auf der Seite (siehe admin-masterbach.js). */
.reiter { display: flex; gap: 2px; margin: 0 0 16px; padding-top: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--bg); scrollbar-width: none; }
.reiter a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.reiter a:hover { color: var(--text); }
.reiter a[aria-current='page'] { border-bottom-color: var(--accent); color: var(--text); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
details.panel > summary, .einstellungen details > summary, details.mehr > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 8px; }
details.panel[open] > summary { margin-bottom: 12px; }
details.mehr { margin-top: 12px; }
details.mehr > summary { color: var(--accent-dark); font-size: .9rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.panel-head h2, .panel-head p { margin: 0; }
.banner { padding: 12px 16px; margin-bottom: 16px; border-radius: 8px; background: #fff4e5; font-weight: 600; }
.panel .banner { margin: 12px 0; }
.leer { margin: 16px 0 4px; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }

/* Kennzahlen */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 8px; }
.kennzahlen { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfc; }
.tile dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
.tile dd { margin: 0; }
.tile-value { margin: 2px 0 !important; font-size: 1.5rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tile-warn { border-color: #f3b8b3; background: #fdf3f2; }
.tile-warn .tile-value { color: var(--error); }

/* Tabellen */
.table-wrap { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-size: .78rem; font-weight: 600; white-space: nowrap; }
th, td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fafafa; }
.umsatz-tabelle tbody th { color: var(--text); font-size: .9rem; }
.umsatz-tabelle td.aufteilung { color: var(--muted); font-size: .85rem; }
.umsatz-tabelle th:nth-child(n+4), .umsatz-tabelle td:nth-child(n+4) { text-align: right; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button { margin-left: 8px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; background: #eee; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-open { background: #fff4e5; color: #8a4b00; }
.badge-pending { background: #e7f0fb; color: #1a5296; }
.badge-paid { background: #e8f4ec; color: var(--success); }
.badge-review { background: #fdecea; color: var(--error); }

/* Formulare */
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row .field { flex: 1 1 180px; }
.row .field-breit { flex: 2 1 260px; }
.row label { margin-top: 0; }
.filter { margin-bottom: 8px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-weight: 400; }
label.check input { width: auto; min-height: 0; margin: 0; }
button.small, .button.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.result { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin: 16px 0; padding: 16px; border: 1px solid var(--accent); border-radius: 10px; background: #fffaf3; }
.result > div { flex: 1 1 240px; min-width: 0; }
.result p { margin-bottom: 4px; }
.code-gross { display: inline-block; margin: 6px 0 10px; font-size: 1.05rem; font-weight: 600; letter-spacing: .02em; overflow-wrap: anywhere; }
.neue-rechnung { margin-bottom: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#mb-export .button { margin-top: 4px; }

/* Listen, Details, System */
.plain-list { list-style: none; margin: 8px 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.plain-list li:last-child { border-bottom: 0; }
.detail-liste { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; overflow-wrap: anywhere; font-size: .92rem; }
.detail-liste dt { color: var(--muted); font-weight: 600; }
.detail-liste dd { margin: 0; }
.detail-liste.kompakt { grid-template-columns: max-content minmax(0, 1fr); font-size: .88rem; }
#mb-links { margin: 14px 0 0; text-align: left; }
#mb-links .button { margin: 0 8px 8px 0; }
.zeitstrahl { margin: 8px 0; padding-left: 22px; }
.zeitstrahl li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.system-raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kasten { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.kasten p { margin: 0; }

/* Support-Fälle */
.faelle { display: grid; gap: 10px; margin: 14px 0 4px; }
.fall { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; }
.fall > div:first-child { flex: 1 1 280px; min-width: 0; }
.fall p { margin: 0 0 4px; }
.fall-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fall-grund { color: var(--error); font-size: .88rem; font-weight: 600; }
.fall .row-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; white-space: normal; }
.fall .row-actions button { margin: 0; }
#mb-detail-actions .fall { border-left-color: var(--line); }

/* Einstellungen: eine Fläche, Bereiche aufklappbar */
.einstellungen details { border-top: 1px solid var(--line); padding: 10px 0; }
.einstellungen details:last-child { padding-bottom: 0; }
.einstellungen details[open] > summary { margin-bottom: 8px; }

/* Lightning-Knoten */
.channels { list-style: none; margin: 0 0 12px; padding: 0; }
.channel { padding: 12px 0; border-top: 1px solid var(--line); }
.channel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .9rem; }
.channel-id { color: var(--muted); font-size: .8rem; }
/* One whole split into parts. The widths come from the data, the 2px gap separates the parts. */
.channel-bar { display: flex; gap: 2px; height: 8px; margin: 10px 0 8px; }
.channel-part { min-width: 2px; flex: 0 1 0; border-radius: 99px; }
.part-own { background: var(--accent); }
.part-inbound { background: #2a78b5; }
.part-reserve { background: #d5d5d5; }
.channel-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: .85rem; }
.channel-legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; flex: none; border-radius: 50%; }
#onchain-preview { margin-top: 16px; }
#onchain-preview .primary, #onchain-form .button, #onchain-active .button { margin-top: 12px; }
#onchain-active .link { margin-left: 12px; }

@media (max-width: 900px) {
  .kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-liste { grid-template-columns: max-content minmax(0, 1fr); }
}

/* Handy: Tabellen werden zu Karten. */
@media (max-width: 720px) {
  body.admin { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 16px; }
  .admin-bereiche { display: flex; }
  .admin-bereiche a { flex: 1 1 auto; justify-content: center; padding: 8px 10px; font-size: .9rem; }
  /* Reiter als umbrechende Schaltflächen: alle fünf bleiben sichtbar. */
  .reiter { flex-wrap: wrap; gap: 6px; padding: 6px 0 10px; overflow: visible; }
  .reiter a { min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: .9rem; }
  .reiter a[aria-current='page'] { border-color: var(--accent); background: #fff4e5; }
  .filter .row .field { flex: 1 1 140px; }
  .filter .row .field-breit { flex-basis: 100%; }
  .system-raster { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 1.25rem; }
  .table-wrap { overflow: visible; }
  .rechnungen-tabelle thead, .mb-kauf-tabelle thead, .umsatz-tabelle thead { display: none; }
  .rechnungen-tabelle, .rechnungen-tabelle tbody, .mb-kauf-tabelle, .mb-kauf-tabelle tbody, .umsatz-tabelle, .umsatz-tabelle tbody { display: block; }
  .rechnungen-tabelle tr, .mb-kauf-tabelle tr, .umsatz-tabelle tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .rechnungen-tabelle td, .rechnungen-tabelle th, .mb-kauf-tabelle td, .umsatz-tabelle td, .umsatz-tabelle th { padding: 0; border: 0; }
  tbody tr:hover { background: none; }
  .rechnungen-tabelle td:nth-child(5), .rechnungen-tabelle td:nth-child(6), .rechnungen-tabelle td:nth-child(7) { grid-column: 1 / -1; }
  .rechnungen-tabelle td:nth-child(5) { color: var(--muted); font-size: .85rem; }
  .rechnungen-tabelle td:nth-child(2), .rechnungen-tabelle td:nth-child(4) { text-align: right; }
  .rechnungen-tabelle .row-actions { padding-top: 4px; text-align: left; }
  .rechnungen-tabelle .row-actions button { margin: 0 12px 0 0; }
  /* Kauf: Produkt + Status, Betrag + Zahlart, Datum + Auftrag, E-Mail, Detail */
  .mb-kauf-tabelle .kauf-produkt { grid-area: 1 / 1; }
  .mb-kauf-tabelle .kauf-status { grid-area: 1 / 2; text-align: right; }
  .mb-kauf-tabelle .kauf-betrag { grid-area: 2 / 1; }
  .mb-kauf-tabelle .kauf-zahlart { grid-area: 2 / 2; text-align: right; color: var(--muted); font-size: .85rem; }
  .mb-kauf-tabelle .kauf-datum { grid-area: 3 / 1; align-self: center; color: var(--muted); font-size: .85rem; }
  .mb-kauf-tabelle .kauf-id { display: none; }
  .mb-kauf-tabelle .kauf-mail { grid-area: 4 / 1 / 5 / 3; color: var(--muted); font-size: .85rem; }
  .mb-kauf-tabelle .kauf-mail[data-leer] { display: none; }
  .mb-kauf-tabelle .row-actions { grid-area: 3 / 2; }
  .mb-kauf-tabelle .row-actions button { margin: 0; }
  /* Umsatz: Zeitraum + Betrag, dann Aufteilung */
  .umsatz-tabelle th[scope='row'] { grid-area: 1 / 1; }
  .umsatz-tabelle td:nth-of-type(1) { grid-area: 1 / 2; text-align: right; }
  .umsatz-tabelle td:nth-of-type(2) { grid-area: 2 / 1; margin-bottom: 4px; color: var(--muted); font-size: .85rem; }
  .umsatz-tabelle td:nth-of-type(2)::after { content: " Käufe"; }
  .umsatz-tabelle tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .umsatz-tabelle td.aufteilung { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; text-align: left; }
  .umsatz-tabelle td.aufteilung::before { content: attr(data-label); }
  .detail-liste { grid-template-columns: 1fr; gap: 0; }
  .detail-liste dt { font-size: .8rem; }
  .detail-liste dd { margin-bottom: 8px; }
}
@media (max-width: 420px) {
  .kennzahlen { gap: 8px; }
  .tile dt { font-size: .75rem; }
}

/* masterbach-Paydesk (Rolle masterbach, 24.11.2026): ohne Bereich «Kaffee & Rechnungen»; Buchhaltung */
.rolle-masterbach #nav-paydesk, .rolle-masterbach #paydesk-view { display: none !important; }
#mb-buchhaltung h3, #mb-konto h3 { margin: 22px 0 8px; font-size: 1rem; }
#mb-journal td, #mb-buchhaltung td { white-space: nowrap; }
td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
#konto-passkeys-ort details, #konto-protokoll-ort details { margin-top: 12px; }

/* Buchhaltungstabellen bleiben auch schmal Tabellen und scrollen seitlich (die Kauftabellen werden dort zu Karten) */
#mb-buchhaltung .table-wrap, #mb-journal .table-wrap { overflow-x: auto; }
