/* ---------- lux-medien app base v1 ---------- */
:root {
  color-scheme: dark;
  /* brand (shared with document base) */
  --orange: #ff6600;
  --orange-hover: #ff7a26;
  --orange-press: #e65c00;
  --accent-text: #ff7a29;            /* orange as TEXT on dark surfaces   */
  --accent-ink: #1a1a1a;             /* text/icons ON orange fills        */
  --accent-soft: rgba(255,102,0,.13);
  --accent-line: rgba(255,102,0,.55);
  /* surfaces: dark is the default theme */
  --bg: #131313;
  --surface: #1a1a1a;                /* = document --ink                  */
  --surface-2: #222221;
  --surface-3: #2c2b2a;
  --field: #161616;
  --border: #323130;
  --border-strong: #6a6865;
  --text: #f4f3f1;
  --text-soft: #c9c7c4;
  --muted: #9a9895;
  --focus: #ffffff;
  --scrim: rgba(0,0,0,.66);
  /* shape + rhythm */
  --radius: 6px;
  --radius-lg: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Consolas, monospace;
}
[data-theme="light"] {
  color-scheme: light;
  --accent-text: #cc5200;            /* = document --orange-dark          */
  --accent-soft: #fff2e8;
  --accent-line: #ff6600;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f5;
  --surface-3: #ececea;
  --field: #ffffff;
  --border: #dedcda;
  --border-strong: #8a8884;
  --text: #1a1a1a;
  --text-soft: #3a3a3a;
  --muted: #6b6b6b;
  --focus: #1a1a1a;
  --scrim: rgba(26,26,26,.55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); hyphens: auto;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent-text); }
code, kbd {
  font-family: var(--mono); font-size: .88em; background: var(--surface-3);
  padding: 1px 5px; border-radius: 3px;
}
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--orange); color: var(--accent-ink); }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:active { background: var(--orange-press); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: transparent; color: var(--accent-text); border-color: var(--orange); }
.btn-danger:hover { background: var(--accent-soft); }
.btn-link { height: auto; padding: 0; background: none; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Avatar (monogram, never per-client colour) ---------- */
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid var(--accent-line); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.is-neutral { background: var(--surface-3); color: var(--text-soft); border-color: var(--border-strong); }

/* ---------- Badges, tags, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  border-radius: 10px; border: 1px solid transparent; font-size: 11.5px; font-weight: 600;
  line-height: 1; white-space: nowrap; background: var(--surface-3); color: var(--text-soft);
}
.badge svg.i { width: 11px; height: 11px; stroke-width: 2.6; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.badge-ok    { background: transparent; color: var(--text); border-color: var(--text-soft); }
.badge-info  { background: transparent; color: var(--muted); border-color: var(--border-strong); }
.badge-warn  { background: transparent; color: var(--accent-text); border: 1px dashed var(--orange); }
.badge-error { background: var(--orange); color: var(--accent-ink); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-lg { height: 24px; padding: 0 10px; font-size: 12.5px; border-radius: 12px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
  border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text); font-size: 12.5px; white-space: nowrap;
}
.tag svg.i { width: 13px; height: 13px; }
.tag-mono { font-family: var(--mono); font-size: 12px; color: var(--accent-text); }
.tag-remove {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0;
  border: 0; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer;
}
.tag-remove:hover { background: var(--border-strong); color: var(--text); }
.tag-remove svg.i { width: 12px; height: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px;
  background: transparent; border: 1px solid var(--border-strong); color: var(--text-soft);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip:hover { background: var(--surface-3); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--orange); color: var(--accent-text); font-weight: 600; }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--surface-3); color: var(--text-soft); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.count.is-accent { background: var(--orange); color: var(--accent-ink); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Lists, key-value, setting rows ---------- */
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.kv dt, .kv dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--muted); }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .title { font-weight: 600; }
.setting-row .sub { color: var(--muted); font-size: 12.5px; max-width: 52ch; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.label { font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.label .opt { font-weight: 400; color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12.5px; }
.error-msg { display: flex; gap: 6px; align-items: flex-start; color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.error-msg svg.i { width: 14px; height: 14px; margin-top: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; background: var(--field); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius); font: inherit; transition: border-color .12s;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--orange); outline-offset: 0; border-color: var(--orange); }
.input[disabled], .select[disabled], .textarea[disabled], .input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--orange); border-width: 2px; padding-left: 11px; }
.select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9895' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-group { display: flex; }
.input-group .input { border-radius: 0; min-width: 0; }
.input-group > :first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > :last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group > * + * { margin-left: -1px; }
.addon {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--surface-3);
  border: 1px solid var(--border-strong); color: var(--muted); font-size: 13px; white-space: nowrap;
}
.input-group .input:focus-visible { position: relative; z-index: 1; }

