/* EMH Screen – Portal. Farben und Abstände als Variablen, hell und dunkel. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e9edf4;
  --border: #e3e7ef;
  --border-strong: #cfd6e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-text: #ffffff;
  --accent-soft: #eef2ff;
  --accent-ring: rgba(79, 70, 229, 0.28);
  --ok: #0f9f6e;
  --ok-soft: #e3f8ef;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px -6px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, 0.28);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar: 248px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e17;
    --surface: #121624;
    --surface-2: #181d2e;
    --surface-3: #20263a;
    --border: #232a3e;
    --border-strong: #303a54;
    --text: #e8ecf6;
    --text-2: #c3cadb;
    --muted: #8a94ad;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-text: #0b0e17;
    --accent-soft: #1d2142;
    --accent-ring: rgba(129, 140, 248, 0.35);
    --ok: #34d399;
    --ok-soft: #0f2d23;
    --warn: #fbbf24;
    --warn-soft: #33270b;
    --danger: #f87171;
    --danger-soft: #3a1717;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
code, kbd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em; }
kbd { background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 34px; height: 34px; stroke-width: 1.5; }

/* ---------------------------------------------------------------- Rahmen */
.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: 6px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); box-shadow: 0 6px 14px -4px rgba(99, 102, 241, 0.6); }
.brand-mark .icon { width: 17px; height: 17px; stroke-width: 2.2; }
.nav-label { padding: 12px 12px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 520; text-decoration: none; transition: background 0.12s, color 0.12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.nav a .count { margin-left: auto; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.8rem; }
.user-chip .who { min-width: 0; line-height: 1.3; }
.user-chip .who strong, .user-chip .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { color: var(--muted); font-size: 0.8rem; }

.main { min-width: 0; padding: 28px clamp(16px, 3.2vw, 44px) 80px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin-top: 4px; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); font-weight: 500; }
.crumb:hover { color: var(--text); text-decoration: none; }

.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .shell.menu-open .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; box-shadow: var(--shadow-lg); }
  .shell.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 11, 20, 0.45); z-index: 30; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; }
  .main { padding-top: 20px; }
}

