/* ============================================================
   GianniGio TV · Studio
   ============================================================ */

:root {
  --bg: #09090b;
  --bg-2: #0c0c0f;
  --surface: #111114;
  --surface-2: #17171b;
  --surface-3: #1e1e23;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --text-2: #c4c4cc;
  --muted: #8a8a96;
  --faint: #5c5c66;

  --brand: #ff4d6a;
  --brand-2: #ff8a3d;
  --brand-grad: linear-gradient(135deg, #ff4d6a 0%, #ff6b4f 55%, #ff8a3d 100%);
  --brand-soft: rgba(255, 77, 106, 0.12);
  --brand-ring: rgba(255, 77, 106, 0.35);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.12);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -12px rgba(0,0,0,.6);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.flex-1 { flex: 1; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; font-weight: 600; }
p { margin: 0; }
::selection { background: var(--brand-ring); }

svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26262c; border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- form controls ---------- */

input, select, textarea, button { font: inherit; color: inherit; letter-spacing: inherit; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
input:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
input[type="search"]::-webkit-search-cancel-button { filter: invert(.6); }
textarea { resize: vertical; line-height: 1.5; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 34px; cursor: pointer; }
.select-wrap::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); pointer-events: none;
}

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 34px; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-weight: 500; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 20px -6px rgba(255, 77, 106, .55);
}
.btn-primary:hover { filter: brightness(1.08) saturate(1.05); }
.btn-secondary { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: #26262c; border-color: var(--border-strong); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger-ghost:hover { color: var(--err); background: var(--err-soft); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 44px; font-size: 15px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }

/* checkbox */
.checkbox { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; cursor: pointer; flex: none; }
.checkbox input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.checkbox span {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #3a3a42; background: var(--surface);
  transition: all .15s; display: grid; place-items: center;
}
.checkbox input:checked + span { background: var(--brand); border-color: var(--brand); }
.checkbox input:checked + span::after {
  content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px);
}
.checkbox input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 34px; height: 20px; border-radius: 99px; background: #2a2a31; transition: background .2s; flex: none; }
.switch-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s var(--ease);
}
.switch input:checked + .switch-ui { background: var(--brand); }
.switch input:checked + .switch-ui::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--brand-soft); }

/* segmented */
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.segmented button {
  min-width: 30px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 12.5px; cursor: pointer; transition: all .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--border-strong); }

/* ---------- logo ---------- */

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; letter-spacing: -0.03em; }
.logo b { font-weight: 700; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 1px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-grad); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 6px 16px -4px rgba(255, 77, 106, .6);
}
.logo-mark svg { width: 13px; height: 13px; margin-left: 2px; }
.logo-lg { font-size: 22px; }
.logo-lg .logo-mark { width: 40px; height: 40px; border-radius: 12px; }
.logo-lg .logo-mark svg { width: 17px; height: 17px; }

/* ---------- login ---------- */

