/* NEBAS CMS – Design-System (Entwurf)
   Warme Neutraltöne, ein Akzent, Bilder liefern die Farbe. */

:root {
  --bg: #f3f2ee;
  --surface: #fbfaf8;
  --raised: #ffffff;
  --ink: #17171a;
  --ink-2: #4a4944;
  --muted: #7b7a74;
  --line: rgba(23, 23, 26, 0.09);
  --line-strong: rgba(23, 23, 26, 0.16);
  --hover: rgba(23, 23, 26, 0.045);
  --accent: #1d6b52;
  --accent-soft: rgba(29, 107, 82, 0.1);
  --warn: #9a6a14;
  --warn-soft: rgba(154, 106, 20, 0.11);
  --danger: #a8382c;
  --star: #f2b90f;
  --shadow: 0 1px 2px rgba(40, 36, 24, 0.05), 0 8px 24px -12px rgba(40, 36, 24, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(40, 36, 24, 0.35);
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101010;
    --surface: #171716;
    --raised: #1e1e1c;
    --ink: #ecebe6;
    --ink-2: #c1c0b9;
    --muted: #8b8a83;
    --line: rgba(255, 255, 250, 0.08);
    --line-strong: rgba(255, 255, 250, 0.16);
    --hover: rgba(255, 255, 250, 0.05);
    --accent: #63c7a2;
    --accent-soft: rgba(99, 199, 162, 0.13);
    --warn: #d9a441;
    --warn-soft: rgba(217, 164, 65, 0.13);
    --danger: #e3776a;
    --star: #ffd45c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #101010;
  --surface: #171716;
  --raised: #1e1e1c;
  --ink: #ecebe6;
  --ink-2: #c1c0b9;
  --muted: #8b8a83;
  --line: rgba(255, 255, 250, 0.08);
  --line-strong: rgba(255, 255, 250, 0.16);
  --hover: rgba(255, 255, 250, 0.05);
  --accent: #63c7a2;
  --accent-soft: rgba(99, 199, 162, 0.13);
  --warn: #d9a441;
  --warn-soft: rgba(217, 164, 65, 0.13);
  --danger: #e3776a;
  --star: #ffd45c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-s);
}
.skip:focus { top: 12px; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100dvh; }

.side {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; letter-spacing: -0.04em;
}
.brand__name { font-weight: 600; letter-spacing: -0.01em; }
.brand__name span { color: var(--muted); font-weight: 400; }

.nav__label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 10px 6px;
  font-size: 12px; color: var(--muted);
}
.nav__add {
  width: 22px; height: 22px; border: 0; border-radius: var(--r-s);
  background: none; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s;
}
.nav__add:hover { background: var(--hover); color: var(--ink); }

.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-s);
  color: var(--ink-2);
  transition: background 0.15s var(--ease), color 0.15s;
}
.nav__item:hover { background: var(--hover); color: var(--ink); }
.nav__item[aria-current='page'] { background: var(--raised); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }
.nav__item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.nav__item .dot.is-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.nav__item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__item .num { font-size: 12px; color: var(--muted); }

.side__foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 10px; padding-inline: 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.side__user { flex: 1; min-width: 0; line-height: 1.25; }
.side__user small { display: block; color: var(--muted); font-size: 12px; }
.icon-btn {
  width: 30px; height: 30px; border: 0; border-radius: var(--r-s);
  background: none; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }

.main { min-width: 0; padding: 28px clamp(20px, 3.4vw, 48px) 80px; }
.main__inner { max-width: 1320px; margin: 0 auto; }

/* ---------- Seitenkopf ---------- */

