:root {
  --bg: #0b0c10;
  --bg-2: #101218;
  --panel: #14171f;
  --panel-2: #1b1f29;
  --panel-3: #232836;
  --line: #262b38;
  --line-2: #323949;
  --text: #eef0f5;
  --muted: #8b93a7;
  --faint: #5d6478;
  --accent: #ff4d6d;
  --accent-2: #ff8a3d;
  --accent-soft: rgba(255, 77, 109, .14);
  --good: #2fd27f;
  --good-soft: rgba(47, 210, 127, .14);
  --bad: #ff6b7d;
  --bad-soft: rgba(255, 107, 125, .12);
  --warn: #f6c049;
  --warn-soft: rgba(246, 192, 73, .14);
  --info: #6aa8ff;
  --info-soft: rgba(106, 168, 255, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2);
  background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 13px; cursor: pointer; white-space: nowrap;
  text-decoration: none; font-weight: 500; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--good-soft); border-color: rgba(47, 210, 127, .35); color: var(--good); }
.btn.good:hover { background: rgba(47, 210, 127, .22); }
.btn.bad { background: var(--bad-soft); border-color: rgba(255, 107, 125, .32); color: var(--bad); }
.btn.bad:hover { background: rgba(255, 107, 125, .2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.icon { padding: 8px; width: 36px; height: 36px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
input, select, textarea { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
label.check input { width: auto; accent-color: var(--accent); }
kbd { font: 600 11px/1 var(--font); background: var(--panel-3); border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 5px; padding: 3px 6px; color: var(--muted); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(255, 77, 109, .18), transparent 70%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 28px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; font-size: 24px; }
.login-card p { margin: -6px 0 6px; text-align: center; }
.login-card .btn { padding: 11px; }
.error { color: var(--bad); min-height: 1em; margin: 0; font-size: 13.5px; }

/* ---------- header ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px rgba(255, 77, 109, .35); }
header { position: sticky; top: 0; z-index: 20; background: rgba(11, 12, 16, .82); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1440px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.spacer { flex: 1; }
.live-select { width: auto; max-width: 320px; background-color: var(--panel); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 12px;
  background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); max-width: 420px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.live-pill.on { color: var(--text); border-color: rgba(255, 77, 109, .4); background: var(--accent-soft); }
.live-pill.on .dot { background: var(--accent); box-shadow: 0 0 0 0 rgba(255, 77, 109, .6); animation: pulse 1.6s infinite; }
.live-pill.busy .dot { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, .55); } 70% { box-shadow: 0 0 0 8px rgba(255, 77, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--panel-3); border: 1px solid var(--line-2); cursor: pointer; }

/* ---------- layout ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 22px 20px 80px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.stat:hover { border-color: var(--line-2); }
.stat.active { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 140%); }
.stat .n { display: block; font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.new .n { color: var(--info); }
.stat.approved .n { color: var(--good); }
.stat.discarded .n { color: var(--bad); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search input { padding-left: 34px; background-color: var(--panel); }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 17px; }
.chips { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.chips button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.chips button.active { background: var(--panel-3); color: var(--text); }
.toolbar select { width: auto; background-color: var(--panel); }
.toolbar .review-btn { margin-left: auto; }

.marks { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: -4px 0 14px; scrollbar-width: none; }
.marks::-webkit-scrollbar { display: none; }
.mark { flex: none; font-size: 12.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.card.fresh { border-color: var(--accent); animation: glow 2.5s ease-out 1; }
@keyframes glow { from { box-shadow: 0 0 0 4px var(--accent-soft); } to { box-shadow: none; } }
.card.discarded { opacity: .55; }
.card.discarded:hover { opacity: 1; }
.media { position: relative; aspect-ratio: 9 / 16; background: #000; cursor: pointer; overflow: hidden; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); opacity: .0; transition: opacity .15s; }
.media:hover .play { opacity: 1; }
.media .play span { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #000;
  display: grid; place-items: center; font-size: 20px; padding-left: 4px; box-shadow: var(--shadow); }
.badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 650;
  background: rgba(10, 11, 15, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .08); }
.badge.s7 { color: var(--good); }
.badge.s6 { color: var(--warn); }
.badge.s5 { color: var(--muted); }
.dur { position: absolute; bottom: 10px; right: 10px; pointer-events: none; }
.busy { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px;
  background: rgba(10, 11, 15, .78); color: var(--warn); font-weight: 600; font-size: 13.5px; }
.busy::before { content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid rgba(246, 192, 73, .25); border-top-color: var(--warn); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.title { font-weight: 650; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.meta a { color: var(--info); text-decoration: none; }
.meta a:hover { text-decoration: underline; }
.kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.kind.auto { background: var(--info-soft); color: var(--info); }
.kind.req { background: var(--warn-soft); color: var(--warn); }
.status-tag { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; }
.status-tag.approved { background: var(--good-soft); color: var(--good); }
.status-tag.discarded { background: var(--bad-soft); color: var(--bad); }
.reason { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.last { font-size: 12px; color: var(--faint); }
.actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.actions .btn.good, .actions .btn.bad { flex: 1; padding: 8px 6px; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- dialogs ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 20px; padding: 0;
  width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
dialog.small { width: min(460px, calc(100vw - 24px)); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { margin: 0; font-size: 16px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { padding: 18px 20px; overflow: auto; max-height: calc(100vh - 160px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; gap: 12px; }

.editor { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.editor video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 12px; display: block; }
.editor .side-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.etabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.etabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; cursor: pointer; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.etabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.time-row { display: grid; grid-template-columns: 64px auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 10px; }
.time-row .val { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.steps { display: flex; gap: 4px; }
.lines { display: grid; gap: 6px; max-height: 430px; overflow: auto; padding-right: 4px; }
.line { display: grid; grid-template-columns: 58px 1fr 32px; gap: 6px; align-items: center; }
.line .ts { font-size: 12px; color: var(--info); font-variant-numeric: tabular-nums; background: none; border: 0; cursor: pointer; text-align: left; padding: 0; }
.line .ts:hover { text-decoration: underline; }
.line input { padding: 7px 10px; }
.line.changed input { border-color: rgba(246, 192, 73, .6); }
.line.removed input { text-decoration: line-through; opacity: .45; }
.line.active input { box-shadow: 0 0 0 2px var(--info-soft); border-color: var(--info); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.history { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.history div { padding: 8px 10px; background: var(--bg-2); border-radius: 8px; }
.users { display: grid; gap: 6px; margin-bottom: 14px; }
.users > div { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--bg-2); border-radius: 10px; }

/* ---------- review mode ---------- */
.review { position: fixed; inset: 0; z-index: 50; background: #07080b; display: grid;
  grid-template-columns: 1fr minmax(300px, 420px); gap: 0; }
.review .stage { display: grid; place-items: center; padding: 24px; min-height: 0; }
.review video { max-height: calc(100vh - 48px); max-width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 16px; box-shadow: var(--shadow); }
.review .info { border-left: 1px solid var(--line); background: var(--panel); padding: 22px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.review .progress { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.review .bar-track { height: 4px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.review .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.review h2 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; }
.review .reason { -webkit-line-clamp: unset; font-size: 14px; }
.review .big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review .big-actions .btn { padding: 13px; font-size: 15px; }
.review .nav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.review .keys { font-size: 12.5px; color: var(--faint); display: grid; gap: 6px; margin-top: auto; }
.review .done { text-align: center; color: var(--muted); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel-3); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s; z-index: 60; font-weight: 500; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .editor video { max-height: 46vh; width: auto; margin: 0 auto; }
  .review { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .review .stage { padding: 10px 10px 0; }
  .review video { max-height: calc(100vh - 290px); border-radius: 12px; }
  .review .info { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px; gap: 10px; }
  .review .keys, .review .reason { display: none; }
  .review h2 { font-size: 16px; }
}
@media (max-width: 640px) {
  .bar { padding: 10px 16px; gap: 10px; }
  .brand .name, .live-select { display: none; }
  .live-pill { max-width: none; flex: 1; min-width: 0; }
  main { padding: 16px 16px 80px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 10px 8px; text-align: center; }
  .stat .n { font-size: 20px; }
  .stat .l { font-size: 11px; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar .review-btn { margin-left: 0; flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .body { padding: 10px; gap: 6px; }
  .title { font-size: 13.5px; }
  .reason { display: none; }
  .actions .btn { padding: 7px 4px; font-size: 13px; }
  .actions .btn.more { display: none; }
  .dlg-body { padding: 14px 16px; }
  .time-row { grid-template-columns: 52px 1fr; }
  .time-row .steps:last-child { grid-column: 2; }
  .line { grid-template-columns: 1fr 32px; }
  .line .ts { grid-column: 1 / -1; }
}