.check, .radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input, .radio input {
  appearance: none; width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer;
  background: var(--field); border: 1.5px solid var(--border-strong);
}
.check input { border-radius: 4px; }
.radio input { border-radius: 50%; }
.check input:hover, .radio input:hover { border-color: var(--muted); }
.check input:checked, .check input:indeterminate { background-color: var(--orange); border-color: var(--orange); background-repeat: no-repeat; background-position: center; background-size: 14px; }
.check input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.check input:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.radio input:checked { border-color: var(--orange); background: radial-gradient(circle, var(--orange) 0 4.5px, var(--field) 5px); }
.check input[disabled], .radio input[disabled] { opacity: .45; cursor: not-allowed; }
.check .t, .radio .t { display: grid; gap: 2px; }
.check .t b, .radio .t b { font-weight: 600; }
.choice-list { display: grid; gap: 10px; }
.choice-card { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; background: var(--field); }
.choice-card:has(input:checked) { border-color: var(--orange); background: var(--accent-soft); }

.switch {
  appearance: none; width: 36px; height: 20px; margin: 0; flex: none; position: relative; cursor: pointer;
  border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .15s;
}
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-soft); transition: transform .15s; }
.switch:checked { background: var(--orange); border-color: var(--orange); }
.switch:checked::after { transform: translateX(16px); background: var(--accent-ink); }
.switch[disabled] { opacity: .45; cursor: not-allowed; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.segmented span { display: block; padding: 5px 12px; border-radius: 4px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.segmented input:checked + span { background: var(--orange); color: var(--accent-ink); }
.segmented input:not(:checked):hover + span { color: var(--text); background: var(--surface-3); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.search { position: relative; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; }

.picker { position: relative; }
.picker-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); max-height: 280px; overflow: auto;
}
.picker.is-static .picker-list { position: static; margin-top: 4px; }
.picker-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.picker-opt:hover, .picker-opt.is-active { background: var(--surface-3); }
.picker-opt.is-active { box-shadow: inset 3px 0 0 var(--orange); }
.picker-opt.is-disabled { opacity: .5; cursor: not-allowed; }
.picker-opt.is-disabled:hover { background: transparent; }
.picker-main { display: grid; min-width: 0; flex: 1; }
.picker-main small { color: var(--muted); }

/* Form section: explanation left, fields right */
.form-section { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: var(--s6); padding: var(--s5) 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > .explain h3 { font-size: 15px; margin-bottom: 6px; }
.form-section > .explain p { color: var(--muted); font-size: 13px; }
.form-section > .explain p + p { margin-top: 8px; }
.form-fields { display: grid; gap: var(--s4); align-content: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.form-actions {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 0 0; border-top: 1px solid var(--border);
}
.form-actions .push { margin-right: auto; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: 13px; margin-bottom: 8px; }

/* ---------- Alerts + toast ---------- */
.alert {
  display: flex; gap: 12px; padding: 12px 16px; border: 1px solid var(--border-strong); border-left-width: 4px;
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-2); font-size: 13.5px;
}
.alert > svg.i { width: 18px; height: 18px; margin-top: 1px; }
.alert .t { flex: 1; min-width: 0; }
.alert .t b { display: block; margin-bottom: 2px; }
.alert .t p { color: var(--text-soft); }
.alert-info { border-left-color: var(--text-soft); }
.alert-ok   { border-left-color: var(--text); }
.alert-warn { border-left-color: var(--orange); background: var(--accent-soft); }
.alert-warn > svg.i, .alert-error > svg.i { color: var(--accent-text); }
.alert-error { border-color: var(--orange); border-left-color: var(--orange); background: var(--accent-soft); }
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 100; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--text); color: var(--bg);
  border-radius: var(--radius); font-size: 13.5px; font-weight: 600; animation: pop .18s ease-out;
}
.toast svg.i { margin-top: 2px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
dialog.modal {
  padding: 0; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-lg); width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
dialog.modal.is-sm { width: min(440px, calc(100vw - 24px)); }
dialog.modal.is-lg { width: min(840px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: var(--scrim); }
.modal-frame { border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .push { margin-right: auto; }
.modal-head.has-tabs { padding-bottom: 0; flex-direction: column; align-items: stretch; border-bottom: 0; }
.modal-head.has-tabs .tabs { margin: 12px -20px 0; padding: 0 20px; }
.modal-head.is-plain { align-items: center; }
.modal-title { font-size: 16px; }

/* Client header (name block, used in modals and detail panels) */
.client-head { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.client-head .text { min-width: 0; }
.client-name { font-size: 18px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.client-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.client-head.is-compact .client-name { font-size: 15px; }
.client-head-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Client list (master list, left) ---------- */
.client-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 0; }
.client-list-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.client-list-head h3 { font-size: 14.5px; flex: 1; display: flex; align-items: center; gap: 8px; }
.client-list-tools { display: grid; gap: 10px; padding: 0 14px 12px; border-bottom: 1px solid var(--border); }
.client-items { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.client-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.client-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px 8px 12px;
  border: 0; border-radius: var(--radius); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.client-item:hover { background: var(--surface-2); }
.client-item .main { display: grid; min-width: 0; flex: 1; }
.client-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-item .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-item.is-selected { background: var(--surface-3); }
.client-item.is-selected::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--orange); }
.client-item.is-disabled { opacity: .5; cursor: not-allowed; }
.client-item.is-disabled:hover { background: transparent; }
.client-list-foot { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; }

/* ---------- Navigation ---------- */
.topbar { display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.brand::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--orange); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a, .nav button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px; background: none; border: 0;
  color: var(--muted); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.nav a:hover, .nav button:hover { color: var(--text); }
.nav [aria-current="page"] { color: var(--text); }
.nav [aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--orange); border-radius: 2px 2px 0 0; }
.sidenav { display: grid; gap: 2px; padding: 8px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); color: var(--text-soft); text-decoration: none; font-weight: 600; position: relative; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a[aria-current="page"] { background: var(--surface-3); color: var(--text); }
.sidenav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--orange); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; background: none; border: 0;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; background: var(--orange); border-radius: 2px 2px 0 0; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); list-style: none; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.pager .info { margin-right: 8px; font-variant-numeric: tabular-nums; }

