/* Schnittstelle – Basis-Design. Markenfarben kommen als CSS-Variablen aus den Einstellungen. */
:root {
  --sk-primary: #2f5aae;
  --sk-primary-ink: #ffffff;
  --sk-accent: #53b2ce;
  --sk-bg: #f6f5f2;
  --sk-surface: #ffffff;
  --sk-surface-2: #f0eeea;
  --sk-ink: #22201d;
  --sk-ink-2: #5d5953;
  --sk-ink-3: #8b867e;
  --sk-line: #e4e1db;
  --sk-success: #2e7d5b;
  --sk-warning: #b7791f;
  --sk-danger: #c0392b;
  --sk-radius: 16px;
  --sk-radius-sm: 10px;
  --sk-shadow: 0 1px 2px rgba(34, 32, 29, .06), 0 4px 16px rgba(34, 32, 29, .06);
  --sk-shadow-lg: 0 12px 40px rgba(34, 32, 29, .18);
  --sk-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sk-font-display: var(--sk-font);
  --sk-tabbar-h: 64px;
  --sk-safe-b: env(safe-area-inset-bottom, 0px);
  --sk-safe-t: env(safe-area-inset-top, 0px);
  --sk-primary-soft: color-mix(in srgb, var(--sk-primary) 10%, white);
  --sk-accent-soft: color-mix(in srgb, var(--sk-accent) 14%, white);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sk-bg); color: var(--sk-ink);
  font: 16px/1.5 var(--sk-font); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: var(--sk-primary); }
h1, h2, h3, h4 { font-family: var(--sk-font-display); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--sk-ink-2); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; color: var(--sk-ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sk-primary) 45%, transparent); outline-offset: 2px; }