.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-visual { position: relative; overflow: hidden; background: #0b0b0e; border-right: 1px solid var(--border); display: flex; align-items: flex-end; padding: 56px; }
.login-glow {
  position: absolute; width: 900px; height: 900px; left: -250px; top: -380px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 77, 106, .35), rgba(255, 138, 61, .12) 45%, transparent 70%);
  filter: blur(20px); animation: drift 14s ease-in-out infinite alternate;
}
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 30% 20%, #000 10%, transparent 70%);
}
@keyframes drift { to { transform: translate(120px, 80px) scale(1.1); } }
.login-copy { position: relative; max-width: 460px; display: grid; gap: 18px; }
.login-copy h1 { font-size: 44px; line-height: 1.05; letter-spacing: -0.04em; margin-top: 28px; }
.login-copy > p { color: var(--text-2); font-size: 16px; }
.login-points { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 12px; color: var(--text-2); }
.login-points li { display: flex; align-items: center; gap: 12px; }
.login-points svg { color: var(--brand); width: 18px; height: 18px; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 18px; }
.login-card h2 { font-size: 26px; margin-bottom: 6px; }
.logo-mobile { display: none; }
.form-error { color: var(--err); min-height: 20px; font-size: 13px; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px; background: var(--bg-2); border-right: 1px solid var(--border);
}
.sidebar .logo { padding: 2px 8px 18px; }
.side-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 6px 10px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset; }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-grad); }
.nav-item.active svg { color: var(--brand); }
.nav-item span { flex: 1; }
.nav-count { font-style: normal; font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--brand); color: #fff; }
.nav-count-muted { background: var(--surface-3); color: var(--muted); }
.side-spacer { flex: 1; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: linear-gradient(135deg, #3b3b45, #24242a); color: var(--text); text-transform: uppercase; }
.side-user-info { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.side-user-info small { color: var(--faint); font-size: 12px; }

.content { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 36px 40px 64px; display: grid; gap: 20px; align-content: start; animation: fadeUp .35s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { font-size: 28px; margin-bottom: 4px; }

.toolbar { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.setting { display: flex; align-items: center; gap: 12px; color: var(--text-2); }

/* ---------- dropzone ---------- */

.dropzone {
  position: relative; border-radius: var(--r-xl); padding: 1px;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              repeating-linear-gradient(90deg, #2c2c33 0 10px, transparent 10px 18px) border-box;
  border: 1.5px dashed #2f2f37;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
  overflow: hidden;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background: radial-gradient(600px 220px at 50% -40%, rgba(255, 77, 106, .14), transparent 70%);
  transition: opacity .2s;
}
.dropzone.over { border-color: var(--brand); transform: scale(1.005); }
.dropzone.over::before { opacity: 1; background: radial-gradient(700px 300px at 50% 0%, rgba(255, 77, 106, .22), transparent 70%); }
.dz-inner { position: relative; padding: 44px 24px 40px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.dz-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--brand);
  box-shadow: 0 10px 30px -10px rgba(255, 77, 106, .5);
}
.dz-icon svg { width: 26px; height: 26px; }
.dropzone.over .dz-icon { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.dz-inner h3 { font-size: 18px; }
.dz-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* ---------- summary ---------- */

.summary { display: grid; gap: 16px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.stat-label svg { width: 14px; height: 14px; }
.stat strong { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--faint); font-size: 12px; }
.summary-progress { display: flex; align-items: center; gap: 14px; }
.summary-progress .progress { flex: 1; }
#sum-pct { font-size: 13px; color: var(--text-2); min-width: 44px; text-align: right; }
.summary-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: inherit; background: var(--brand-grad); transition: width .35s var(--ease); position: relative; overflow: hidden; }
.progress.live > div::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-lg { height: 8px; }
.progress.ok > div { background: var(--ok); }
.progress.err > div { background: var(--err); }

/* ---------- panel / queue ---------- */

.panel { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head strong { font-weight: 600; }

.bulk {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px;
  background: linear-gradient(90deg, rgba(255, 77, 106, .08), rgba(255, 138, 61, .04)); border-bottom: 1px solid rgba(255, 77, 106, .2);
  animation: fadeUp .2s var(--ease);
}
.bulk-count { color: var(--text-2); font-size: 13px; margin-right: 4px; }
.bulk-count b { color: var(--text); }
.bulk .input-icon { flex: 1; min-width: 170px; }
.bulk input { height: 32px; padding-top: 0; padding-bottom: 0; background: var(--surface); }

.qrow {
  display: grid; grid-template-columns: 18px 132px minmax(0, 1fr); gap: 16px; align-items: start;
  padding: 16px 18px; border-bottom: 1px solid var(--border); transition: background .2s;
  animation: fadeUp .3s var(--ease);
}
.qrow:last-child { border-bottom: 0; }
.qrow:hover { background: rgba(255,255,255,.012); }
.qrow > .checkbox { margin-top: 26px; }
.qrow.is-done .q-thumb::after { content: ""; position: absolute; inset: 0; background: rgba(9, 9, 11, .35); }

.q-thumb {
  position: relative; width: 132px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #1c1c22, #141418); border: 1px solid var(--border);
}
.q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadeIn .4s; }
@keyframes fadeIn { from { opacity: 0; } }
.q-thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #3a3a44; }
.q-thumb-ph svg { width: 22px; height: 22px; }
.q-dur {
  position: absolute; right: 5px; bottom: 5px; z-index: 1; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.75); font: 500 10.5px var(--mono); backdrop-filter: blur(4px);
}
.q-dur:empty { display: none; }
.q-thumb .q-done-mark { position: absolute; z-index: 2; inset: 0; display: none; place-items: center; color: var(--ok); }
.qrow.is-done .q-done-mark { display: grid; }
.q-done-mark svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }

.q-main { min-width: 0; display: grid; gap: 10px; }
.q-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.q-file { flex: 1; min-width: 0; }
.q-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { display: flex; gap: 6px; align-items: center; color: var(--faint); font-size: 12.5px; overflow: hidden; white-space: nowrap; }
.q-meta .sep { opacity: .6; }
.q-meta .path { overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
.q-meta .path svg { width: 12px; height: 12px; }
.q-actions { display: flex; gap: 2px; }

.q-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.q-fields .input-icon input { height: 34px; padding-top: 0; padding-bottom: 0; font-size: 13.5px; }
.q-fields .input-icon > svg { width: 14px; height: 14px; }
.q-fields textarea { grid-column: 1 / -1; font-size: 13.5px; }
.q-title input { font-weight: 500; }

.q-progress { display: flex; align-items: center; gap: 12px; min-height: 18px; }
.q-progress .progress { flex: 1; height: 4px; }
.q-pct { font: 500 12px var(--mono); color: var(--text-2); min-width: 46px; text-align: right; }
.q-pct:empty { display: none; }
.q-detail { font-size: 12.5px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.q-detail .err { color: var(--err); white-space: normal; }
.q-detail .mono { color: var(--text-2); }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted);
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ready, .pill.done { background: var(--ok-soft); color: var(--ok); border-color: rgba(52, 211, 153, .2); }
.pill.processing { background: var(--info-soft); color: var(--info); border-color: rgba(96, 165, 250, .2); }
.pill.uploading, .pill.preparing { background: var(--brand-soft); color: #ff7088; border-color: rgba(255, 77, 106, .25); }
.pill.uploading::before, .pill.preparing::before, .pill.processing::before { animation: pulse 1.2s infinite; }
.pill.error { background: var(--err-soft); color: var(--err); border-color: rgba(248, 113, 113, .2); }
.pill.duplicate, .pill.paused { background: var(--warn-soft); color: var(--warn); border-color: rgba(251, 191, 36, .2); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- library ---------- */

.head-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-filters .search { flex: 1; min-width: 240px; }
.lib-filters .select-wrap { width: 210px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }

.card {
  display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s;
  animation: fadeUp .35s var(--ease) both;
}
.lib-grid.static .card, .lib-grid.static .thumb img { animation: none; }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 20px 40px -18px rgba(0,0,0,.8); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1a1a20, #111115); overflow: hidden; }
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.card:hover .thumb img { transform: scale(1.04); }
.thumb::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 35%, transparent 60%, rgba(0,0,0,.55)); pointer-events: none; }
.thumb .pill { position: absolute; left: 10px; top: 10px; z-index: 2; backdrop-filter: blur(8px); background-color: rgba(10,10,12,.7); }
.thumb .dur { position: absolute; right: 10px; bottom: 10px; z-index: 2; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.7); font: 500 11.5px var(--mono); backdrop-filter: blur(6px); }
.thumb .noimg { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--faint); font-size: 12px; }
.thumb .noimg svg { width: 26px; height: 26px; color: #34343c; }
.thumb .play {
  position: absolute; z-index: 2; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.14); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.25); opacity: 0; transform: scale(.85); transition: all .25s var(--ease);
}
.thumb .play svg { width: 18px; height: 18px; margin-left: 3px; }
.card.is-ready .thumb { cursor: pointer; }
.card.is-ready:hover .thumb .play { opacity: 1; transform: scale(1); }
.thumb .enc { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; background: rgba(255,255,255,.08); }
.thumb .enc > div { height: 100%; background: var(--info); transition: width .5s; }

.card-body { padding: 14px 16px 12px; display: grid; gap: 6px; flex: 1; align-content: start; }
.card-title { font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.card-meta svg { width: 13px; height: 13px; }
.card-meta .sep { color: var(--faint); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.card-actions { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-top: 1px solid var(--border); }
.card-actions .spacer { flex: 1; }
.card-actions .date { font-size: 12px; color: var(--faint); padding-left: 6px; }

.empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; padding: 72px 20px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); margin-bottom: 6px; }
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; }

