/* EULEN MEDIA Studio – Gestaltung wie in der App: warmes Off-White bzw. Anthrazit, kräftige Überschriften,
   Orange nur für Hauptaktionen und Zustände. Wenig Kästen, viel Ruhe, kurze und dezente Bewegungen. */

:root {
  --bg: #f6f2ee;
  --surface: #ffffff;
  --surface-2: #f3eee8;
  --ink: #1e1c1b;
  --ink-soft: #3d3936;
  --muted: #6e6966;
  --line: rgba(30, 28, 27, 0.08);
  --line-strong: rgba(30, 28, 27, 0.14);
  --accent: #e78408;
  --accent-strong: #d97a00;
  --accent-soft: rgba(231, 132, 8, 0.12);
  --accent-ink: #141313;
  --ok: #1f9d55;
  --ok-bg: rgba(31, 157, 85, 0.12);
  --warn: #b0630a;
  --warn-bg: rgba(231, 132, 8, 0.14);
  --err: #d8392a;
  --err-bg: rgba(216, 57, 42, 0.1);
  --radius: 22px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(77, 44, 3, 0.04), 0 12px 32px -12px rgba(77, 44, 3, 0.12);
  --sidebar: 248px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* Dunkel: automatisch nach System – außer man hat „Hell“ gewählt – oder fest per „Dunkel“ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141313;
    --surface: #222121;
    --surface-2: #2a2828;
    --ink: #e6e4e2;
    --ink-soft: #c4c1be;
    --muted: #9a9999;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.13);
    --accent: #e78408;
    --accent-strong: #efbc7c;
    --accent-soft: rgba(231, 132, 8, 0.16);
    --ok: #4cc97a;
    --ok-bg: rgba(76, 201, 122, 0.14);
    --warn: #efbc7c;
    --warn-bg: rgba(239, 188, 124, 0.14);
    --err: #ff6b5b;
    --err-bg: rgba(255, 107, 91, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141313;
  --surface: #222121;
  --surface-2: #2a2828;
  --ink: #e6e4e2;
  --ink-soft: #c4c1be;
  --muted: #9a9999;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --accent: #e78408;
  --accent-strong: #efbc7c;
  --accent-soft: rgba(231, 132, 8, 0.16);
  --ok: #4cc97a;
  --ok-bg: rgba(76, 201, 122, 0.14);
  --warn: #efbc7c;
  --warn-bg: rgba(239, 188, 124, 0.14);
  --err: #ff6b5b;
  --err-bg: rgba(255, 107, 91, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

body {
  font: 15px/1.55 var(--font);
  letter-spacing: -0.003em;
  background:
    radial-gradient(900px 500px at 100% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3 { letter-spacing: -0.02em; }

/* ---------- Bedienelemente ---------- */
.btn { border-radius: 999px; font-weight: 650; transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease), opacity 0.15s; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-secondary { background: transparent; border-color: var(--line-strong); }
.btn-secondary:not(:disabled):hover { border-color: var(--ink-soft); background: var(--surface-2); }
.btn-danger { background: var(--err-bg); color: var(--err); }
.btn-danger:not(:disabled):hover { background: color-mix(in srgb, var(--err) 18%, transparent); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], input[type="url"], input[type="datetime-local"], textarea, select {
  background: var(--surface-2);
  border-color: transparent;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card { border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.badge-muted { border: 0; }
.studio { color: var(--accent); font-style: italic; font-weight: 800; }

/* Umschalter wie in iOS */
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span {
  width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong);
  transition: background 0.2s var(--ease);
  position: relative;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.link-btn {
  border: 0; background: none; padding: 0; color: var(--accent-strong); font: 600 0.9rem var(--font); cursor: pointer;
}
.link-btn::after { content: " →"; transition: margin 0.15s var(--ease); }
.link-btn:hover::after { margin-left: 3px; }

/* ---------- Seitenrahmen: Leiste links ---------- */
.studio-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.75rem;
  padding: 1.5rem 1rem 1rem;
  border-right: 1px solid var(--line);
}
.sb-brand { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.5rem; }
.sb-brand img { border-radius: 10px; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 60%, transparent); }
.sb-brand-text { display: grid; line-height: 1.15; }
.sb-brand-text strong { font-size: 0.95rem; font-weight: 900; letter-spacing: 0.01em; }
.sb-brand-text .studio { font-size: 0.95rem; }

.sb-nav { display: grid; gap: 2px; margin: 0; }
.sb-nav .tab, .sb-user {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; min-height: 42px; padding: 0.55rem 0.75rem;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-soft); font: 600 0.95rem var(--font); text-align: left; cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}
.sb-nav .tab svg, .sb-logout svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.sb-nav .tab:hover, .sb-user:hover { background: var(--surface-2); color: var(--ink); }
.sb-nav .tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.sb-nav .tab[aria-selected="true"] svg { color: var(--accent); }
.tab-dot { width: 7px; height: 7px; margin-left: auto; background: var(--warn); }

.sb-foot { margin-top: auto; display: flex; align-items: center; gap: 0.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sb-user { flex: 1; min-width: 0; gap: 0.65rem; padding: 0.45rem 0.5rem; }
.sb-user[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 0.8rem; font-weight: 800;
}
.sb-user-text { display: grid; min-width: 0; line-height: 1.25; }
.sb-user-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-text #nav-user-name { color: var(--ink); font-size: 0.9rem; }
.sb-user-text .muted { font-size: 0.78rem; font-weight: 500; }
.sb-logout {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sb-logout:hover { background: var(--err-bg); color: var(--err); }

.studio-shell .main { max-width: 1180px; width: 100%; margin: 0; padding: 2.25rem clamp(16px, 3vw, 2.75rem) 4rem; }

/* ---------- Übersicht ---------- */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.page-head h1 { margin: 0; font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 900; letter-spacing: -0.035em; }
.eyebrow { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: live 2.4s ease-in-out infinite; }
@keyframes live { 50% { opacity: 0.35; } }

/* Zustand: eine ruhige Fläche mit der Form aus der App (unten links spitz) */
.status-panel {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2rem; align-items: center;
  padding: 1.6rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) var(--radius) 6px;
  box-shadow: var(--shadow);
}
.status-main { display: flex; gap: 1rem; align-items: flex-start; }
.status-main h2 { margin: 0 0 0.2rem; font-size: 1.35rem; font-weight: 850; }
.status-main p { margin: 0; }
.status-dot { width: 12px; height: 12px; margin-top: 0.55rem; flex: none; border-radius: 50%; background: var(--muted); position: relative; }
.status-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: inherit; opacity: 0.18; }
.status-panel[data-tone="ok"] .status-dot { background: var(--ok); }
.status-panel[data-tone="warn"] .status-dot { background: var(--accent); }
.status-panel[data-tone="err"] .status-dot { background: var(--err); }
.status-panel[data-tone="err"] { border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.upcoming { margin-top: 0.6rem !important; display: inline-block; padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 0.85rem; font-weight: 600; }

/* Versionen: klein und für sich, unten rechts in der Karte */
.versions {
  grid-column: 1 / -1; justify-self: end; margin: -1.1rem 0 -0.6rem; white-space: pre;
  color: var(--muted); opacity: 0.75; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
}
.versions:empty { display: none; }
.status-nas { display: grid; gap: 0.55rem; padding-left: 2rem; border-left: 1px solid var(--line); }
.status-nas p { margin: 0; }
.nas-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.nas-label { font-weight: 800; }
.pill { display: inline-flex; padding: 0.12rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-err { background: var(--err-bg); color: var(--err); }
.meter { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 0; }
#nas-meter-used { background: var(--accent); transition: width 0.6s var(--ease); }
#nas-meter-reserved { background: color-mix(in srgb, var(--accent) 35%, transparent); transition: width 0.6s var(--ease); }

/* Live: aktuelle Bandbreite, Kurve der letzten 2 Minuten, laufende Dateien */
.live-panel {
  padding: 1.4rem 1.75rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink);
  transition: border-color 0.3s;
}
.live-panel[data-active="true"] { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.live-top { display: grid; grid-template-columns: minmax(180px, auto) minmax(0, 1fr); gap: 2rem; align-items: center; }
.live-now .eyebrow { display: flex; align-items: center; gap: 0.45rem; }
.live-now .live-dot { background: var(--muted); animation: none; }
.live-panel[data-active="true"] .live-now .live-dot { background: var(--accent); animation: live 1.2s ease-in-out infinite; }
.live-rate { display: flex; align-items: baseline; gap: 0.4rem; }
.live-rate strong { font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.05; font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.live-rate span { color: var(--muted); font-weight: 700; }
.live-panel[data-active="false"] .live-rate strong { color: var(--muted); }
.live-now p { margin: 0; }
.live-chart { width: 100%; height: 90px; color: var(--accent); overflow: visible; }
.live-panel[data-active="false"] .live-chart { color: var(--line-strong); }
.live-chart path { transition: d 0.6s var(--ease); }
.live-list { list-style: none; margin: 0; padding: 0; display: grid; }
.live-list:not(:empty) { margin-top: 1.1rem; border-top: 1px solid var(--line); }
.live-list li { display: flex; gap: 0.9rem; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid var(--line); animation: reveal 0.3s var(--ease); }
.live-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.live-kind { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.95rem; }
.live-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; flex: 1; min-width: 0; }
.live-main .live-line { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.82rem; }
.live-main .live-line > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.live-name { font-size: 0.92rem; }
.live-speed, .live-left { flex: none; font-variant-numeric: tabular-nums; }
.live-speed { font-weight: 700; color: var(--accent-strong); }
.live-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.live-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.live-list li.paused .live-kind { background: var(--surface-2); color: var(--muted); font-size: 0; }
.live-list li.paused .live-kind::before { content: ""; width: 5px; height: 13px; border-left: 3.5px solid currentColor; border-right: 3.5px solid currentColor; border-radius: 1px; }
.live-list li.paused .live-bar span { background: var(--line-strong); }
.live-list li.paused .live-name { color: var(--ink-soft); }
.live-list li.paused + li:not(.paused), .live-list li:not(.paused) + li.paused { border-top: 1px dashed var(--line-strong); }

/* Kennzahlen ohne Kästen, mit feinen Trennlinien */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: grid; gap: 0.2rem; padding: 0.25rem 1.75rem; border-left: 1px solid var(--line); }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.kpi strong { font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.05; font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 2.5rem; align-items: start; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.9rem; }
.section-head h2 { margin: 0; font-size: 1.1rem; font-weight: 850; }

/* Letzte Uploads: Bildstreifen + wer, wann, wie viel */
.recent { list-style: none; margin: 0; padding: 0; display: grid; }
.recent-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center;
  width: 100%; padding: 0.85rem 0.6rem; margin: 0 -0.6rem; box-sizing: content-box;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background 0.15s;
}
.recent li:last-child .recent-item { border-bottom: 0; }
.recent-item:hover { background: var(--surface-2); border-radius: var(--radius-sm); }
/* Feste Breite für bis zu 3 Bilder, damit die Namen untereinander bündig stehen */
.strip { display: flex; width: 96px; }
.strip > * {
  width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none;
  background: var(--surface-2); border: 2px solid var(--bg); margin-left: -12px;
  display: grid; place-items: center; color: var(--muted); font-size: 0.85rem;
}
.strip > *:first-child { margin-left: 0; }
.recent-who { display: grid; min-width: 0; }
.recent-who strong, .recent-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-who span { color: var(--muted); font-size: 0.85rem; }
.recent-meta { display: grid; justify-items: end; font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent-meta b { color: var(--ink); font-weight: 700; }
.recent-empty { color: var(--muted); padding: 1rem 0; }

/* Steuerung: Liste mit Umschaltern, Details klappen auf */
.controls {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.control { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: grid; gap: 0.5rem; }
.control:first-child { border-top: 0; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.control-text h3 { margin: 0; font-size: 0.98rem; font-weight: 750; letter-spacing: -0.01em; }
.control-text p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }
.more summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 0.85rem; font-weight: 600; width: max-content;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s var(--ease); }
.more[open] summary::after { transform: rotate(225deg) translate(-2px, 0); }
.more summary:hover { color: var(--ink); }
.more-body { display: grid; gap: 0.75rem; padding-top: 0.75rem; }
.more[open] .more-body { animation: reveal 0.22s var(--ease); }
/* Die Steuerung ist schmal: Felder untereinander, Datumsfelder dürfen schrumpfen */
.more-body .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.more-body input { min-width: 0; width: 100%; box-sizing: border-box; }
.more-row summary { width: 100%; display: flex; justify-content: space-between; color: inherit; }
.more-row summary:hover { color: inherit; }
.saved { color: var(--ok); font-size: 0.85rem; font-weight: 600; }
.control-danger.active { background: var(--err-bg); }
.control-danger.active .control-text h3 { color: var(--err); }
.kill-reason-field input { min-height: 40px; padding: 0.45rem 0.8rem; font-size: 0.9rem; }

/* ---------- Bausteine für alle Seiten ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-panel { display: grid; gap: 1rem; padding: 1.25rem 1.4rem; min-width: 0; }
.form-panel h3 { margin: 0; font-size: 0.98rem; font-weight: 750; }
.form-panel p { margin: 0; }
.list-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.section-title { margin: 0 0 0.75rem; font-size: 1.05rem; font-weight: 850; }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-accent { background: var(--accent-soft); color: var(--accent-strong); }
.btn-ghost { border-radius: 999px; }
.btn-ghost:not(:disabled):hover { background: var(--surface-2); color: var(--ink); }
.btn-ghost-danger { color: var(--err); }
.btn-ghost-danger:not(:disabled):hover { background: var(--err-bg); color: var(--err); }
.field label { font-size: 0.85rem; font-weight: 650; color: var(--ink-soft); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], input[type="url"], input[type="datetime-local"], select {
  min-height: 44px; padding: 0.55rem 0.85rem; font-size: 0.95rem;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 12px;
}
.select-pill { width: auto; min-width: 190px; min-height: 40px; border-radius: 999px; background-color: var(--surface); border: 1px solid var(--line-strong); font-weight: 600; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; border-radius: 16px; }
.page-head .btn { flex: none; }

/* ---------- Kunden ---------- */
.customers-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 2rem; align-items: start; }
.customer-list-pane { position: sticky; top: 1.5rem; display: grid; gap: 0.75rem; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 0.85rem; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { padding-left: 2.4rem; border-radius: 999px; }
.customer-list { gap: 2px; max-height: calc(100vh - 230px); padding: 2px; margin: 0 -2px; }
.customer-list button {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.7rem;
  border: 0; border-radius: var(--radius-sm); background: transparent; box-shadow: none;
  transition: background 0.15s;
}
.customer-list button:hover { background: var(--surface-2); }
.customer-list button[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow); }
.customer-list button[aria-current="true"] .avatar { background: var(--accent); color: #fff; }
.customer-list .avatar { transition: background 0.2s, color 0.2s; }
.customer-list .inactive .avatar { background: var(--surface-2); color: var(--muted); }
.customer-list .inactive .c-name { color: var(--muted); }
.c-text { display: grid; min-width: 0; line-height: 1.3; }
.customer-list .c-name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-list .c-meta { font-size: 0.8rem; }

.customer-detail { display: grid; gap: 2rem; padding: 0; background: none; border: 0; box-shadow: none; animation: rise 0.35s var(--ease) both; }
.detail-head { display: flex; align-items: center; gap: 1rem; }
.detail-head .avatar-lg { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.detail-title { min-width: 0; margin-right: auto; }
.detail-title h2 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 900; letter-spacing: -0.03em; }
.detail-title p { font-size: 0.88rem; overflow-wrap: anywhere; }
.access-block { grid-template-columns: auto minmax(0, 1fr); gap: 1.75rem; padding: 1.4rem; background: var(--surface); border-radius: var(--radius) var(--radius) var(--radius) 6px; }
.qr-box { padding: 10px; border-radius: 16px; box-shadow: 0 0 0 1px var(--line); }
.qr-box img { width: 168px; height: 168px; }
.access-info h3 { font-size: 1.05rem; font-weight: 800; }
.link-row input { min-height: 40px; border-radius: 999px; padding-inline: 1rem; font-size: 0.8rem; color: var(--ink-soft); }
.customer-form { gap: 1rem; }
.customer-form .section-title { margin: 0; }
fieldset.thresholds { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 1rem 0 0; }
fieldset.thresholds legend { padding: 0 0.6rem 0 0; font-size: 0.85rem; font-weight: 750; }
.toggles { overflow: hidden; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.4rem; border-top: 1px solid var(--line); }
.toggle-row:first-child { border-top: 0; }
.detail-placeholder {
  display: grid; place-items: center; align-content: center; gap: 0.75rem; min-height: 360px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted);
}
.detail-placeholder svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.6; }
.detail-placeholder p { margin: 0; max-width: 260px; }

/* ---------- Uploads (Vorgänge zum Aufklappen) ---------- */
.batch-list { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.batch { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.batch:first-child { border-top: 0; }
.batch summary {
  grid-template-columns: auto minmax(0, 1fr) auto auto 14px; gap: 1rem;
  padding: 0.85rem 1.25rem; transition: background 0.15s;
}
.batch summary:hover { background: var(--surface-2); }
.batch[open] summary { border-bottom: 0; }
.chevron { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 0.2s var(--ease); }
.batch[open] .chevron { transform: rotate(45deg); }
.b-badges { gap: 0.3rem; }
.b-body { padding: 0 1.25rem 1.25rem; gap: 0.75rem; animation: reveal 0.22s var(--ease); }
.path-row { gap: 0.6rem; padding: 0.55rem 0.85rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.8rem; }
.path-row .muted { font: 600 0.75rem var(--font); text-transform: uppercase; letter-spacing: 0.04em; }
table.files { font-size: 0.86rem; }
table.files th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.2rem; }
table.files td, table.files th { padding-inline: 0.4rem; }
table.files .badge { border: 0; }
.thumb { width: 44px; height: 44px; border-radius: 10px; }
#customer-uploads .batch summary { padding-inline: 1rem; }

/* ---------- Team ---------- */
.team-list { margin: 0; }
.team-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-row .who { display: grid; min-width: 0; margin-right: auto; line-height: 1.35; }
.team-row .who span { color: var(--muted); font-size: 0.83rem; }
.team-row.inactive { opacity: 0.6; }
.team-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.team-actions { display: flex; gap: 0.15rem; }
.team-actions .btn { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.83rem; color: var(--muted); }
.team-actions .btn-ghost-danger { color: var(--err); }

/* ---------- Protokoll ---------- */
.audit-card { padding: 0; }
table.audit { font-size: 0.87rem; }
table.audit thead th { padding: 0.8rem 1.25rem 0.5rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line); }
table.audit td { padding: 0.6rem 1.25rem; border-bottom: 1px solid var(--line); }
table.audit tbody tr:not(.day-row):hover td { background: var(--surface-2); }
table.audit td.when { width: 1%; font-variant-numeric: tabular-nums; }
table.audit td.who { font-weight: 600; white-space: nowrap; }
table.audit td.what { color: var(--ink-soft); }
table.audit tr.tone-err td.what { color: var(--err); font-weight: 600; }
table.audit tr.day-row td { padding: 1.1rem 1.25rem 0.4rem; background: none; border-bottom: 0; color: var(--ink); font-size: 0.8rem; font-weight: 800; }
table.audit tr.day-row:first-child td { padding-top: 0.75rem; }
.audit-foot { display: flex; justify-content: center; }
.audit-foot:has(#audit-more:not([hidden])) { padding: 1rem; }
#audit-more { margin: 0; }

/* ---------- Mein Konto ---------- */
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.account-side { display: grid; gap: 1.25rem; }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; }
.device-list li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.65rem 0; border-top: 1px solid var(--line); font-size: 0.88rem; }
.device-list li:first-child { border-top: 0; padding-top: 0; }
.device-text { display: grid; min-width: 0; }
.device-text .muted { font-size: 0.8rem; }
.device-dot { width: 8px; height: 8px; margin-top: 0.45rem; flex: none; border-radius: 50%; background: var(--line-strong); }
.device-list li.current .device-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }

/* ---------- Anmeldung ---------- */
.login { background: radial-gradient(700px 420px at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
.login-card {
  width: min(400px, 100%); padding: 2.25rem 2rem 2rem; gap: 1.25rem;
  border-radius: var(--radius) var(--radius) var(--radius) 6px;
  animation: rise 0.45s var(--ease) both;
}
.login-brand img { width: 46px; height: 46px; border-radius: 13px; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.login-step { animation: reveal 0.25s var(--ease); }
.login-step h1 { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.03em; }
.login-card .btn-block { min-height: 46px; }
.login-card .btn-ghost { justify-self: center; width: auto; color: var(--muted); }
#code-form .btn-ghost, #login-restart { justify-self: center; width: auto; }
.setup-qr { border-radius: 16px; box-shadow: 0 0 0 1px var(--line); }

/* ---------- Dialoge ---------- */
dialog {
  width: min(420px, calc(100vw - 32px)); padding: 1.6rem; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
}
dialog[open] { animation: pop 0.24s var(--ease); }
dialog::backdrop { background: rgba(20, 19, 19, 0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog h2 { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 850; }
dialog p { color: var(--ink-soft); margin: 0 0 0.5rem; }
dialog .actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 0.5rem; margin-top: 1.25rem; }
dialog .actions .btn { min-height: 40px; padding: 0.45rem 1.1rem; font-size: 0.92rem; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ---------- Bilder: Profilbilder und Kundenlogos ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Logos oft dunkel oder transparent → immer auf heller Kachel, ganz sichtbar */
.has-logo { background: #fff !important; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08) !important; }
.has-logo img { object-fit: contain; padding: 12%; box-sizing: border-box; }
.customer-list button[aria-current="true"] .avatar.has-logo { box-shadow: 0 0 0 2px var(--accent) !important; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }

.logo-field { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.logo-tile {
  display: grid; place-items: center; width: 72px; height: 72px; flex: none; overflow: hidden; cursor: pointer;
  border-radius: 18px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 1.1rem;
  border: 1.5px dashed var(--line-strong); transition: border-color 0.15s;
}
.logo-tile:hover { border-color: var(--accent); }
.logo-tile.has-logo { border-style: solid; border-color: transparent; }
.logo-tile img { width: 100%; height: 100%; }
.logo-text { display: grid; gap: 0.3rem; min-width: 0; }
.logo-text .button-row { margin-top: 0.2rem; }

/* Mein Konto */
.account-main { display: grid; gap: 1.25rem; align-content: start; }
.profile-row { display: flex; align-items: center; gap: 1rem; }
.profile-text h3 { margin: 0; font-size: 1.2rem; font-weight: 850; }
.avatar-edit { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; }
.avatar-edit .avatar { background: var(--accent); color: #fff; }
.avatar-edit-hint {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 0.72rem; font-weight: 700; opacity: 0; transition: opacity 0.15s;
}
.avatar-edit:hover .avatar-edit-hint, .avatar-edit:focus-visible .avatar-edit-hint { opacity: 1; }

.security { overflow: hidden; }
.security summary { display: flex; align-items: center; gap: 0.9rem; padding: 1.1rem 1.4rem; cursor: pointer; list-style: none; }
.security summary::-webkit-details-marker { display: none; }
.security summary:hover { background: var(--surface-2); }
.security-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); }
.security-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.security-title { display: grid; margin-right: auto; line-height: 1.35; }
.security[open] .chevron { transform: rotate(45deg); }
.security-body { display: grid; animation: reveal 0.22s var(--ease); }
.security-section { display: grid; gap: 0.75rem; padding: 1.1rem 1.4rem; border-top: 1px solid var(--line); }
.security-section h4 { margin: 0; font-size: 0.95rem; font-weight: 750; }
.security-section p { margin: 0; }

/* Upload-Filter: Knopf öffnet ein Panel, aktive Filter als Pillen */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: -0.75rem; }
.filter-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 38px; padding: 0.35rem 0.95rem 0.35rem 0.8rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 650 0.88rem var(--font); cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.filter-toggle:hover { border-color: var(--ink-soft); }
.filter-toggle[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.filter-count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 800; }
.filter-pills { display: contents; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 30px; padding: 0.2rem 0.55rem 0.2rem 0.8rem;
  border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font: 650 0.8rem var(--font); cursor: pointer;
  animation: reveal 0.2s var(--ease);
}
.filter-pill span { font-size: 1rem; line-height: 1; opacity: 0.7; }
.filter-pill:hover span { opacity: 1; }
#filter-hint { margin-left: 0.25rem; }

/* Weich auf- und zuklappen (Höhe animiert über grid-template-rows) */
.filter-collapse { display: grid; grid-template-rows: 0fr; margin-top: -1rem; transition: grid-template-rows 0.35s var(--ease), margin 0.35s var(--ease); }
.filter-collapse.open { grid-template-rows: 1fr; margin-top: 0; }
.filter-inner { overflow: hidden; min-height: 0; }
.filter-panel {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem 1.75rem; padding: 1.25rem 1.4rem;
  opacity: 0; transform: translateY(-6px); transition: opacity 0.25s, transform 0.35s var(--ease);
}
.filter-collapse.open .filter-panel { opacity: 1; transform: none; }
.filter-group { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: start; min-width: 0; }
.filter-group legend { padding: 0; margin-bottom: 0.55rem; color: var(--muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.filter-group:nth-of-type(4) { grid-column: 1 / -1; }
.opt { position: relative; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
  display: grid; gap: 0.05rem; padding: 0.45rem 0.85rem; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.opt b { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.opt small { font-size: 0.74rem; color: var(--muted); }
.opt:hover span { border-color: var(--ink-soft); }
.opt input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.opt input:checked + span b { color: var(--accent-strong); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-switch { padding: 0; border: 0; width: 100%; }
.filter-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-top: -0.5rem; }

/* Drag & Drop für Logo und Profilbild */
.logo-field, .profile-card { transition: background 0.15s, box-shadow 0.15s; border-radius: var(--radius-sm); }
.drop-active { background: var(--accent-soft) !important; box-shadow: 0 0 0 2px var(--accent) inset !important; }
.drop-active .logo-tile { border-color: var(--accent); }
.logo-field { padding: 0.25rem 0.25rem 1rem; margin: -0.25rem -0.25rem 0; }
.check-sm { font-size: 0.82rem; font-weight: 600; gap: 0.45rem; }
.check-sm input { width: 16px; height: 16px; }
.logo-note { margin: 0; font-size: 0.8rem; color: var(--ok); font-weight: 600; }
.link-plain { border: 0; background: none; padding: 0; color: var(--accent-strong); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Versionsnummer unten rechts */
.app-footer { display: flex; justify-content: flex-end; margin-top: 3rem; color: var(--muted); opacity: 0.7; font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.empty-note { padding: 2rem 0; text-align: center; }

/* ---------- Darstellung umschalten ---------- */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.theme-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-width: 34px; height: 30px; padding: 0 0.55rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 0.85rem var(--font); cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-checked="true"] { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--line); }
.theme-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-theme { margin: auto 0.5rem 0; align-self: flex-start; }
.sb-theme + .sb-foot { margin-top: 0.75rem; }
.theme-switch-wide { display: flex; }
.theme-switch-wide button { flex: 1; height: 36px; }
html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ---------- Bewegung ---------- */
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.page > * { animation: rise 0.35s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: 0.04s; }
.page > *:nth-child(3) { animation-delay: 0.08s; }
.page > *:nth-child(4) { animation-delay: 0.12s; }

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

/* ---------- Schmal: Leiste wird zur Kopfzeile ---------- */
@media (max-width: 900px) {
  .studio-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
    padding: 0.6rem 16px; border-right: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  .sb-brand { padding: 0; }
  .sb-brand img { width: 32px; height: 32px; }
  .sb-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .sb-theme { display: none; }
  .sb-theme + .sb-foot { margin: 0 0 0 auto; }
  .sb-user-text { display: none; }
  .sb-nav {
    order: 3; flex: 1 0 calc(100% + 32px); min-width: 0; display: flex; gap: 0.25rem; margin: 0 -16px; padding: 0 16px 0.15rem;
    overflow-x: auto; scrollbar-width: none;
  }
  .sb-nav::-webkit-scrollbar { display: none; }
  .sb-nav .tab { width: auto; flex: none; min-height: 38px; white-space: nowrap; }
  .studio-shell .main { padding-top: 1.5rem; }
  .status-panel { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.25rem; }
  .status-nas { padding: 1.25rem 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .ov-grid { grid-template-columns: 1fr; gap: 2rem; }
  .live-top { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .live-chart { height: 64px; }
  .live-panel { padding: 1.25rem; }
}

@media (max-width: 900px) {
  .customers-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .customer-list-pane { position: static; }
  .customer-list { max-height: 280px; }
  .account-grid { grid-template-columns: minmax(0, 1fr); }
  .batch summary { grid-template-columns: auto minmax(0, 1fr) 14px; }
  .batch summary .b-badges, .batch summary .recent-meta { display: none; }
}

@media (max-width: 760px) {
  .filter-panel { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .page-head { flex-wrap: wrap; align-items: center; }
  .select-pill { min-width: 0; width: 100%; }
  .access-block { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 1.1rem; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .toggle-row, .form-panel { padding-inline: 1.1rem; }
  .team-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0.5rem 0.75rem; }
  .team-pills, .team-actions { grid-column: 2; }
  .team-actions { flex-wrap: wrap; margin-left: -0.7rem; }
  .team-actions .btn { white-space: nowrap; }
  .detail-head .avatar-lg { display: none; }
  /* Protokoll: Zeit + Wer in einer Zeile, darunter was passiert ist */
  table.audit, table.audit tbody { display: block; }
  table.audit thead { display: none; }
  table.audit tr:not(.day-row) { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1rem 0.75rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
  table.audit tr:not(.day-row) td { padding: 0; border: 0; background: none !important; }
  table.audit td.who { white-space: normal; }
  table.audit td.what { grid-column: 2; }
  table.audit tr.day-row { display: block; }
  table.audit tr.day-row td { display: block; padding-inline: 0.9rem; }
  dialog .actions { flex-direction: column; }
  .kpis { grid-template-columns: 1fr; gap: 1rem; }
  .kpi { padding: 0; border-left: 0; }
  .recent-meta { display: none; }
  .page-head .live { display: none; }
}