/* ---------- Shell ---------- */
#sk-root { min-height: 100dvh; }
.shell-customer .shell-main { padding-bottom: calc(var(--sk-tabbar-h) + var(--sk-safe-b) + 8px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  min-height: 56px; padding: var(--sk-safe-t) 8px 0; background: color-mix(in srgb, var(--sk-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar-title { font-size: 1.05rem; text-align: center; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand { display: flex; align-items: center; padding-left: 8px; }
.topbar-slot { display: flex; justify-content: flex-end; }
.brand-logo { max-height: 28px; width: auto; }
.brand-text { font-weight: 700; color: var(--sk-primary); letter-spacing: .02em; }
.page { max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; }
.page-bare { max-width: 440px; padding-top: calc(var(--sk-safe-t) + 32px); }
.page-loading { padding: 48px 0; }
.offline-bar { display: flex; align-items: center; gap: 6px; justify-content: center; font-size: .85rem; background: #fff4d6; color: #6b4e00; padding: 6px 12px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  height: calc(var(--sk-tabbar-h) + var(--sk-safe-b)); padding-bottom: var(--sk-safe-b);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--sk-line);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--sk-ink-3); text-decoration: none; font-size: .7rem; font-weight: 500; min-width: 0;
}
.nav-item.is-active { color: var(--sk-primary); }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Team: Rail links auf Tablet, Tabbar unten auf dem Handy */
.shell-team .rail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; overflow-x: auto;
  height: calc(var(--sk-tabbar-h) + var(--sk-safe-b)); padding-bottom: var(--sk-safe-b);
  background: #1f1d1a; scrollbar-width: none;
}
.shell-team .rail .nav-item { color: #b9b3aa; min-width: 72px; }
.shell-team .rail .nav-item.is-active { color: #fff; }
.shell-team .rail-brand { display: none; }
.shell-team .shell-main { padding-bottom: calc(var(--sk-tabbar-h) + var(--sk-safe-b)); }
.shell-team .page { max-width: none; }
@media (min-width: 900px) {
  .shell-team { display: grid; grid-template-columns: 96px 1fr; }
  .shell-team .rail {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: calc(var(--sk-safe-t) + 12px) 8px 12px; overflow-y: auto;
  }
  .shell-team .rail .nav-item { flex: 0 0 auto; padding: 10px 4px; border-radius: 12px; font-size: .72rem; text-align: center; }
  .shell-team .rail .nav-item.is-active { background: rgba(255, 255, 255, .1); }
  .shell-team .rail .nav-item:last-child { margin-top: auto; }
  .shell-team .rail-brand { display: flex; justify-content: center; padding: 4px 0 16px; }
  .shell-team .rail-brand .brand-text { color: #fff; font-size: .8rem; text-align: center; }
  .shell-team .rail-brand .brand-logo { max-width: 64px; filter: brightness(0) invert(1); }
  .shell-team .shell-main { padding-bottom: 0; min-width: 0; }
  .shell-team .topbar { grid-template-columns: 48px 1fr 1fr; }
  .shell-team .topbar-title { text-align: left; }
}

/* Splash */
.splash { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.splash-logo { max-width: 180px; }
.splash-name { font-size: 1.6rem; font-weight: 700; color: var(--sk-primary); }

/* ---------- Bausteine ---------- */
.card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: var(--sk-radius);
  padding: 16px; box-shadow: var(--sk-shadow); margin-bottom: 12px;
}
.card-link { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.card-link:active { transform: scale(.99); }
.card-hero { background: linear-gradient(135deg, var(--sk-primary), color-mix(in srgb, var(--sk-primary) 60%, var(--sk-accent))); color: var(--sk-primary-ink); border: 0; }
.card-hero .muted, .card-hero .tiny { color: rgba(255, 255, 255, .82); }
.card-flat { box-shadow: none; }
.card-soft { background: var(--sk-primary-soft); border-color: transparent; box-shadow: none; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.section-title h2 { margin: 0; font-size: 1.05rem; }
.section-title a, .section-title button { font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  font: 600 1rem/1 var(--sk-font); border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background .15s, transform .1s, opacity .15s; -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--sk-primary); color: var(--sk-primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--sk-primary) 88%, black); }
.btn-secondary { background: var(--sk-surface); color: var(--sk-ink); border-color: var(--sk-line); }
.btn-ghost { background: transparent; color: var(--sk-primary); }
.btn-danger { background: var(--sk-danger); color: #fff; }
.btn-success { background: var(--sk-success); color: #fff; }
.btn-light { background: rgba(255, 255, 255, .18); color: inherit; border-color: rgba(255, 255, 255, .35); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { min-height: 56px; font-size: 1.05rem; }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) transparent transparent; animation: sk-spin .7s linear infinite; }
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--sk-primary) var(--sk-primary) transparent transparent; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--sk-ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--sk-surface-2); }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--sk-ink-2); margin-bottom: 6px; }
.field-hint { display: block; font-size: .8rem; color: var(--sk-ink-3); margin-top: 4px; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; color: inherit; background: var(--sk-surface);
  border: 1px solid var(--sk-line); border-radius: var(--sk-radius-sm); appearance: none; -webkit-appearance: none;
}
textarea.input { min-height: 88px; resize: vertical; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b867e' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input:focus { outline: none; border-color: var(--sk-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sk-primary) 18%, transparent); }
.input-code { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 480px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; border-bottom: 1px solid var(--sk-line); }
.toggle:last-child { border-bottom: 0; }
.toggle-text { flex: 1; display: flex; flex-direction: column; }
.toggle-text small { color: var(--sk-ink-3); font-size: .82rem; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { position: relative; flex: 0 0 auto; width: 50px; height: 30px; border-radius: 999px; background: #d8d4cd; transition: background .2s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + .toggle-ui { background: var(--sk-success); }
.toggle input:checked + .toggle-ui::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-ui { outline: 3px solid color-mix(in srgb, var(--sk-primary) 45%, transparent); }

.segmented { display: flex; background: var(--sk-surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 9px; font: 500 .92rem var(--sk-font); color: var(--sk-ink-2); cursor: pointer; }
.segmented button.is-active { background: var(--sk-surface); color: var(--sk-ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sk-line); background: var(--sk-surface); font: 500 .9rem var(--sk-font); color: var(--sk-ink); cursor: pointer; }
.chip.is-active { background: var(--sk-primary); color: var(--sk-primary-ink); border-color: var(--sk-primary); }

.list { background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: var(--sk-radius); overflow: hidden; margin-bottom: 12px; }
.list-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; font: inherit; color: inherit; text-decoration: none; background: transparent; border: 0; border-bottom: 1px solid var(--sk-line); }
.list-item:last-child { border-bottom: 0; }
.list-item.is-link { cursor: pointer; }
.list-item.is-link:hover { background: var(--sk-surface-2); }
.li-leading { flex: 0 0 auto; display: flex; color: var(--sk-primary); }
.li-body { flex: 1; min-width: 0; }
.li-title { font-weight: 600; }
.li-sub { font-size: .875rem; color: var(--sk-ink-2); }
.li-meta { font-size: .875rem; color: var(--sk-ink-2); text-align: right; }
.li-chevron { color: var(--sk-ink-3); flex: 0 0 auto; }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: var(--sk-primary-soft); color: var(--sk-primary); font-weight: 700; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: var(--sk-surface-2); color: var(--sk-ink-2); }
.badge-primary { background: var(--sk-primary-soft); color: var(--sk-primary); }
.badge-success { background: #e2f3ea; color: var(--sk-success); }
.badge-warning { background: #fdf0d8; color: #8a5a00; }
.badge-danger { background: #fbe4e1; color: var(--sk-danger); }

.empty { text-align: center; padding: 40px 16px; color: var(--sk-ink-2); }
.empty-icon { display: inline-flex; padding: 16px; border-radius: 50%; background: var(--sk-surface-2); color: var(--sk-ink-3); margin-bottom: 12px; }
.empty h3 { color: var(--sk-ink); }
.empty .btn { margin-top: 8px; }

.spinner-wrap { display: flex; justify-content: center; padding: 24px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sk-line); border-top-color: var(--sk-primary); animation: sk-spin .8s linear infinite; }
@keyframes sk-spin { to { transform: rotate(360deg); } }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--sk-radius-sm); background: var(--sk-accent-soft); font-size: .92rem; margin-bottom: 12px; }
.notice .icon { flex: 0 0 auto; margin-top: 2px; color: var(--sk-primary); }
.notice-warning { background: #fdf0d8; }
.notice-warning .icon { color: #8a5a00; }
.notice-danger { background: #fbe4e1; }
.notice-danger .icon { color: var(--sk-danger); }

.divider { height: 1px; background: var(--sk-line); margin: 16px 0; border: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(20, 18, 16, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.overlay.is-open { background: rgba(20, 18, 16, .42); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--sk-surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--sk-shadow-lg); transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
  padding-bottom: var(--sk-safe-b);
}
.overlay.is-open .sheet { transform: none; }
.sheet-wide { max-width: 860px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 20px; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.sheet-body { padding: 8px 20px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-actions { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--sk-line); }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .overlay.is-open .sheet { transform: none; opacity: 1; }
}

.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--sk-tabbar-h) + var(--sk-safe-b) + 12px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 480px; padding: 12px 16px; border-radius: 14px; background: #24211e; color: #fff; font-size: .92rem; box-shadow: var(--sk-shadow-lg); opacity: 0; transform: translateY(10px); transition: all .25s; }
.toast.is-in { opacity: 1; transform: none; }
.toast-success .icon { color: #7fd6a8; }
.toast-error { background: #7a1f16; }

/* Druck/Barrierefreiheit */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