.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a:hover { color: var(--ink); }
.crumbs svg { opacity: 0.6; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.head h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; text-wrap: balance; }
.head__meta { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.head__actions { display: flex; align-items: center; gap: 8px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 8px 3px 7px; border-radius: 5px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.is-on { color: var(--accent); background: var(--accent-soft); }
.status.is-off { color: var(--warn); background: var(--warn-soft); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--raised); color: var(--ink);
  font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s var(--ease), box-shadow 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--primary:hover { box-shadow: 0 6px 16px -8px var(--ink); }
.btn--quiet { border-color: transparent; background: none; color: var(--ink-2); }
.btn--quiet:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.btn--danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: none; color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.panel__foot { display: flex; justify-content: flex-end; }

.soon { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--hover); color: var(--muted); font-size: 11px; }
.seg.is-disabled { opacity: 0.55; cursor: not-allowed; }
.seg.is-disabled button { cursor: not-allowed; }

/* ---------- Übersicht ---------- */

.stats { display: flex; flex-wrap: wrap; gap: 0; border-block: 1px solid var(--line); margin-bottom: 44px; }
.stat { padding: 18px 40px 18px 0; margin-right: 40px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; margin-right: 0; }
.stat b { display: block; font-family: var(--mono); font-weight: 500; font-size: 30px; letter-spacing: -0.05em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

.shelf { margin-bottom: 44px; }
.shelf__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.shelf__head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.shelf__head .num { color: var(--muted); font-size: 12px; }
.shelf__more { margin-left: auto; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; transition: color 0.15s; }
.shelf__more:hover, .shelf__head h2 a:hover { color: var(--ink); }
.shelf__head h2 a { transition: color 0.15s; }
.shelf__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 220px); gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.shelf__row > * { scroll-snap-align: start; }

/* ---------- Projekt-Karten ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 22px 16px; }

.card { position: relative; display: block; }
.card__img {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-m); background: var(--line);
  box-shadow: inset 0 0 0 1px var(--line);
}
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease), filter 0.3s; }
.card:hover .card__img img { transform: scale(1.035); }
.card__img::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); pointer-events: none; }
.card__empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.card.is-off .card__img img { filter: grayscale(1) opacity(0.55); }

.card__body { display: flex; gap: 10px; padding: 10px 2px 0; }
.card__text { flex: 1; min-width: 0; }
.card__title { font-weight: 500; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__count { color: var(--muted); font-size: 12px; padding-top: 2px; }

.tag {
  position: absolute; left: 8px; top: 8px; z-index: 1;
  font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 4px;
  background: rgba(16, 16, 16, 0.72); color: #f3f2ee; backdrop-filter: blur(8px);
}
.grip {
  position: absolute; right: 8px; top: 8px; z-index: 1;
  width: 26px; height: 26px; border-radius: 6px;
  background: rgba(16, 16, 16, 0.6); color: #fff; backdrop-filter: blur(8px);
  display: grid; place-items: center; cursor: grab;
  opacity: 0; transform: translateY(-2px); transition: opacity 0.15s, transform 0.15s var(--ease);
}
.card:hover .grip, .tile:hover .grip { opacity: 1; transform: none; }

.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--r-l);
  padding: 56px 24px; text-align: center; color: var(--muted);
}
.empty h3 { color: var(--ink); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Projekt-Detail ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; }

.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 14px; font-weight: 600; }
.section-head span { color: var(--muted); font-size: 12.5px; }
.section-head .hint { margin-left: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; }

.tile { position: relative; aspect-ratio: 1; border-radius: var(--r-m); overflow: hidden; background: var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.3s, transform 0.5s var(--ease); }
.tile.is-off img { filter: grayscale(1) opacity(0.4); }
.tile::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07); pointer-events: none; }
.tile.is-cover { outline: 2.5px solid var(--star); outline-offset: 2px; }
.tile__star { position: absolute; left: 7px; top: 7px; z-index: 1; width: 22px; height: 22px; border-radius: 6px; background: var(--star); color: #2b2100; display: none; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.tile.is-cover .tile__star { display: grid; }
.tile.is-cover [data-hidden-tag] { left: 36px; }

.tile__order { position: absolute; left: 8px; bottom: 8px; font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.tile__play {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; background: rgba(16, 16, 16, 0.6); color: #fff; backdrop-filter: blur(8px);
  display: grid; place-items: center; padding-left: 2px; pointer-events: none;
}
.tile__bar {
  position: absolute; right: 6px; bottom: 6px; display: flex; gap: 2px; padding: 2px;
  border-radius: 8px; background: rgba(16, 16, 16, 0.68); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s var(--ease);
}
.tile:hover .tile__bar, .tile:focus-within .tile__bar { opacity: 1; transform: none; }
.tile__bar button {
  width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: #fff; cursor: pointer;
  display: grid; place-items: center; transition: background 0.12s;
}
.tile__bar button:hover { background: rgba(255, 255, 255, 0.18); }
.tile__bar button[aria-pressed='true'] { color: #ffd45c; }

.drop {
  aspect-ratio: 1; border: 1px dashed var(--line-strong); border-radius: var(--r-m);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); font-size: 12.5px; text-align: center; padding: 12px; cursor: pointer; background: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.drop:hover { border-color: var(--ink); color: var(--ink); background: var(--hover); }
.drop b { color: var(--ink); font-weight: 500; font-size: 13px; }

/* ---------- Panel / Formular ---------- */

.panel { position: sticky; top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel__title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.saved { font-weight: 400; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.saved::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label:not(.switch), .field > .label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.row { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }

.input, .select, .rich {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--raised); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover, .select:hover, .rich:hover { border-color: var(--muted); }
.input:focus, .select:focus, .rich:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hover); }
.rich { min-height: 96px; max-height: 220px; overflow-y: auto; line-height: 1.55; font-size: 13.5px; }
.rich p { margin: 0 0 0.5em; }
.rich p:last-child { margin: 0; }

.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 2px; border-radius: 9px; background: var(--hover); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg button[aria-pressed='true'] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-strong); transition: transform 0.12s var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed='true'] { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch[data-bg='white'] { background: #fff; }
.swatch[data-bg='black'] { background: #111; }
.swatch[data-bg='violet'] { background: #b9a7e6; }
.swatch[data-bg='pink'] { background: #f0b6cf; }
.swatch[data-bg='coral'] { background: #f08a72; }
.swatch[data-bg='yellow'] { background: #f2d463; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; }
.switch i { flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; transition: background 0.2s; }
.switch i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.divider { height: 1px; background: var(--line); margin: 18px -20px; }

/* ---------- Slide-over ---------- */

.sheet { position: fixed; inset: 0; z-index: 30; display: flex; justify-content: flex-end; pointer-events: none; }
.sheet__veil { position: absolute; inset: 0; background: rgba(16, 16, 16, 0.32); opacity: 0; transition: opacity 0.25s; }
.sheet__body {
  position: relative; width: min(420px, 100%); height: 100%; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  padding: 24px; transform: translateX(100%); transition: transform 0.3s var(--ease);
}
.sheet.is-open { pointer-events: auto; }
.sheet.is-open .sheet__veil { opacity: 1; }
.sheet.is-open .sheet__body { transform: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sheet__head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- Einblenden ---------- */

@media (prefers-reduced-motion: no-preference) {
  .rise > * { animation: rise 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}

/* ---------- Details unter den Medien ---------- */

.stack { display: grid; gap: 40px; min-width: 0; }
.panel--wide { position: static; padding: 24px; }
.panel--wide .divider { margin-inline: -24px; }
.panel__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 0.9fr); gap: 4px 36px; align-items: start; }
.panel__grid > .field { margin-bottom: 14px; }
.sections { margin-top: 0; }
@media (max-width: 1180px) { .panel__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .panel__grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Medien ein- und ausklappen ---------- */

.fold { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 8px 4px 4px; margin: -4px 0 -4px -4px; border-radius: var(--r-s); cursor: pointer; align-self: center; transition: background 0.15s; }
.fold:hover { background: var(--hover); }
.fold svg { color: var(--muted); transition: transform 0.2s var(--ease); }
.media.is-collapsed .fold svg { transform: rotate(-90deg); }
.media.is-collapsed .tiles, .media.is-collapsed .hint { display: none; }
.media.is-collapsed .section-head { margin-bottom: 0; }
.media.is-collapsed { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.stack:has(.media.is-collapsed) { gap: 24px; }

/* ---------- Grossansicht ---------- */

.viewer { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12, 12, 12, 0.94); color: #ecebe6; }
.viewer[open] { display: grid; grid-template: auto minmax(0, 1fr) / 64px minmax(0, 1fr) 64px; animation: fade 0.2s var(--ease); }
.viewer::backdrop { background: transparent; }
@keyframes fade { from { opacity: 0; } }
.viewer__bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 22px; font-size: 13px; }
.viewer__count { color: #fff; }
.viewer__meta { color: #a3a29b; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background 0.15s, transform 0.1s; }
.viewer__btn:hover { background: rgba(255, 255, 255, 0.18); }
.viewer__btn:active { transform: scale(0.94); }
.viewer__nav { align-self: center; justify-self: center; width: 40px; height: 40px; }
.viewer__stage { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 4px 0 28px; cursor: zoom-out; }
.viewer__stage img { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 6px; cursor: default; animation: fade 0.25s var(--ease); }
.viewer__video { aspect-ratio: 16 / 9; width: 100%; max-height: 100%; max-width: min(100%, calc((100dvh - 110px) * 16 / 9)); background: #000; border-radius: 8px; overflow: hidden; cursor: default; }
.viewer__video.is-tall { width: auto; height: 100%; max-width: 100%; max-height: calc(100dvh - 110px); }
.viewer__video iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 700px) { .viewer[open] { grid-template-columns: 48px minmax(0, 1fr) 48px; } }

/* ---------- Drag and drop ---------- */

.grid[data-sortable] .card { cursor: grab; -webkit-user-drag: none; user-select: none; }
.is-sorting, .is-sorting * { cursor: grabbing !important; user-select: none; }
.is-sorting .tile__bar, .is-sorting .grip { display: none; }
.is-sorting .card:hover .card__img img { transform: none; }
.tile.is-ghost, .card.is-ghost .card__img { opacity: 1; outline: 1.5px dashed var(--line-strong); outline-offset: -1px; background: var(--hover); box-shadow: none; }
.tile.is-ghost > *, .card.is-ghost .card__img > *, .card.is-ghost .card__body { opacity: 0; }
.is-dragging { opacity: 1 !important; z-index: 80; border-radius: var(--r-m); box-shadow: var(--shadow-lg); transform-origin: center; animation: lift 0.18s var(--ease) forwards; pointer-events: none; }
.is-dragging.tile { outline: 0; }
@keyframes lift { to { scale: 1.045; rotate: 1.2deg; } }

/* ---------- Kleinteile ---------- */

[hidden] { display: none !important; }

.nav__empty { padding: 4px 10px; color: var(--muted); font-size: 12.5px; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.empty--slim { padding: 24px; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.empty--slim .btn { margin-top: 0; }
.input.is-invalid { border-color: var(--danger); }

.saved[data-kind='busy']::before { background: var(--warn); }
.saved[data-kind='error'] { color: var(--danger); }
.saved[data-kind='error']::before { background: var(--danger); }
.sheet__head .saved { margin-left: auto; margin-right: 8px; }

.btn:disabled { opacity: 0.5; cursor: default; }
.btn--destructive { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Medien-Zustände ---------- */

.media { min-width: 0; }
.tile { margin: 0; cursor: grab; }
.tile.is-chosen { cursor: grabbing; }
.tile__bar .slash { display: none; }
.tile__bar [data-act='toggle'][aria-pressed='true'] { color: #fff; }
.tile__bar [data-act='toggle'][aria-pressed='true'] .slash { display: inline; }
.tile__bar [data-act='cover'][aria-pressed='true'] svg { fill: currentColor; }

.tile__wait { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; text-align: center; padding: 10px; color: var(--muted); font-size: 12px; background: var(--surface); }
.tile.is-wait .tile__wait { display: flex; }
.tile.is-wait .tile__play { display: none; }

.tile.is-uploading { cursor: default; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; gap: 2px; }
.tile.is-uploading img { position: absolute; inset: 0; opacity: 0.35; filter: blur(2px); }
.tile__name, .tile__state { position: relative; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__name { font-weight: 500; }
.tile__state { color: var(--muted); }
.tile__progress { position: relative; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.tile__progress i { position: absolute; inset: 0; background: var(--accent); transform: scaleX(0.02); transform-origin: left; transition: transform 0.25s var(--ease); }
.tile.is-failed { cursor: pointer; }
.tile.is-failed .tile__state { color: var(--danger); }
.tile.is-failed .tile__progress i { background: var(--danger); }

.dropveil { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity 0.2s; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(6px); }
.dropveil.is-on { opacity: 1; }
.dropveil > div { border: 1.5px dashed var(--ink); border-radius: var(--r-l); padding: 44px 64px; text-align: center; }
.dropveil b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.dropveil span { color: var(--muted); }

/* ---------- Toasts und Dialoge ---------- */

.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { max-width: 380px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-lg); animation: toast-in 0.25s var(--ease); transition: opacity 0.25s, transform 0.25s; }
.toast--error { background: var(--danger); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.dlg { width: min(400px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgba(16, 16, 16, 0.36); backdrop-filter: blur(2px); }
.dlg[open] { animation: toast-in 0.2s var(--ease); }
.dlg h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.dlg__text { color: var(--ink-2); margin-bottom: 4px; text-wrap: pretty; }
.dlg .field { margin-top: 12px; }
.dlg__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Text-Editor (Quill) ---------- */

.rich.ql-container { padding: 0; border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 8px 8px; font: inherit; font-size: 13.5px; max-height: none; overflow: visible; }
.rich.ql-container:hover, .rich.ql-container:focus-within { border-color: var(--line-strong); box-shadow: none; }
.ql-toolbar.ql-snow { border: 1px solid var(--line-strong); border-radius: 8px 8px 0 0; background: var(--hover); padding: 5px 6px; font-family: inherit; }
.ql-snow .ql-editor { min-height: 96px; max-height: 260px; overflow-y: auto; padding: 10px 12px; line-height: 1.55; }
.rich--tall .ql-editor { min-height: 150px; max-height: 420px; }
.ql-snow .ql-editor h1 { font-size: 1.5em; font-weight: 600; letter-spacing: -0.02em; }
.ql-snow .ql-editor h5 { font-size: 1em; font-weight: 500; color: var(--ink-2); }
.ql-snow .ql-stroke { stroke: var(--ink-2); }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--ink-2); }
.ql-snow .ql-picker { color: var(--ink-2); }
.ql-snow .ql-picker-options { background: var(--raised); border-color: var(--line-strong) !important; border-radius: 8px; }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke, .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke { stroke: var(--accent); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }
.ql-snow.ql-toolbar .ql-picker-label:hover, .ql-snow.ql-toolbar .ql-picker-item:hover, .ql-snow.ql-toolbar .ql-picker-label.ql-active, .ql-snow.ql-toolbar .ql-picker-item.ql-selected { color: var(--accent); }
.ql-snow .ql-tooltip { background: var(--raised); color: var(--ink); border-color: var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); z-index: 5; }
.ql-snow .ql-tooltip input[type='text'] { background: var(--surface); color: var(--ink); border-color: var(--line-strong); border-radius: 6px; }
.ql-snow a { color: var(--accent); }

/* ---------- Anmeldung ---------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth__card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; box-shadow: var(--shadow); }
.auth__card .brand { padding: 0 0 28px; }
.auth__card h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.035em; }
.auth__lead { color: var(--muted); margin: 4px 0 22px; text-wrap: pretty; }
.auth__error { color: var(--danger); font-size: 13px; margin: -4px 0 12px; }
.auth__submit { width: 100%; justify-content: center; height: 38px; margin-top: 6px; }

/* ---------- Schmal ---------- */

.menu-btn { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 40; left: 0; width: 280px; background: var(--bg);
    transform: translateX(-100%); transition: transform 0.3s var(--ease); box-shadow: var(--shadow-lg);
  }
  .side.is-open { transform: none; }
  .menu-btn { display: grid; margin-bottom: 12px; margin-left: -6px; }
  .main { padding-top: 16px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
  .stat { padding-right: 24px; margin-right: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
