/* Fahrschule Flash Verwaltung */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --border: #e2e5ea;
  --brand: #f5b800;
  --brand-strong: #dca500;
  --brand-ink: #1a1400;
  --nav-bg: #14171d;
  --nav-text: #c9ced8;
  --nav-active: #232832;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --success: #1e7b3c;
  --success-bg: #e8f6ed;
  --warning: #8a5a00;
  --warning-bg: #fff6dc;
  --info: #1d4ed8;
  --info-bg: #e9f0ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --focus: 0 0 0 3px rgba(245, 184, 0, .45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e8eaef;
    --muted: #9aa1ad;
    --border: #2a2f38;
    --nav-bg: #0b0d10;
    --nav-active: #1c2027;
    --danger-bg: #3a1818;
    --success-bg: #12301d;
    --warning-bg: #352a0c;
    --info-bg: #142145;
    --danger: #ff8a80;
    --success: #7ad69a;
    --warning: #f6cf6b;
    --info: #9bb8ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- Brand ---------- */
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); }
.brand-name { font-size: 18px; letter-spacing: -.01em; }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(245, 184, 0, .14), transparent 60%), var(--bg); }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-title { font-size: 22px; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 20px; }
.auth-alt { text-align: center; margin: 18px 0 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form-heading { font-size: 16px; margin: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { font-weight: 600; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time], input[type=search], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-strong); box-shadow: var(--focus); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.form-row-end { display: flex; justify-content: flex-end; margin-top: -6px; }
.code-input { font-size: 22px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand-strong); margin: 0; }
.hint-tight { margin-top: -10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Passwortfeld mit Auge */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer; }
.password-toggle:hover { color: var(--text); background: var(--bg); }
.password-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
.password-toggle .eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font: inherit; font-weight: 600;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; margin: 12px 0 16px; }
.link { color: var(--info); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); border-radius: 8px; cursor: pointer; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ---------- 2FA ---------- */
.steps { padding-left: 20px; margin: 0 0 12px; display: grid; gap: 6px; }
.qr-box { display: grid; place-items: center; margin: 8px 0 12px; }
.qr { background: #fff; padding: 12px; border-radius: 10px; border: 1px solid var(--border); min-width: 224px; min-height: 224px; display: grid; place-items: center; }
.qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.manual-key { margin-bottom: 16px; font-size: 14px; }
.manual-key summary { cursor: pointer; color: var(--info); }
.secret { display: block; padding: 10px; background: var(--bg); border-radius: 8px; word-break: break-all; font-size: 15px; letter-spacing: .05em; }
.codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code { display: block; text-align: center; padding: 8px; background: var(--bg); border-radius: 6px; font-size: 15px; letter-spacing: .05em; }

/* ---------- Setup ---------- */
.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; font-size: 14px; }
.checks li::before { display: inline-block; width: 20px; font-weight: 700; }
.checks .ok::before { content: "✓"; color: var(--success); }
.checks .warn::before { content: "!"; color: var(--warning); }
.checks .fail::before { content: "✕"; color: var(--danger); }
.checks .fail { color: var(--danger); }

