/* xly.me – Design: weiche Pastellfarben (Apricot, Vanilla, Lavendel, Wisteria, Himmelblau), große Rundungen,
   Karten mit leichtem Schatten. Keine externen Schriften oder Dienste (Datenschutz), keine Inline-Styles (CSP). */

:root {
  color-scheme: light;
  --apricot: #ffe1c6;
  --custard: #fff7ae;
  --lavender: #b388eb;
  --wisteria: #8093f1;
  --sky: #72ddf7;

  --bg: #f6f3ff;
  --surface: #ffffff;
  --surface-2: #f1eefc;
  --border: #e3def6;
  --text: #1d1b3f;
  --muted: #5a5880;
  --primary: #4b4fd8;
  --primary-hover: #3e42c2;
  --on-primary: #ffffff;
  --danger: #c4234f;
  --on-danger: #ffffff;
  --focus: #4b4fd8;
  --shadow: 0 1px 2px rgba(40, 30, 110, 0.06), 0 12px 32px rgba(70, 60, 160, 0.10);
  --shadow-sm: 0 1px 2px rgba(40, 30, 110, 0.08);

  --grad-accent: linear-gradient(135deg, var(--wisteria), var(--lavender));
  --grad-page: radial-gradient(60rem 36rem at 8% -10%, rgba(255, 225, 198, 0.9), transparent 60%),
    radial-gradient(54rem 34rem at 100% 0%, rgba(179, 136, 235, 0.35), transparent 60%),
    radial-gradient(50rem 40rem at 60% 110%, rgba(114, 221, 247, 0.35), transparent 60%);

  /* Statusfarben: Fläche + Text, jeweils >= 4,5:1 */
  --ok-bg: #d6f5e6; --ok-fg: #0b5d3b;
  --warn-bg: #fff1b8; --warn-fg: #6b4a00;
  --bad-bg: #ffe1e8; --bad-fg: #9b1c3f;
  --info-bg: #d3f3fc; --info-fg: #0b5c7a;
  --neutral-bg: #ece8fb; --neutral-fg: #3f3d66;
  --accent-bg: #eadffb; --accent-fg: #4a2a8a;

  /* Diagrammfarben (mit dem Palette-Validator geprüft, hell: Fläche #ffffff) */
  --series-1: #4b5bdb;
  --series-2: #cf6a17;
  --series-3: #0d8db5;
  --grid: #e8e4f7;

  --radius: 18px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #12102a;
    --surface: #1c1a3a;
    --surface-2: #25224a;
    --border: #34305e;
    --text: #f1efff;
    --muted: #aaa8d0;
    --primary: #8d9df5;
    --primary-hover: #a5b2ff;
    --on-primary: #12102a;
    --danger: #ff8fa8;
    --on-danger: #12102a;
    --focus: #a5b2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --grad-page: radial-gradient(60rem 36rem at 8% -10%, rgba(128, 147, 241, 0.28), transparent 60%),
      radial-gradient(54rem 34rem at 100% 0%, rgba(179, 136, 235, 0.22), transparent 60%),
      radial-gradient(50rem 40rem at 60% 110%, rgba(114, 221, 247, 0.14), transparent 60%);

    --ok-bg: #123b2a; --ok-fg: #9be8c1;
    --warn-bg: #3d3205; --warn-fg: #ffe98a;
    --bad-bg: #4a1426; --bad-fg: #ffb3c4;
    --info-bg: #0f3a4a; --info-fg: #9fe8fa;
    --neutral-bg: #2e2b57; --neutral-fg: #d3d0f5;
    --accent-bg: #382a63; --accent-fg: #dcc8ff;

    --series-1: #6b7dea;
    --series-2: #c97b33;
    --series-3: #2ca1c6;
    --grid: #2d2a55;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  display: flex;
  flex-direction: column;
}
body.public, body.app { background-color: var(--bg); background-image: var(--grad-page); background-repeat: no-repeat; background-attachment: fixed; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 3vw + 1rem, 2.4rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 6px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo:hover { color: var(--text); }



/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0.55rem 1.15rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none; transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--surface-2); color: var(--primary-hover); }
.btn.danger { background: var(--danger); color: var(--on-danger); }
.btn.danger:hover { filter: brightness(0.92); color: var(--on-danger); }
.btn.sm { min-height: 36px; padding: 0.3rem 0.85rem; font-size: 0.9rem; }
.btn svg, .icon-btn svg, .nav a svg, .nav button svg { width: 18px; height: 18px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger { color: var(--danger); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.card + .card { margin-top: 1.25rem; }
.grid > .card, .detail-grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }
.stack > * + * { margin-top: 1.25rem; }
.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 359px) { .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }

/* Kennzahl-Karten (Stat-Tiles) */
.kpi { display: flex; align-items: center; gap: 0.9rem; padding: 1.1rem 1.2rem; }
.kpi-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; color: var(--text); }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.t1 { background: var(--apricot); color: #5a3510; }
.kpi-icon.t2 { background: var(--custard); color: #5a4d00; }
.kpi-icon.t3 { background: var(--lavender); color: #26104d; }
.kpi-icon.t4 { background: var(--sky); color: #06394a; }
.kpi-label { font-size: 0.85rem; color: var(--muted); }
.kpi-value { font-size: 1.65rem; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 1rem; }
label, .label { display: block; font-weight: 650; margin-bottom: 0.35rem; font-size: 0.95rem; }
input[type=text], input[type=email], input[type=url], input[type=date], input[type=search], textarea, select {
  width: 100%; min-height: 46px; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
input:hover, textarea:hover, select:hover { border-color: var(--wisteria); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 8rem; resize: vertical; }
.hint { color: var(--muted); font-size: 0.875rem; margin-top: 0.3rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.notice { font-size: 0.9rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; margin: 1rem 0; }
.notice a { font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 650; background: var(--neutral-bg); color: var(--neutral-fg); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.badge.accent { background: var(--accent-bg); color: var(--accent-fg); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--lavender); color: #26104d; margin-left: auto; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.break { overflow-wrap: anywhere; min-width: 9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.target { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrap { min-width: 14rem; max-width: 28rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.row-actions.icons { flex-wrap: nowrap; }
td.actions-cell { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty svg { width: 36px; height: 36px; opacity: 0.6; margin-bottom: 0.4rem; }
.table-wrap { container-type: inline-size; -webkit-overflow-scrolling: touch; }
@container (max-width: 760px) {
  table.responsive thead { position: absolute; left: -10000px; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.8rem; padding: 0.35rem 0.5rem; background: var(--surface); }
  table.responsive td { border: 0; padding: 0.35rem 0.4rem; display: flex; gap: 0.75rem; justify-content: space-between; align-items: center; text-align: right; max-width: none; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  table.responsive td::before { content: attr(data-label); font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: left; flex: none; }
  table.responsive td.target, table.responsive td.break, table.responsive td.wrap { overflow-wrap: anywhere; word-break: break-word; }
  table.responsive td.actions-cell { flex-wrap: wrap; }
  table.responsive .row-actions.icons { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  table.responsive .linkcell { white-space: normal; flex-wrap: wrap; justify-content: flex-end; overflow-wrap: anywhere; }
  table.responsive td[data-label="Aktionen"] { flex-wrap: wrap; }
  table.responsive .row-actions { flex: 1 1 auto; justify-content: flex-end; }
  table.responsive .btn { white-space: normal; text-align: center; }
  table.responsive .badge { white-space: normal; text-align: left; }
}
/* Tabellen mit vielen Spalten wechseln früher zur Kartenansicht */
@container (max-width: 980px) {
  table.responsive.wide thead { position: absolute; left: -10000px; }
  table.responsive.wide, table.responsive.wide tbody, table.responsive.wide tr, table.responsive.wide td { display: block; width: 100%; }
  table.responsive.wide tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.8rem; padding: 0.35rem 0.5rem; background: var(--surface); }
  table.responsive.wide td { border: 0; padding: 0.35rem 0.4rem; display: flex; gap: 0.75rem; justify-content: space-between; align-items: center; text-align: right; max-width: none; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  table.responsive.wide td::before { content: attr(data-label); font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: left; flex: none; }
  table.responsive.wide td.target, table.responsive.wide td.break, table.responsive.wide td.wrap { overflow-wrap: anywhere; word-break: break-word; }
  table.responsive.wide td.actions-cell { flex-wrap: wrap; }
  table.responsive.wide .row-actions.icons { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  table.responsive.wide .linkcell { white-space: normal; flex-wrap: wrap; justify-content: flex-end; overflow-wrap: anywhere; }
  table.responsive.wide td[data-label="Aktionen"] { flex-wrap: wrap; }
  table.responsive.wide .row-actions { flex: 1 1 auto; justify-content: flex-end; }
  table.responsive.wide .btn { white-space: normal; text-align: center; }
  table.responsive.wide .badge { white-space: normal; text-align: left; }
}

/* ---------- Dialoge und Hinweise ---------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(92vw, 30rem); }
dialog::backdrop { background: rgba(18, 16, 42, 0.55); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 0.4rem; }
dialog .actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.2rem; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: 0.6rem; width: min(92vw, 24rem); }
.toast { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 0.75rem 0.9rem; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: #2e9b6a; }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 0.25rem; }
.msg { margin: 1rem 0; padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-fg); font-weight: 550; }
.msg.error { background: var(--bad-bg); color: var(--bad-fg); }
.msg.ok { background: var(--ok-bg); color: var(--ok-fg); }
.copybox { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.copybox input { flex: 1 1 16rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

/* ---------- Öffentliche Seiten ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem clamp(1rem, 4vw, 2.5rem); }
.site-nav { display: flex; align-items: center; gap: 0.5rem; }
.container { width: 100%; max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.container.wide { max-width: 72rem; }
.container.text { max-width: 48rem; }
.hero { text-align: center; padding: clamp(2rem, 9vh, 6rem) 0 2rem; }
.hero .pill { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.875rem; font-weight: 600; box-shadow: var(--shadow-sm); margin-bottom: 1.2rem; color: var(--muted); }
.hero h1 { font-size: clamp(2.4rem, 7vw + 0.5rem, 4.2rem); letter-spacing: -0.035em; margin-bottom: 1rem; }
.grad-text { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 34rem; margin: 0 auto 1.8rem; }
.hero .actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.panel-narrow { max-width: 30rem; margin: 2rem auto 0; }
.center { text-align: center; }
.big-icon { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 22px; display: grid; place-items: center; background: var(--grad-accent); color: #fff; box-shadow: var(--shadow); }
.big-icon svg { width: 34px; height: 34px; }
.big-icon.warn { background: linear-gradient(135deg, var(--apricot), var(--custard)); color: #5a3510; }
.prose h2 { margin-top: 1.8rem; font-size: 1.15rem; }
.prose p, .prose li { color: var(--text); }
.site-footer { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; padding: 1.2rem 1rem 1.6rem; color: var(--muted); font-size: 0.9rem; }
.site-footer a { color: var(--muted); font-weight: 600; text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }

/* ---------- App-Layout (Dashboard, Admin) ---------- */
.app-shell { display: grid; grid-template-columns: 17rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; width: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: 1.2rem; background: var(--surface); border-right: 1px solid var(--border); }
.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.7rem 0.9rem; border-radius: 14px; border: 0; background: none;
  color: var(--muted); font: inherit; font-weight: 650; text-align: left; cursor: pointer; text-decoration: none; min-height: 44px;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"], .nav button[aria-current="page"] { background: var(--grad-accent); color: #1a1040; }
.nav .spacer { flex: 1; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.userchip { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-accent); color: #1a1040; display: grid; place-items: center; font-weight: 800; flex: none; }
.userchip .who { min-width: 0; }
.userchip .who strong, .userchip .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .who span { font-size: 0.8rem; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.main-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 0.4rem; }
.main-head h1 { font-size: 1.6rem; margin: 0; }
.crumb { font-size: 0.85rem; color: var(--muted); }
.main-body { padding: 1rem clamp(1rem, 3vw, 2.2rem) 2rem; flex: 1; }
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 0.8rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; padding-bottom: 0.2rem; }
  .nav a, .nav button { width: auto; white-space: nowrap; padding: 0.55rem 0.8rem; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .userchip .who { display: none; }
}

/* ---------- Diagramme ---------- */
.chart { position: relative; }
.chart svg { display: block; max-width: none; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font: 0.78rem var(--font); }
.chart .bar { fill: var(--series-1); }
.chart .bar.s2 { fill: var(--series-2); }
.chart .bar.s3 { fill: var(--series-3); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar-hit:focus-visible + .bar { filter: brightness(1.15); }
.chart .bar-hit:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.tooltip { position: absolute; z-index: 5; pointer-events: none; max-width: 90%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 0.4rem 0.65rem; font-size: 0.85rem; transform: translate(-50%, -110%); white-space: nowrap; }
.tooltip strong { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tooltip span { color: var(--muted); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.875rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 0.4rem; vertical-align: -1px; }
.legend i.s1 { background: var(--series-1); }
.legend i.s2 { background: var(--series-2); }
.legend i.s3 { background: var(--series-3); }
.meter-row { display: grid; grid-template-columns: minmax(6rem, 14rem) 1fr auto; gap: 0.75rem; align-items: center; padding: 0.3rem 0; font-size: 0.92rem; }
.meter-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > b { display: block; height: 100%; border-radius: 999px; background: var(--series-1); min-width: 3px; }
.meter > b.s2 { background: var(--series-2); }
.meter > b.s3 { background: var(--series-3); }
details.table-view summary { cursor: pointer; font-weight: 650; color: var(--primary); margin-top: 0.8rem; }
.detail-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); margin-top: 1.25rem; }
.logo-img { width: 34px; height: 34px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.card h3 { margin: 1.4rem 0 0.5rem; }
.card h3:first-child { margin-top: 0; }
.linkcell { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.linkcell .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.linkcell .icon-btn svg { width: 15px; height: 15px; }
.site-nav .btn { white-space: nowrap; }
@media (max-width: 420px) { .site-header { padding-inline: 0.8rem; } .site-nav .btn.sm { padding-inline: 0.7rem; } }
.item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: 0.9rem; background: var(--surface); }
.item-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.item-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 0.6rem; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0 0 0.9rem; font-size: 0.92rem; }
.meta dt { color: var(--muted); font-weight: 650; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
#link-search { flex: 1 1 22rem; max-width: 30rem; flex-wrap: nowrap; }
td.target { max-width: 12rem; }

/* ---------- Responsive-Feinschliff ---------- */
.site-header { flex-wrap: wrap; padding-top: max(1.1rem, env(safe-area-inset-top)); }
.sidebar { padding-top: max(1.2rem, env(safe-area-inset-top)); }
.site-footer { padding-bottom: calc(1.6rem + env(safe-area-inset-bottom)); }
.toasts { bottom: max(1rem, env(safe-area-inset-bottom)); right: max(1rem, env(safe-area-inset-right)); }
.main-head, .main-body { width: 100%; max-width: 92rem; margin-inline: auto; }
dialog { max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
img, svg { max-width: 100%; }
.hero h1, .big-icon + h1, h1, h2 { overflow-wrap: anywhere; }
@media (min-width: 1800px) { html { font-size: 112.5%; } }
@media (min-width: 2400px) { html { font-size: 125%; } }
@media (max-width: 1100px) { .app-shell { grid-template-columns: 14.5rem minmax(0, 1fr); } .sidebar { padding-inline: 0.7rem; } }
@media (max-width: 880px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; overflow: visible; }
}
@media (max-width: 480px) {
  .card { padding: 1.1rem; border-radius: 16px; }
  .main-head { padding-top: 1rem; }
  .hero { padding-top: 2.5rem; }
  .kpi { padding: 0.9rem; }
  .kpi-value { font-size: 1.45rem; }
  .meter-row { grid-template-columns: minmax(5rem, 9rem) 1fr auto; gap: 0.5rem; font-size: 0.88rem; }
  .toasts { left: 0.75rem; right: 0.75rem; width: auto; }
  dialog { padding: 1.2rem; }
  dialog .actions .btn { flex: 1 1 8rem; }
}
@media (max-width: 420px) { .userchip { display: none; } }
@media (max-width: 340px) {
  .site-header { padding-inline: 0.6rem; }
  .container { padding-inline: 0.6rem; }
  .btn { padding-inline: 0.9rem; }
  .logo { font-size: 1.1rem; }
}
/* Kurze Bildschirme (Handy quer): Inhalt vor Rahmen */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { padding-top: 1rem; padding-bottom: 1rem; }
  .panel-narrow { margin-top: 0.5rem; }
  .big-icon { width: 52px; height: 52px; margin-bottom: 0.5rem; }
  .big-icon svg { width: 26px; height: 26px; }
}
/* Touch-Geräte und schmale Fenster: große Tippflächen (>= 44 px) */
@media (pointer: coarse), (max-width: 880px) {
  .btn, button.btn { min-height: 48px; }
  .btn.sm { min-height: 44px; padding-inline: 1rem; }
  .icon-btn { width: 44px; height: 44px; }
  .linkcell .icon-btn { width: 44px; height: 44px; }
  .linkcell .icon-btn svg { width: 18px; height: 18px; }
  .nav a, .nav button { min-height: 48px; }
  input[type=text], input[type=email], input[type=url], input[type=date], input[type=search], select { min-height: 48px; }
  .site-footer a { display: inline-block; padding: 0.7rem 0.4rem; }
  .hint, .notice a, p a { padding-block: 0.1rem; }
  details.table-view summary { padding: 0.7rem 0; }
  .chart .bar-hit { min-width: 12px; }
  .toast button { min-width: 44px; min-height: 44px; }
}
/* Hover nur auf Geräten mit Maus/Trackpad */
@media (hover: none) {
  tbody tr:hover { background: transparent; }
  .btn:hover { background: var(--primary); }
  .btn.secondary:hover { background: var(--surface); }
}
/* Windows-Kontrastmodus */
@media (forced-colors: active) {
  .btn, .icon-btn, .badge, .card, .item, dialog { border: 1px solid CanvasText; }
  .chart .bar, .meter > b { fill: Highlight; background: Highlight; forced-color-adjust: none; }
  .nav a[aria-current="page"], .nav button[aria-current="page"] { outline: 2px solid Highlight; }
}
/* Drucken (z. B. Impressum, Datenschutzerklärung) */
@media print {
  body, body.public, body.app { background: #fff !important; color: #000; display: block; padding: 0; }
  .site-header, .site-footer, .sidebar, .toasts, .btn, .hero .actions { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  a { color: #000; text-decoration: underline; }
  .container.text { max-width: none; }
}
.nav { scrollbar-width: none; scroll-snap-type: x proximity; }
.nav::-webkit-scrollbar { display: none; }
.nav > * { scroll-snap-align: start; }