/* ---------------------------------------------------------------- Bausteine */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.cols-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi .kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.kpi .kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi .kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.kpi .value { font-size: 1.55rem; font-weight: 720; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .value small { font-size: 0.95rem; font-weight: 500; }
.kpi .hint { color: var(--muted); font-size: 0.8rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 4px 12px -4px var(--accent-ring); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.85rem; border-radius: 8px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn.danger-text { color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 620; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 220px; flex: 0 1 320px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 560; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button .n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 620; white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tbody tr { transition: background 0.1s; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 650; background: var(--surface-2); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty h3 { color: var(--text); font-size: 1.05rem; }
.empty p { max-width: 420px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.meter.warn > i { background: var(--warn); }
.meter.danger > i { background: var(--danger); }

/* ---------------------------------------------------------------- Formulare */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 0.85rem; color: var(--text-2); }
.field small { font-size: 0.8rem; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 0 12px; height: 38px; width: 100%; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { padding: 10px 12px; height: auto; resize: vertical; line-height: 1.45; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
input[type="color"] { padding: 3px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { color: var(--danger); margin: 0 0 10px; font-weight: 550; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }
.inline-select { width: auto; height: 32px; max-width: 100%; padding: 0 8px; }
.inline-input { height: 30px; width: 70px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.title-input { height: 44px; max-width: 420px; font-size: 1.35rem; font-weight: 700; border-color: transparent; background: transparent; padding: 0 10px; margin-left: -10px; }
.title-input:hover { border-color: var(--border); }

/* ---------------------------------------------------------------- Dialoge, Menüs, Meldungen */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog.xwide { width: min(1100px, calc(100vw - 32px)); }
dialog[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
dialog::backdrop { background: rgba(8, 11, 20, 0.5); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 16px; font-size: 1.15rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.menu { position: fixed; z-index: 90; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop 0.12s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop 0.18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }

/* Drag & Drop */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 3px dashed var(--accent); border-radius: 18px; margin: 10px;
}
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); font-weight: 650; }
.drag-ghost { opacity: 0.4; }
.drop-line { height: 3px; border-radius: 3px; background: var(--accent); margin: -2px 0; box-shadow: 0 0 0 3px var(--accent-ring); }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 3px; background: var(--accent-soft) !important; }
[draggable="true"] { -webkit-user-drag: element; }

/* ---------------------------------------------------------------- Anmeldung */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: radial-gradient(circle at 20% 20%, #6366f1, transparent 55%), radial-gradient(circle at 80% 70%, #ec4899, transparent 50%), #0b0e17; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 2.4rem; max-width: 460px; line-height: 1.12; }
.login-art p { opacity: 0.8; max-width: 420px; margin-top: 14px; font-size: 1.05rem; }
.login-form { display: grid; place-items: center; padding: 24px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { font-size: 1.5rem; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin-bottom: 24px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------------------------------------------------------------- Screens */
.screen-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.screen-card { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; }
.screen-card:hover { box-shadow: var(--shadow); }
.screen-face { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1e2235, #0d1020); display: grid; place-items: center; color: rgba(255, 255, 255, 0.55); }
.screen-face.portrait .screen-shape { aspect-ratio: 9 / 16; height: 76%; width: auto; }
.screen-shape { width: 62%; aspect-ratio: 16 / 9; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.25); display: grid; place-items: center; font-size: 0.8rem; text-align: center; padding: 6px; overflow: hidden; }
.screen-face .badge { position: absolute; top: 10px; left: 10px; background: rgba(15, 18, 32, 0.75); color: #fff; backdrop-filter: blur(4px); }
.screen-face .badge.ok { background: rgba(15, 159, 110, 0.9); }
.screen-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.screen-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.screen-title strong { font-size: 1rem; display: block; }
.screen-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.8rem; }
.screen-meta span { display: inline-flex; align-items: center; gap: 5px; }
.screen-meta .icon { width: 14px; height: 14px; }
.playlist-strip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: 0.85rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 560; cursor: grab; user-select: none; }
.chip:active { cursor: grabbing; }
.chip .icon { width: 14px; height: 14px; color: var(--accent); }

/* ---------------------------------------------------------------- Medien */
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: box-shadow 0.15s, border-color 0.15s; cursor: pointer; }
.media-card:hover { box-shadow: var(--shadow); }
.media-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.media-card .thumb { position: relative; aspect-ratio: 16 / 10; background: #0d1020; display: grid; place-items: center; overflow: hidden; }
.media-card .thumb img, .media-card .thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-card .kind-tag { position: absolute; bottom: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; background: rgba(10, 12, 22, 0.7); color: #fff; font-size: 0.72rem; font-weight: 600; }
.media-card .kind-tag .icon { width: 12px; height: 12px; }
.media-card .select-box { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 7px; border: 2px solid #fff; background: rgba(10, 12, 22, 0.35); display: grid; place-items: center; opacity: 0; transition: opacity 0.12s; }
.media-card:hover .select-box, .media-card.selected .select-box, .selecting .media-card .select-box { opacity: 1; }
.media-card.selected .select-box { background: var(--accent); border-color: var(--accent); }
.media-card .select-box .icon { width: 13px; height: 13px; color: #fff; stroke-width: 3; }
.media-card .meta { padding: 10px 12px; min-width: 0; }
.media-card .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
.media-card .meta span { color: var(--muted); font-size: 0.78rem; }
.media-card .uses { position: absolute; top: 8px; right: 8px; }
.folder-card .thumb { background: var(--accent-soft); color: var(--accent); }
.folder-card .thumb .icon { width: 54px; height: 54px; stroke-width: 1.3; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; font-weight: 600; }
.crumbs button { border: 1px solid transparent; background: none; color: var(--muted); font: inherit; padding: 4px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.crumbs button:hover { color: var(--text); background: var(--surface-2); }
.crumbs button.current { color: var(--text); cursor: default; }
.crumbs .sep { color: var(--muted); }
.section-label { margin: 6px 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.folder-tree { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.folder-tree label { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.folder-tree label:hover { background: var(--surface-2); }
.folder-tree label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.selection-bar { position: sticky; bottom: 16px; z-index: 10; margin: 18px auto 0; width: fit-content; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--text); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; }
.upload-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 14px; }
.upload-item .meter { grid-column: 1 / -1; height: 6px; }
.lightbox-media { width: 100%; max-height: 60vh; object-fit: contain; background: #0d1020; border-radius: 10px; display: block; }

/* ---------------------------------------------------------------- Playlists */
.playlist-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.playlist-card { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.playlist-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.playlist-card .mosaic { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; aspect-ratio: 16 / 6; background: var(--surface-3); }
.playlist-card .mosaic > div { background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.playlist-card .body { padding: 14px 16px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.editor-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; margin: -12px 0 10px; background: var(--bg); }
.editor-bar .grow { flex: 1; }
.editor-bar .status { color: var(--muted); font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.timeline { display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding: 10px; border-radius: var(--radius); border: 1px dashed transparent; transition: border-color 0.12s, background 0.12s; }
.timeline.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.tl-item { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, border-color 0.12s; }
.tl-item:hover { border-color: var(--border-strong); }
.tl-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tl-item.inactive { opacity: 0.55; }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; height: 100%; }
.grip:active { cursor: grabbing; }
.tl-thumb { width: 64px; height: 40px; border-radius: 7px; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tl-thumb img, .tl-thumb video { width: 100%; height: 100%; object-fit: cover; }
.tl-main { min-width: 0; cursor: pointer; }
.tl-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-main span { color: var(--muted); font-size: 0.8rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl-tools { display: flex; align-items: center; gap: 6px; }
.tl-index { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.library { position: sticky; top: 70px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; overflow: hidden; }
.library .tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); }
.library .tabs button { flex: 1; padding: 9px 6px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.library .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.library .lib-body { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-media { position: relative; border-radius: 9px; overflow: hidden; aspect-ratio: 16 / 10; background: #0d1020; cursor: grab; border: 1px solid var(--border); }
.lib-media img, .lib-media video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.lib-media .add { position: absolute; right: 5px; bottom: 5px; opacity: 0; transition: opacity 0.12s; }
.lib-media:hover .add { opacity: 1; }
.lib-media .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #fff; font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: grab; transition: border-color 0.12s, background 0.12s; }
.template:hover { border-color: var(--accent); background: var(--accent-soft); }
.template .t-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.template strong { display: block; }
.template span { color: var(--muted); font-size: 0.8rem; }
.hint-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 0.82rem; }

.preview-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; display: block; }

.weekday-row { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-row label { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 99px; cursor: pointer; font-weight: 560; font-size: 0.85rem; }
.weekday-row label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.weekday-row input { display: none; }
.section-title { margin: 6px 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