/* ---------- Menu + tooltip ---------- */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40; min-width: 200px; padding: 4px; margin: 0; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.is-danger { color: var(--accent-text); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.tip { position: relative; display: inline-flex; }
.tip[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 50;
  padding: 5px 9px; border-radius: 4px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s;
}
.tip[data-tip]:hover::after, .tip[data-tip]:focus-within::after { opacity: 1; }

/* ---------- Tables ---------- */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-tools .grow { flex: 1; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; border-bottom: 2px solid var(--orange); white-space: nowrap; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-selected td { background: var(--accent-soft); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .shrink { width: 1%; white-space: nowrap; }
.table .sort { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.table .sort svg.i { width: 12px; height: 12px; color: var(--accent-text); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }

/* ---------- Feedback: progress, skeleton, empty ---------- */
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.skeleton { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty svg.i { width: 28px; height: 28px; color: var(--muted); }
.empty h3 { font-size: 15px; }
.empty p { color: var(--muted); max-width: 44ch; }

/* ---------- Accordion, stepper ---------- */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.accordion details { border-bottom: 1px solid var(--border); }
.accordion details:last-child { border-bottom: 0; }
.accordion summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; font-weight: 600; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: ""; width: 16px; height: 16px; flex: none; background: no-repeat center / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9895' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); transition: transform .15s; }
.accordion details[open] summary::after { transform: rotate(180deg); }
.accordion .panel { padding: 0 16px 14px; color: var(--text-soft); }
.stepper { display: flex; gap: 0; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.stepper li { flex: 1; position: relative; display: flex; align-items: center; gap: 10px; padding-right: 12px; color: var(--muted); font-weight: 600; counter-increment: step; }
.stepper li::before {
  content: counter(step); display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 2px solid var(--border-strong); font-size: 12px;
}
.stepper li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); margin-left: 4px; min-width: 16px; }
.stepper li.is-done { color: var(--text); }
.stepper li.is-done::before { content: "✓"; background: var(--text); border-color: var(--text); color: var(--bg); }
.stepper li.is-done::after { background: var(--text-soft); }
.stepper li.is-current { color: var(--text); }
.stepper li.is-current::before { background: var(--orange); border-color: var(--orange); color: var(--accent-ink); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 320px 1fr; gap: 16px; padding: 16px; align-items: start; background: var(--bg); }
.shell .client-list { height: 560px; }
.detail { display: grid; gap: 16px; min-width: 0; }
.login { width: min(400px, 100%); margin: 0 auto; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .shell .client-list { height: 420px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-section { grid-template-columns: 1fr; gap: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .stat-grid { grid-template-columns: 1fr; }
  .stepper li span { display: none; }
  .stepper li.is-current span { display: inline; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .push { margin-right: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
/* ---------- end lux-medien app base v1 ---------- */

/* ======================================================================================
   Layout helpers for this application. Not part of the app design system: they only arrange
   its components and use its tokens (spacing, surfaces, borders). No colours, fonts, shadows.
   ====================================================================================== */
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
body { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
.topbar { padding-top: env(safe-area-inset-top, 0px); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.topbar .nav { flex: 0 1 auto; }
.alerts { display: grid; gap: var(--s2); padding: var(--s4) var(--s4) 0; }
.alerts .alert ul { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s1); }
.alerts .alert li { display: flex; gap: var(--s3); justify-content: space-between; align-items: baseline; }
.shell { min-height: calc(100dvh - 53px); }
.shell .client-list { height: calc(100dvh - 53px - var(--s5) - var(--s4)); position: sticky; top: calc(53px + var(--s4)); }
@media (max-width: 900px) { .shell .client-list { height: 420px; position: static; } }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.stack { display: grid; gap: var(--s4); }
.head-row { display: flex; align-items: flex-start; gap: var(--s3); }
.cell-sub { font-size: 12px; }
.client-item .avatar { flex: none; }
.modal-body .list .row-input { display: grid; gap: var(--s2); }
.list-check { display: flex; gap: var(--s3); align-items: flex-start; width: 100%; }
.name-edit { margin: var(--s2) 0 0 28px; display: grid; gap: var(--s1); }
.modal-foot .badge { margin-right: var(--s1); }
.empty.in-detail { min-height: 320px; align-content: center; }
.skeleton-list { display: grid; gap: var(--s3); padding: var(--s3); }
.preview-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
body.login-page { display: grid; place-items: center; padding: var(--s4); background: var(--bg); }
body.login-page .login { margin: 0; }
.login .card-body { display: grid; gap: var(--s4); padding: var(--s5); }
.modal-content { display: flex; flex-direction: column; flex: 1; min-height: 0; max-height: inherit; }
.menu-label { padding: 6px 10px; font-size: 12.5px; }
.alert-toggle { align-self: flex-start; }
.filter-row { gap: 6px; }
.list-none { padding: var(--s3); }
.client-item .badge { flex: none; }
.wizard-head { gap: var(--s3); flex: 1; min-width: 0; }
.rate-group { max-width: 200px; }
.accounts-actions { margin-top: var(--s3); }
.modal-alert { margin-bottom: var(--s4); }
.account-picker .check.is-disabled { opacity: .55; cursor: not-allowed; }
.account-pick.chosen { background: var(--accent-soft); }
.confirm-body { display: flex; gap: 14px; }
.confirm-icon { color: var(--accent-text); border-color: var(--orange); }
.confirm-text { margin-top: 6px; }
.confirm-lines { max-height: 160px; overflow: auto; }
.tag-list button.tag { cursor: pointer; }
.login-intro { margin-top: 6px; }
.client-head-bar .badge { flex: none; }
.alerts .alert .btn-link { height: auto; }