/* ---------- App layout ---------- */
.app-body { min-height: 100vh; }
/* Hamburger-Menü: Seitenleiste fährt auf allen Bildschirmen von links herein */
.sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: 280px; max-width: 86vw; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--nav-bg); color: var(--nav-text); padding: 16px 12px 24px; transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease; }
body.nav-open { overflow: hidden; }
.sidebar-backdrop { display: none; }
body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 20; }
.sidebar-close { margin-left: auto; color: var(--nav-text); }
.nav-button { width: 100%; background: none; border: 0; color: inherit; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; text-align: left; }
.topbar-brand { display: grid; text-decoration: none; }
.topbar-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.sidebar-brand .brand-mark { width: 34px; height: 34px; border-radius: 8px; }
.sidebar-brand .brand-name { font-size: 16px; }
.nav { display: grid; gap: 2px; }
.nav-section { margin: 18px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d8594; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-link:hover { background: var(--nav-active); color: #fff; }
.nav-link.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 18px; margin: 0; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.user-meta { display: grid; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--muted); }
.menu-toggle { display: grid; }
.content { padding: 24px; max-width: 1320px; width: 100%; margin: 0 auto; }
.lead { font-size: 16px; margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-title { font-size: 16px; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.grid-2 .card { margin-bottom: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 20px 0 0; font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h2 { margin-top: 0; }

@media (max-width: 900px) {
  .topbar { padding: 10px 16px; }
  .content { padding: 16px; }
  .user-meta { display: none; }
}
@media (max-width: 480px) {
  .auth-card { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .codes { grid-template-columns: 1fr; }
}
@media print {
  .auth-brand, .auth-foot, .btn, .alert-warning { display: none !important; }
  .auth-card { border: 0; box-shadow: none; }
}

/* ---------- Schritt 2: Listen, Tabellen, Formulare ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar select { width: auto; min-width: 140px; }
.search-box { position: relative; flex: 1 1 280px; min-width: 0; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 38px; }
.search-box .spinner { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border: 2px solid var(--border); border-top-color: var(--brand-strong); border-radius: 50%; opacity: 0; }
.toolbar.is-loading .spinner { opacity: 1; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg); }
.table td a { color: var(--info); text-decoration: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { text-align: center; color: var(--muted); padding: 32px; }
.table .sub { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.table-compact th, .table-compact td { padding: 6px 8px; }
.table-compact input[type=text], .table-compact input[type=number], .table-compact input[type=time], .table-compact select { padding: 6px 8px; }
.table-scroll { overflow-x: auto; }
.input-xs { width: 80px !important; }
.new-row td { background: var(--bg); }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--border); white-space: nowrap; }
.badge-ok { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-off { background: var(--bg); color: var(--muted); }
.badge-warn { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-role-admin { background: #1f2937; color: #fff; border-color: transparent; }
.badge-branch { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.badge-role-verwaltung { background: var(--info-bg); color: var(--info); border-color: transparent; }
.color-dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--text); }
.form-narrow { max-width: 720px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.field-row-zip { grid-template-columns: 120px 1fr; }
.field-error { margin: 0; font-size: 13px; color: var(--danger); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.req { color: var(--danger); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--text); opacity: 1; cursor: default; }
textarea { resize: vertical; }
input[type=color] { width: 64px; height: 42px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
fieldset.checkgroup { border: 0; padding: 0; margin: 0; }
fieldset.checkgroup legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.grid-main-side > .card { margin-bottom: 0; }
.side-card .btn { margin-top: 12px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-danger:hover { filter: brightness(.96); }
.price-matrix td, .price-matrix th { white-space: nowrap; }
.price-matrix td { padding: 8px 6px; }
.table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand-strong); }
.money-input { position: relative; display: inline-block; }
.money-input input { width: 92px; text-align: right; padding-right: 26px; }
.money-input span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.hours-table select, .hours-table input { min-width: 110px; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .grid-main-side { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .field-row-zip { grid-template-columns: 110px 1fr; }
  .toolbar .btn { width: 100%; }
}
fieldset.date-select { border: 0; padding: 0; margin: 0; }
fieldset.date-select legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.date-select-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 8px; max-width: 420px; }
.name-cell { white-space: nowrap; }
.icon-links { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; }
.icon-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--muted) !important; }
.icon-link:hover { background: var(--info-bg); color: var(--info) !important; }
button.icon-link { border: 0; background: transparent; cursor: pointer; padding: 0; }
.phone-menu { position: absolute; z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px; }
.phone-menu-head { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.phone-menu a { display: block; padding: 10px 12px; border-radius: 6px; text-decoration: none; color: var(--text); font-weight: 500; }
.phone-menu a:hover, .phone-menu a:focus { background: var(--bg); outline: none; }
.field-row-name { grid-template-columns: 1fr 200px; }
@media (max-width: 900px) { .field-row-name { grid-template-columns: 1fr; } }

/* ---------- Schritt 3: Kalender ---------- */
.content:has(#calendar-app) { max-width: none; }
.cal-toolbar select { min-width: 180px; }
.cal-nav, .cal-view { display: flex; gap: 6px; align-items: center; }
.cal-nav input[type="date"] { width: auto; padding: 6px 10px; }
.cal-view .btn.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin: -4px 0 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); }
.lg-free { background: var(--success-bg); border-color: #9fd3b0; }
.lg-appt { background: var(--info-bg); border-left: 4px solid var(--info); }
.lg-other { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 3px, var(--border) 3px, var(--border) 6px); }
.lg-abs { background: #d7dae0; }
.cal-card { padding: 0; overflow: hidden; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 230px); }
.cal-head, .cal-body { display: grid; min-width: min-content; }
.cal-head { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.cal-corner { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cal-day-head { padding: 8px 10px; display: grid; gap: 2px; border-left: 1px solid var(--border); font-size: 14px; }
.cal-day-head.today strong { color: var(--brand-ink); background: var(--brand); border-radius: 6px; padding: 0 6px; justify-self: start; }
.cal-day-sub { font-size: 12px; color: var(--muted); }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.cal-time { position: absolute; right: 8px; transform: translateY(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-time:first-child { transform: none; }
.cal-times { position: sticky; }
.cal-col { position: relative; border-left: 1px solid var(--border); background-color: var(--bg);
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px); }
.cal-col.today { background-color: color-mix(in srgb, var(--brand) 6%, var(--bg)); }
.cal-work { position: absolute; left: 0; right: 0; background: var(--surface); opacity: .75; }
.cal-free { position: absolute; left: 3px; right: 3px; margin: 1px 0; border: 1px dashed #9fd3b0; border-radius: 6px; background: var(--success-bg);
  color: var(--success); font: inherit; font-size: 12px; text-align: left; padding: 4px 6px; display: flex; align-items: flex-start; }
button.cal-free { cursor: copy; }
button.cal-free:hover { border-style: solid; border-color: var(--success); }
button.cal-free:focus-visible { outline: none; box-shadow: var(--focus); }
.cal-free-label { font-weight: 600; opacity: .85; }
.cal-abs { position: absolute; left: 3px; right: 3px; border-radius: 6px; background: #d7dae0; color: #3c414b; font-size: 12px; padding: 4px 6px; overflow: hidden; }
.cal-appt { position: absolute; left: 3px; right: 3px; margin: 1px 0; border: 0; border-left: 4px solid var(--info); border-radius: 6px; background: var(--info-bg); color: var(--text);
  font: inherit; font-size: 12px; text-align: left; padding: 3px 6px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; cursor: pointer; z-index: 1; box-shadow: var(--shadow); }
.cal-appt:focus-visible { outline: none; box-shadow: var(--focus); }
.cal-appt-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-appt-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt.other, .cal-appt.hidden-appt { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 4px, var(--border) 4px, var(--border) 8px); border-left-color: var(--muted); }
.cal-appt.hidden-appt { cursor: default; box-shadow: none; }
.cal-appt.st-durchgefuehrt { background: var(--success-bg); }
.cal-appt.st-nicht_erschienen { background: var(--warning-bg); }
.cal-appt.st-abgesagt { opacity: .55; z-index: 0; box-shadow: none; }
.cal-appt.st-abgesagt .cal-appt-name { text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }

.modal { border: 0; border-radius: 14px; padding: 22px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(10, 12, 16, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 18px; margin: 0; }
.book-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; background: var(--bg); border-radius: 10px; padding: 12px; font-size: 14px; }
.book-info > div { display: grid; gap: 2px; }
.book-info .muted { font-size: 12px; }
.book-max { grid-column: 1 / -1; font-weight: 600; color: var(--success); }
.student-picker { position: relative; }
.picker-list { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; background: var(--surface); }
.picker-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.picker-item:hover, .picker-item:focus { background: var(--bg); outline: none; }
.picker-empty { padding: 8px 10px; color: var(--muted); font-size: 14px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 8px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.picked > div { display: grid; gap: 2px; font-size: 14px; }
.book-summary { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 10px; background: var(--info-bg); font-size: 15px; }
.book-summary strong { font-size: 20px; }
.appt-meta { margin: 0; }
.appt-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 760px) {
  .cal-toolbar select { min-width: 0; flex: 1 1 45%; }
  .cal-scroll { max-height: calc(100vh - 280px); }
}
.ical-link { width: 100%; min-width: 260px; font-size: 12px; }
.ical-actions form { display: flex; gap: 6px; justify-content: flex-end; }
.google-key-form { margin-top: 12px; }
.cal-gcal { position: absolute; left: 3px; right: 3px; margin: 1px 0; border-left: 4px solid #7c3aed; border-radius: 6px; background: #f1eafe; color: #3b1d75;
  font-size: 12px; padding: 3px 6px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.cal-gcal.all-day { opacity: .8; }
@media (prefers-color-scheme: dark) { .cal-gcal { background: #2a1f45; color: #ddd0ff; } }
.cal-alert { margin: 8px; }
.lg-gcal { background: #f1eafe; border-left: 4px solid #7c3aed; }

/* ---------- Schritt 4: Verwaltung, Abrechnung, Statistik ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.nowrap { white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.list-hint { margin: -6px 0 10px; }
.plate { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; letter-spacing: .03em; padding: 1px 6px; border: 1.5px solid var(--text); border-radius: 4px; background: var(--surface); white-space: nowrap; }
.sum-row td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }
.row-active td { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.row-muted td { opacity: .55; }
.section-title { font-size: 16px; margin: 24px 0 10px; }
.field-row-3 { grid-template-columns: 1.2fr 1fr 1fr; }
.field-row-host { grid-template-columns: 1fr 110px; }
.money-input { display: block; }
.money-input input { width: 100%; padding-right: 32px; text-align: left; }
.money-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.upload-box { display: flex; align-items: center; gap: 12px; padding: 16px; border: 2px dashed var(--border); border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; }
.upload-box:hover, .upload-box:focus-within { border-color: var(--brand); color: var(--text); }
.receipt-preview, .receipt-thumb { max-width: 220px; max-height: 260px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.receipt-current { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.danger-zone { margin: -8px 0 20px; display: flex; justify-content: flex-end; }
.badge.cat-tanken { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.cat-werkstatt { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.period-bar .period-label { min-width: 140px; text-align: center; font-size: 15px; }
.period-bar input[type="date"], .toolbar input[type="month"] { width: auto; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-pos .stat-value, td.pos { color: var(--success); }
.stat-neg .stat-value, td.neg { color: var(--danger); }
.st-badge-durchgefuehrt { background: var(--success-bg); color: var(--success); border-color: transparent; }
.st-badge-nicht_erschienen { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.st-badge-abgesagt { color: var(--muted); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.table-compact td { padding: 6px 4px; }
.chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 200px; }
.chart-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; }
.chart-bars { position: relative; min-height: 0; overflow: hidden; }
.chart-bars svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.chart-label { font-size: 11px; color: var(--muted); text-align: center; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-income { background: #1e7b3c; border-color: #1e7b3c; }
.lg-expense { background: #c62828; border-color: #c62828; }
@media (max-width: 760px) {
  .field-row-3 { grid-template-columns: 1fr 1fr; }
  .chart { gap: 2px; }
}
.age-hint { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--info); min-height: 1.2em; }
.age-hint:empty { display: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.badge-passed { background: var(--success-bg); color: var(--success); border-color: transparent; }
.passed-box { display: flex; gap: 8px; align-items: baseline; padding: 10px 12px; border-radius: 8px; background: var(--success-bg); color: var(--success); margin-bottom: 12px; }
.passed-form { margin-bottom: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border); transition: background .15s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.side-col { display: grid; gap: 20px; align-content: start; }
.side-col .card { margin-bottom: 0; }
.exam-form { display: grid; gap: 12px; }
.exam-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 8px; }
.exam-row.is-passed { border-color: #9fd3b0; background: color-mix(in srgb, var(--success-bg) 60%, var(--surface)); }
.exam-row legend { font-weight: 700; padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.exam-field { display: grid; gap: 4px; }
.exam-field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.exam-input { display: flex; gap: 6px; }
.exam-input input { flex: 1; min-width: 0; padding: 7px 10px; }
.badge-auto { background: var(--info-bg); color: var(--info); border-color: transparent; }

/* ---------- Handy-Optimierung ---------- */
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar-logout, .topbar-brand { display: none; }
  .page-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 12px; }
  .card { padding: 16px; border-radius: 10px; }
  .toolbar { gap: 8px; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .search-box { flex-basis: 100%; }
  input, select, textarea { font-size: 16px; } /* verhindert Zoomen auf dem iPhone */
  .btn { min-height: 42px; }

  /* Listen als Karten: jede Zeile ein Block, Spaltenname links */
  .table.stackable thead { display: none; }
  .table.stackable, .table.stackable tbody, .table.stackable tfoot, .table.stackable tr { display: block; width: 100%; }
  .table.stackable tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table.stackable tbody tr:last-child { border-bottom: 0; }
  .table.stackable td, .table.stackable th { display: block; border: 0; padding: 3px 0; text-align: left; }
  .table.stackable td.has-label { position: relative; padding-left: 40%; min-height: 24px; }
  .table.stackable td.has-label::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 38%; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table.stackable td:first-child { padding-left: 0; font-size: 15px; padding-bottom: 6px; }
  .table.stackable td:first-child::before { content: none; }
  .table.stackable td:empty { display: none; }
  .table.stackable .num { text-align: left; }
  .table.stackable td[colspan] { padding-left: 0; text-align: center; }
  .table.stackable td[colspan]::before { content: none; }
  .table.stackable tr.clickable:hover td { background: none; }
  .table.stackable tr.clickable:active { background: var(--bg); }
}

/* ---------- Menü: Unterpunkte ---------- */
.nav-sub { display: grid; gap: 1px; margin: 0 0 4px 42px; }
.nav-sublink { padding: 6px 10px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--nav-text); opacity: .85; }
.nav-sublink:hover { background: var(--nav-active); color: #fff; opacity: 1; }
.nav-sublink.active { color: #fff; opacity: 1; font-weight: 600; }

/* ---------- E-Mail-Vorlagen / Editor ---------- */
.template-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.template-head .form-heading { margin: 0; }
.editor { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.has-error .editor { border-color: var(--danger); }
.editor:focus-within { border-color: var(--brand-strong); box-shadow: 0 0 0 3px rgba(245, 183, 0, .2); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.editor-toolbar button { min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.editor-toolbar button:hover { background: var(--surface); border-color: var(--border); }
.editor-toolbar button.active { background: var(--brand); color: var(--brand-ink); }
.editor-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.editor-area { min-height: 320px; padding: 18px 20px; outline: none; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.editor-area p { margin: 0 0 12px; }
.editor-area h2 { font-size: 20px; margin: 4px 0 12px; }
.editor-area h3 { font-size: 17px; margin: 4px 0 10px; }
.editor-area ul, .editor-area ol { margin: 0 0 12px; padding-left: 24px; }
.editor-area a { color: var(--info); }
.placeholders { display: grid; gap: 8px; }
.placeholders .label { margin: 0; font-weight: 600; font-size: 14px; }
.ph-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; cursor: pointer; }
.ph-chip span { font-family: inherit; font-family: system-ui, sans-serif; color: var(--muted); font-size: 12px; }
.ph-chip:hover { border-color: var(--brand-strong); }
@media (max-width: 640px) {
  .editor-area { min-height: 260px; padding: 14px; }
  .ph-chip span { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
}

/* Kalender: außerhalb der Arbeitszeit anklickbar */
.cal-col.bookable { cursor: copy; }
.cal-col.bookable .cal-work { cursor: copy; }

/* Kalender: Listenansicht */
.cal-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); border-left: 4px solid transparent; }
.cal-li:last-child { border-bottom: 0; }
.cal-li[role="button"] { cursor: pointer; }
.cal-li[role="button"]:hover, .cal-li[role="button"]:focus-visible { background: var(--bg); outline: none; }
.cal-li-time { display: grid; font-variant-numeric: tabular-nums; line-height: 1.25; }
.cal-li-time span { color: var(--muted); font-size: 13px; }
.cal-li-main { display: grid; gap: 2px; min-width: 0; }
.cal-li-main strong { overflow-wrap: anywhere; }
.cal-li-note { font-size: 13px; color: var(--muted); font-style: italic; }
.cal-li-side { display: flex; align-items: center; gap: 6px; }
.cal-li-appt { border-left-color: var(--info); }
.cal-li-appt.st-durchgefuehrt { border-left-color: var(--success); }
.cal-li-appt.st-durchgefuehrt .cal-li-status { background: var(--success-bg); color: var(--success); border-color: transparent; }
.cal-li-appt.st-abgesagt { opacity: .6; }
.cal-li-appt.st-abgesagt strong { text-decoration: line-through; }
.cal-li-appt.st-nicht_erschienen { border-left-color: var(--danger); }
.cal-li-appt.st-nicht_erschienen .cal-li-status { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.cal-li-free { border-left-color: #9fd3b0; background: var(--success-bg); }
.cal-li-google { border-left-color: #7c3aed; }
.cal-li-abs { border-left-color: var(--muted); color: var(--muted); }
.cal-li-call { color: var(--success); }
.cal-list .empty { padding: 24px 16px; text-align: center; }

/* ---------- Menü: Gruppen (Handy = Schublade, Desktop = waagerechte Leiste) ---------- */
.nav-caret { display: none; }
.nav-sub-full { display: grid; gap: 2px; margin: 0; }
.nav-group-label { pointer-events: none; margin: 18px 0 6px; padding: 0 10px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: #7d8594; background: none !important; box-shadow: none !important; }
.nav-group-label svg { display: none; }

@media (min-width: 1100px) {
  .app-body { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; width: auto; max-width: none; height: auto; padding: 0 20px; overflow: visible; transform: none; visibility: visible; transition: none; box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
  .sidebar-brand { padding: 0; margin-right: 8px; flex-shrink: 0; }
  .sidebar-brand .brand-mark { width: 30px; height: 30px; }
  .sidebar-brand .brand-name { font-size: 15px; white-space: nowrap; }
  .sidebar-close, .menu-toggle, .topbar-brand, .nav-account, .sidebar-backdrop { display: none !important; }
  body.nav-open { overflow: auto; }
  .nav { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; }
  .nav-item { position: relative; display: flex; }
  .nav > .nav-item > .nav-link { padding: 17px 11px; gap: 7px; border-radius: 0; white-space: nowrap; }
  .nav > .nav-item > .nav-link.active { background: transparent; color: #fff; box-shadow: inset 0 -3px 0 var(--brand); }
  .nav > .nav-item > .nav-link:hover, .nav-item:hover > .nav-link { background: var(--nav-active); color: #fff; }
  .nav-caret { display: inline; opacity: .7; margin-left: -2px; }
  .nav-group { margin-left: auto; }
  .nav-group-label { pointer-events: auto; margin: 0; padding: 17px 11px; font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--nav-text); cursor: default; }
  .nav-group-label svg { display: inline; }
  .nav-group-label.active { color: #fff; box-shadow: inset 0 -3px 0 var(--brand) !important; }
  .nav-item:hover > .nav-group-label, .nav-item:focus-within > .nav-group-label { background: var(--nav-active) !important; color: #fff; }
  /* Untermenüs klappen bei Mouseover (und Tastatur-Fokus) auf */
  .nav-item > .nav-sub { display: none; position: absolute; top: 100%; left: 0; z-index: 40; min-width: 220px; margin: 0; padding: 6px; gap: 2px; background: var(--nav-bg); border-radius: 0 0 10px 10px; box-shadow: 0 14px 30px rgba(0, 0, 0, .28); }
  .nav-group > .nav-sub { left: auto; right: 0; }
  .nav-item:hover > .nav-sub, .nav-item:focus-within > .nav-sub { display: grid; }
  .nav-sub .nav-sublink { padding: 9px 12px; font-size: 14px; opacity: .9; white-space: nowrap; }
  .nav-sub .nav-sublink.active { box-shadow: inset 3px 0 0 var(--brand); }
  .nav-sub-full .nav-link { padding: 9px 12px; border-radius: 6px; }
  .topbar { position: static; }
}
@media (min-width: 1100px) and (max-width: 1399px) {
  /* etwas enger: Symbole in der Leiste ausblenden */
  .nav > .nav-item > .nav-link > svg:first-child { display: none; }
  .sidebar-brand .brand-name { display: none; }
}

/* ---------- Menü-Manager ---------- */
.menu-editor { display: grid; gap: 12px; }
.mi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mi { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.mi.is-hidden > .mi-row { opacity: .55; }
.mi.is-dragging { opacity: .4; border-style: dashed; }
.mi-group { background: var(--bg); }
.mi-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; flex-wrap: wrap; }
.mi-handle { cursor: grab; font-size: 18px; color: var(--muted); padding: 4px 2px; user-select: none; line-height: 1; }
.mi-handle:active { cursor: grabbing; }
.mi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg); color: var(--text); flex-shrink: 0; }
.mi-group .mi-icon { background: var(--surface); }
.mi-name { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.mi-label { flex: 1 1 180px; max-width: 280px; padding: 7px 10px; font-weight: 600; }
.mi-meta { font-size: 12px; color: var(--muted); }
.mi-iconsel { width: auto; padding: 6px 8px; font-size: 13px; }
.mi-vis { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.mi-btns { display: flex; gap: 4px; }
.mi-btn { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; }
.mi-btn:hover { border-color: var(--brand-strong); }
.mi-btn[hidden] { display: none; }
.mi-children { margin: 0 10px 10px 44px; min-height: 8px; }
.mi-children.is-empty { min-height: 44px; border: 2px dashed var(--border); border-radius: 8px; }
.mi-children.is-empty::before { content: "Seiten hierher ziehen oder mit → in die Gruppe verschieben"; display: block; padding: 11px 12px; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .mi-children { margin-left: 14px; }
  .mi-label { max-width: none; }
}

/* Handy-Karten: Zusatzzeile direkt unter dem Namen (z. B. Adresse), ohne Spaltenname */
@media (max-width: 640px) {
  .table.stackable td:first-child:has(+ td.cell-sub) { padding-bottom: 0; }
  .table.stackable td.cell-sub { padding: 0 0 8px; font-size: 14px; }
  .table.stackable td.cell-sub::before { content: none; }
}

/* Handy-Karten: mehrere kurze Angaben ohne Spaltennamen in einer Zeile unter dem Namen (z. B. Adresse · Klasse · Filiale) */
@media (max-width: 640px) {
  .table.stackable tr:has(td.cell-inline) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }
  .table.stackable tr:has(td.cell-inline) > td { flex: 1 1 100%; order: 3; }
  .table.stackable tr:has(td.cell-inline) > td:first-child { order: 1; padding-bottom: 2px; }
  .table.stackable tr:has(td.cell-inline) > td.cell-inline { flex: 0 1 auto; order: 2; padding: 0 0 8px; font-size: 14px; }
  .table.stackable td.cell-inline::before { content: none; }
  .table.stackable tr:has(td.cell-inline) > td.cell-grow { flex: 1 1 0; min-width: 50%; text-align: left; }
  .table.stackable tr:has(td.cell-inline) > td.cell-inline:not(.cell-grow) { white-space: nowrap; }
  /* Fahrstunden und Status ohne Spaltennamen rechts in der Namenszeile */
  .table.stackable tr:has(td.cell-inline) > td:first-child { flex: 1 1 0; min-width: 0; white-space: normal; }
  .table.stackable tr:has(td.cell-inline) > td.cell-top { flex: 0 0 auto; order: 1; padding: 0 0 2px; white-space: nowrap; }
  .table.stackable td.cell-top::before { content: none; }
  .table.stackable td.cell-top.num::after { content: " Std."; color: var(--muted); font-size: 13px; }
  .table.stackable tr:has(td.cell-inline)::after { content: ""; order: 1; flex: 0 0 100%; height: 0; }
  .table.stackable tr:has(td.cell-inline) > td.cell-grow + td.cell-inline { margin-left: auto; }
}
.field.is-disabled label { color: var(--muted); }
.field.is-disabled select { opacity: .55; cursor: not-allowed; }
.card-title-gap { margin-top: 20px; }
.status-actions { display: grid; gap: 8px; margin-bottom: 16px; }
.stat-today { border-top: 3px solid var(--brand); }
.instr-name { display: inline-flex; align-items: center; gap: 6px; }
.share-bar { margin-top: 6px; height: 4px; max-width: 220px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.share-bar svg { display: block; width: 100%; height: 4px; }
@media (max-width: 640px) { .share-bar { display: none; } }
.detail-title { margin: 0 0 12px; font-size: 20px; }
.section-title { margin: 24px 0 10px; font-size: 17px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bar-cell { width: 60%; }
.share-bar-wide { max-width: none; margin-top: 0; }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover { text-decoration: underline; }
.lg-cancel { background: #e0a100; border-color: #e0a100; }
.pie-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.pie { width: 220px; height: 220px; flex: 0 0 auto; }
.pie-total { font-size: 4.6px; font-weight: 700; fill: var(--text); }
.pie-sub { font-size: 3px; fill: var(--muted); }
.pie-legend { flex: 1 1 260px; margin: 0; }
@media (max-width: 640px) { .pie { width: 180px; height: 180px; margin: 0 auto; } .pie-legend { flex-basis: 100%; } }
.page-section { margin: 32px 0 14px; padding-top: 14px; border-top: 2px solid var(--border); font-size: 22px; scroll-margin-top: 70px; }
.page-section:first-of-type { margin-top: 8px; border-top: 0; padding-top: 0; }
.jump-nav { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.jump-nav a { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.jump-nav a:hover { border-color: var(--brand-strong); }
.mi-roles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 0 10px 10px 68px; font-size: 13px; }
.mi-roles-label { color: var(--muted); font-weight: 600; }
.mi-role { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.mi-role input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-strong); }
.mi-role.is-locked { color: var(--muted); cursor: not-allowed; }
@media (max-width: 640px) { .mi-roles { padding-left: 12px; } }
.live-min-hint { font-size: 13px; color: var(--warning); font-weight: 600; }

/* Formular „Ausgabe“: kräftigere Kontraste und klare Abschnitte */
:root { --field-border: #9aa3b0; --block-bg: #f7f8fa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --field-border: #4a5260; --block-bg: #1f232a; } }
#expense-form { display: grid; gap: 14px; }
#expense-form .form-block { background: var(--block-bg); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px 16px; display: grid; gap: 12px; }
#expense-form .form-block-title { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); }
#expense-form .form-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 13px; font-weight: 800; }
#expense-form label { color: var(--text); font-size: 14px; font-weight: 700; }
#expense-form input:not([type=file]):not([type=checkbox]), #expense-form select { border: 1.5px solid var(--field-border); background: var(--surface); min-height: 44px; font-size: 16px; }
#expense-form input:not([type=file]):not([type=checkbox]):hover, #expense-form select:hover { border-color: var(--text); }
#expense-form input:focus, #expense-form select:focus { border-color: var(--brand-strong); }
#expense-form .money-input input { font-size: 20px; font-weight: 700; }
#expense-form .upload-box { border: 2px dashed var(--field-border); background: var(--surface); }
#expense-form .field.is-disabled select { background: var(--bg); }
#expense-form .form-actions { margin-top: 2px; }
@media (max-width: 640px) {
  /* Handy: Abschnitte als eigene weiße Karten auf grauem Grund, volle Breite */
  #expense-form.card { background: none; border: 0; box-shadow: none; padding: 0; }
  #expense-form .form-block { background: var(--surface); border: 1.5px solid var(--field-border); border-left: 5px solid var(--brand); box-shadow: var(--shadow); padding: 14px 14px 16px; }
  #expense-form .form-block-title { font-size: 17px; }
  #expense-form .field-row-3 { grid-template-columns: 1fr 1fr; }
  #expense-form .field-row-3 > .field:first-child { grid-column: 1 / -1; }
  #expense-form input::placeholder { color: #8a919c; }
  #expense-form .form-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  #expense-form .form-actions .btn { width: 100%; min-height: 48px; font-size: 16px; }
}