.skeleton { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.skeleton .sk-thumb { aspect-ratio: 16 / 9; }
.skeleton .sk-line { height: 12px; margin: 14px 16px 0; border-radius: 6px; }
.skeleton .sk-line.short { width: 50%; margin-bottom: 18px; }
.sk { background: linear-gradient(90deg, #15151a 0%, #1d1d23 50%, #15151a 100%); background-size: 200% 100%; animation: sk 1.3s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }

.pager { display: flex; gap: 10px; justify-content: center; align-items: center; color: var(--muted); font-size: 13px; }

/* ---------- dialogs ---------- */

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: 0; max-width: calc(100vw - 32px); box-shadow: 0 40px 80px -20px rgba(0,0,0,.8); }
dialog[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog::backdrop { background: rgba(5, 5, 7, .7); backdrop-filter: blur(6px); }
.modal { padding: 22px 24px 24px; display: grid; gap: 16px; width: 540px; max-width: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.modal-head h3 { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.player { width: 1040px; padding: 0; overflow: hidden; background: #000; }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.player-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-frame { position: relative; aspect-ratio: 16 / 9; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- toasts ---------- */

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 280px; max-width: 380px; padding: 12px 14px;
  border-radius: var(--r); background: rgba(24, 24, 28, .92); backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong); box-shadow: 0 16px 40px -12px rgba(0,0,0,.7);
  animation: toastIn .3s var(--ease);
}
.toast svg { margin-top: 2px; color: var(--info); }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--err); }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .q-fields { grid-template-columns: 1fr 1fr; }
  .q-fields .q-title { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .logo-mobile { display: flex; margin-bottom: 12px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); background: rgba(12,12,15,.9); backdrop-filter: blur(12px);
  }
  .sidebar .logo { padding: 0; margin-right: auto; }
  .sidebar .logo > span:last-child, .side-label, .side-spacer, .side-user-info, .avatar { display: none; }
  .nav { display: flex; }
  .nav-item { height: 34px; }
  .nav-item.active::before { display: none; }
  .side-user { padding: 0; border: 0; background: none; }

  .page { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 24px; }
  .qrow { grid-template-columns: 18px 96px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .q-thumb { width: 96px; }
  .qrow > .checkbox { margin-top: 16px; }
  .q-fields { grid-column: 2 / -1; }
  .summary-actions .btn-ghost { padding: 0 10px; }
  .lib-filters .select-wrap { width: auto; flex: 1; }
}

@media (max-width: 520px) {
  .nav-item span { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 20px; }
  .q-fields { grid-template-columns: 1fr; }
  .qrow { grid-template-columns: 18px minmax(0, 1fr); }
  .q-thumb { display: none; }
  .settings { gap: 14px; }
  .toasts { left: 16px; right: 16px; }
  .toast { min-width: 0; max-width: none; }
}

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