:root {
  --bg: #f3f6f8; --panel: #ffffff; --panel-2: #f5f8fa; --text: #052533; --muted: #5d7480; --border: #dce5ea;
  --accent: #ff2567; --accent-ink: #ffffff; --accent-soft: #ffe8ef; --navy: #052533; --ok: #16a34a; --bad: #dc2626; --shadow: 0 1px 2px rgba(5,37,51,.06), 0 4px 16px rgba(5,37,51,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #031923; --panel: #052533; --panel-2: #04202c; --text: #e7eff3; --muted: #8ea9b6; --border: #0e3a4c;
    --accent-soft: #3a0f24; --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.brand { display: flex; align-items: center; line-height: 0; }
.brand .fc-logo { height: 40px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { text-decoration: none; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.sidebar nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
main { padding: 28px 32px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 18px; }
.stat b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 8px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
input[type=color] { padding: 2px; height: 38px; width: 100%; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { flex-direction: row; align-items: center; gap: 4px; border: 1px solid var(--border); padding: 5px 9px; border-radius: 8px; color: var(--text); font-weight: 500; }
.error { color: var(--bad); font-size: 13px; min-height: 1em; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }

dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(620px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(3,25,35,.55); }
dialog header, dialog footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
dialog footer { justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
#modal-body { padding: 4px 18px 10px; max-height: 65vh; overflow: auto; }
#modal-error { padding: 0 18px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-tile { overflow: hidden; }
.media-tile .thumb { aspect-ratio: 16/9; background: #052533; display: block; width: 100%; object-fit: cover; }
.media-tile .meta { padding: 9px 11px; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; }
.media-tile .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); margin-bottom: 18px; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* Playlist editor */
.pl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pl-card { padding: 0; overflow: hidden; cursor: pointer; text-decoration: none; }
.pl-card .preview { position: relative; aspect-ratio: 16/9; }
.pl-card .body { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.editor { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.items { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.item-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.item-row.disabled { opacity: .5; }
.item-row .grip { cursor: grab; color: var(--muted); }
.item-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.item-row .dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-row.drag-over { border-top: 3px solid var(--accent); }
.screen-preview { position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; border: 6px solid #111; box-shadow: var(--shadow); }
.screen-preview .ticker { position: absolute; left: 0; right: 0; bottom: 0; height: 7%; background: var(--accent); color: #111; font-weight: 700; display: flex; align-items: center; padding: 0 12px; font-size: 12px; white-space: nowrap; overflow: hidden; z-index: 3; }
.type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-picker button { padding: 14px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.type-picker button:hover { border-color: var(--accent); }
.type-picker button span { font-size: 22px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }

/* Roles */
body.role-viewer .edit-only, body:not(.role-admin) .admin-only, body:not(.role-owner) .owner-only, body:not(.superadmin) .superadmin-only { display: none !important; }
body.no-org #nav a:not([data-route=platform]), body.no-org #nav .nav-label { display: none; }
#org-switch select { width: 100%; font-weight: 600; }
#org-switch .org-name { font-weight: 700; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.platform-banner { background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.login-card h2 { margin: 0; }
.login-card .link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }
.login-card .note { font-size: 13px; color: var(--muted); }
.qr-box { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }
.qr-box svg { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; font-family: ui-monospace, monospace; font-size: 14px; }
.copy-field { display: flex; gap: 6px; } .copy-field input { flex: 1; font-size: 12px; }
.me { text-decoration: none; display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.me:hover { background: var(--panel-2); }
.me small { color: var(--muted); }

/* Alert */
.alert-card { border-left: 5px solid var(--accent); margin-bottom: 20px; }
.alert-card.live { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.live-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--bad); font-weight: 700; }
.live-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Stats */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 10px 0 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 46px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar b { font-size: 11px; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); color: var(--muted); padding: 7px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 12px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0; flex-direction: row; }
  main { padding: 18px 16px; }
  .editor, .grid2, .form-grid { grid-template-columns: 1fr; }
  .type-picker { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Icons & navigation ---------- */
.ic { flex: none; vertical-align: middle; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; }
.sidebar nav a .ic { opacity: .85; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 14px 12px 4px; }
.sidebar-foot .ext, #logout { display: inline-flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 7px; justify-content: center; text-decoration: none; }
.icon-btn { display: inline-grid; place-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: 13px; margin-bottom: 4px; }
.tic { display: inline-flex; color: var(--accent); }
.ih { display: flex; align-items: center; gap: 8px; }
.small { font-size: 12px; }
.type-picker button span { display: grid; place-items: center; color: var(--accent); }
.media-tile .meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Designs & templates ---------- */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.design-card { overflow: hidden; display: flex; flex-direction: column; }
.design-thumb { position: relative; display: block; background: #031923; cursor: pointer; overflow: hidden; }
.thumb-host { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; }
.thumb-host .dz-stage { pointer-events: none; }
.design-thumb .thumb-host { max-height: 360px; margin: 0 auto; }
.design-open { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-weight: 700; background: rgba(15,23,42,.55); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.design-thumb:hover .design-open { opacity: 1; }
.design-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; }
.design-meta b { display: block; }
.row-actions { display: flex; gap: 2px; }
.tpl-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(15,23,42,.18); }
.design-grid.tpl .design-thumb { aspect-ratio: 16 / 9; display: grid; place-items: center; }
.design-grid.tpl .thumb-host { height: 100%; width: auto; max-width: 100%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { border: 1px solid var(--border); background: var(--panel); color: var(--muted); padding: 7px 14px; border-radius: 99px; font: inherit; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hero-empty { padding: 56px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero-empty h2 { font-size: 22px; }
.hero-empty p { max-width: 520px; margin: 0 0 8px; }
.hero-icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

/* ---------- Shared lists ---------- */
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.list-card { display: flex; align-items: center; gap: 14px; padding: 16px; text-decoration: none; }
.list-card > div { flex: 1; min-width: 0; }
.list-card:hover { border-color: var(--accent); }
.list-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.list-editor { display: grid; grid-template-columns: minmax(420px, 560px) 1fr; gap: 18px; align-items: start; }
.list-editor .card.pad { max-height: calc(100vh - 180px); overflow: auto; }
.list-preview, .brand-preview { overflow: hidden; position: sticky; top: 20px; }
.kind-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind input { display: none; }
.kind span { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px 8px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; color: var(--text); }
.kind span small { color: var(--muted); font-weight: 400; }
.kind input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- Brand kit ---------- */
.brand-layout { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.brand-form { display: flex; flex-direction: column; gap: 12px; }
.brand-logo { display: flex; gap: 14px; align-items: center; }
.brand-logo-prev { width: 120px; height: 80px; border-radius: 12px; border: 1px dashed var(--border); display: grid; place-items: center; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 50% / 14px 14px; color: var(--muted); flex: none; }
.brand-logo-prev img { max-width: 90%; max-height: 80%; object-fit: contain; }
.brand-logo p { margin: 2px 0 8px; }
.theme-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-chip { display: flex; border: 1px solid var(--border); border-radius: 99px; padding: 4px; gap: 2px; background: var(--panel); cursor: pointer; }
.theme-chip i { width: 18px; height: 18px; border-radius: 50%; }
.theme-chip:hover { border-color: var(--accent); }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-in { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px 4px 4px; }
.color-in input { width: 34px; height: 28px; border: 0; padding: 0; background: none; }
.color-in code { font-size: 12px; color: var(--text); }
.seg { display: inline-flex; }

@media (max-width: 900px) {
  .list-editor, .brand-layout { grid-template-columns: 1fr; }
  .nav-label { display: none; }
}

/* playlist item: position and size */
.place-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.place-box .place-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.place-box output { float: right; font-variant-numeric: tabular-nums; opacity: .7; }
.place-box input[type=range] { width: 100%; }
@media (max-width: 700px) { .place-box { grid-template-columns: 1fr; } }

/* Afspelen: full screen playback with hover controls */
.play-ov { position: fixed; inset: 0; z-index: 1000; background: #000; display: grid; place-items: center; cursor: none; }
.play-ov.awake { cursor: default; }
.play-screen { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.play-screen .ticker { position: absolute; left: 0; right: 0; bottom: 0; height: 7%; background: var(--accent, #ff2567); color: #fff; font-weight: 700; display: flex; align-items: center; padding: 0 2%; font-size: 2.2vmin; white-space: nowrap; overflow: hidden; z-index: 3; }
.play-bar { position: absolute; left: 50%; bottom: 28px; transform: translate(-50%, 12px); display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 14px; background: rgba(15, 23, 42, .82); color: #fff; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); z-index: 5; }
.play-ov.awake .play-bar { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.play-bar button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; font-size: 18px; }
.play-bar button:hover { background: rgba(255,255,255,.14); }
.play-info { display: grid; min-width: 140px; max-width: 280px; padding: 0 10px; line-height: 1.25; }
.play-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.play-info small { opacity: .7; font-size: 12px; }
.play-progress { width: 120px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; margin-right: 6px; }
.play-progress i { display: block; height: 100%; width: 0; background: var(--accent, #ff2567); }
@media (max-width: 640px) { .play-progress, .play-info small { display: none; } .play-info { min-width: 0; } }

/* ---------- Media library ---------- */
.ml { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.ml-side { padding: 8px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.ml-folder { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; min-height: 34px; }
.ml-folder:hover { background: var(--panel-2); color: var(--text); }
.ml-folder.sel { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ml-folder.drag-over, .ml-sub.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.ml-folder .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-folder .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ml-folder .icon-btn { padding: 2px 4px; opacity: 0; }
.ml-folder:hover .icon-btn, .ml-folder.sel .icon-btn { opacity: 1; }
.ml-sec { margin: 12px 10px 4px; }
.ml-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.ml-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ml-search { flex: 1 1 240px; flex-direction: row; align-items: center; gap: 0; position: relative; }
.ml-search svg { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.ml-search input { width: 100%; padding-left: 34px; }
.ml-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ml-tags > .muted { display: inline-flex; align-items: center; gap: 4px; margin-right: 2px; }
.ml-tags .chip { padding: 4px 11px; font-size: 13px; }
.ml-tags .chip small { opacity: .7; font-weight: 500; margin-left: 2px; }
.ml-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 600; }
.ml-crumbs a { text-decoration: none; color: var(--muted); }
.ml-crumbs a:last-child { color: var(--text); }
.ml-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ml-sub { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.ml-sub span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-sub:hover { border-color: var(--muted); }
.ml-note { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); margin-bottom: 14px; font-size: 13px; }
.ml-note span { flex: 1; }
.ml-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); margin-bottom: 12px; min-height: 46px; position: sticky; top: 8px; z-index: 5; }
.ml-bulk.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent), var(--shadow); }
.ml-bulk .check { margin-right: 6px; }
.ml-bulk .small-select { padding: 5px 8px; font-size: 13px; }
.ml-drop { padding: 14px; margin-bottom: 14px; }
.media-tile { position: relative; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.media-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.media-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.media-tile.dragging { opacity: .5; }
.media-tile .thumb-wrap { position: relative; }
.media-tile .badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 2px 5px; display: inline-flex; }
.media-tile .tick { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 4px; opacity: 0; transition: opacity .12s; flex-direction: row; }
.media-tile:hover .tick, .media-tile.sel .tick, .ml-bulk.active ~ .media-grid .tick { opacity: 1; }
.media-tile .tick input { margin: 0; cursor: pointer; }
.media-tile .meta .nm { min-width: 0; }
.tile-tags { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 11px 10px; }
.ttag, .ftag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ftag { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.ml-detail { background: #052533; border-radius: 10px; overflow: hidden; display: grid; place-items: center; max-height: 320px; }
.ml-detail img, .ml-detail video { max-width: 100%; max-height: 320px; display: block; }
.tag-picker .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: text; }
.tag-picker .chips input { border: 0; outline: 0; padding: 4px; flex: 1; min-width: 140px; }
.tag-picker .ttag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.tag-picker .sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-picker .sugg .chip { padding: 3px 10px; font-size: 12.5px; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { flex-direction: row; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { border: 1px solid var(--border); padding: 4px 11px; border-radius: 99px; color: var(--muted); font-weight: 600; }
.chip-check input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 860px) {
  .ml { grid-template-columns: 1fr; }
  .ml-side { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .ml-side .ml-sec, .ml-side .ml-sep { display: none; }
  .ml-folder { padding-left: 10px !important; }
}
