:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18212c;
  --border: #243041;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --accent: #5b8cff;
  --accent-2: #3dd6c6;
  --danger: #ff5c7a;
  --warn: #ffb020;
  --ok: #3ecf8e;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(91, 140, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(61, 214, 198, 0.1), transparent),
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
}

/* ── Login page ── */
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
  font-weight: 700;
  box-shadow: 0 0 24px rgba(91, 140, 255, 0.35);
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.api-badge {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  max-width: 420px;
  line-height: 1.35;
}

.api-badge.ok {
  border-color: rgba(62, 207, 142, 0.4);
  color: var(--ok);
}

.api-badge.warn {
  border-color: rgba(255, 176, 32, 0.45);
  color: var(--warn);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.panel h2:not(:first-child) {
  margin-top: 22px;
}

.hint {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  color: var(--text);
  border-color: rgba(91, 140, 255, 0.55);
  background: rgba(91, 140, 255, 0.12);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.dropzone {
  display: block;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.08);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.drop-icon {
  font-size: 1.6rem;
  color: var(--accent);
}

.file-name {
  margin-top: 6px;
  color: var(--accent-2);
  font-weight: 600;
  word-break: break-all;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="url"],
input[type="number"],
input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Prevent browser default white fill on readonly / autofill */
input[readonly],
input:disabled,
select:disabled {
  background: #141c26 !important;
  color: #9fb0c5 !important;
  border-color: #2a3648;
  cursor: default;
  opacity: 1;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-2) inset;
  transition: background-color 9999s ease-in-out 0s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}

textarea {
  resize: vertical;
  min-height: 220px;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.84rem;
  background: #0e141c;
  color: #d5e0ec;
  border-color: #2a3648;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, #8b9bb0 50%),
    linear-gradient(135deg, #8b9bb0 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  color: var(--text);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.row-url {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* ── Duration card (redesigned, no harsh white) ── */
.duration-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #2a3a52;
  background:
    linear-gradient(145deg, rgba(30, 42, 60, 0.95), rgba(16, 22, 32, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.25);
}

.duration-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.duration-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #3d6fd9, #2a9d8f);
  color: #e8f0ff;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(61, 111, 217, 0.35);
}

.duration-title-wrap {
  flex: 1;
  min-width: 0;
}

.duration-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8ea6;
  margin-bottom: 3px;
}

.duration-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #c8d6e8;
  line-height: 1.35;
  word-break: break-word;
}

.duration-status {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(62, 207, 142, 0.12);
  color: #3ecf8e;
  border: 1px solid rgba(62, 207, 142, 0.3);
}

.duration-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 520px) {
  .duration-metrics { grid-template-columns: 1fr; }
}

.metric {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid #243246;
}

.metric-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6d8098;
  margin-bottom: 4px;
}

.metric-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #b8c9dc;
  font-variant-numeric: tabular-nums;
}

.metric-value.accent {
  color: #7aa8ff;
}

.metric-value.teal {
  color: #4fd4c4;
}

.duration-hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #6d8098;
  line-height: 1.4;
}

.probe-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #5ec4b6;
  white-space: pre-wrap;
  line-height: 1.45;
}

.probe-status.error {
  color: #ff8a9a;
}

/* Rules presets toolbar */
.rules-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.rules-select-field {
  flex: 1 1 180px;
  min-width: 160px;
}

.rules-toolbar-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn.accent-btn {
  background: rgba(91, 140, 255, 0.18);
  border-color: rgba(91, 140, 255, 0.45);
  color: #9bbcff;
}

.btn.accent-btn:hover:not(:disabled) {
  background: rgba(91, 140, 255, 0.28);
}

.danger-text {
  color: #ff8a9a !important;
}

.rules-save-hint {
  margin-left: auto;
  font-size: 0.8rem;
  color: #5ec4b6;
  align-self: center;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 0.9rem;
}

.check-row input {
  margin-top: 3px;
}

.check-row small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.transcript-box {
  max-height: 180px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0e13;
  color: #c5d0dc;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  margin: 0 0 12px;
}

.export-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(61, 214, 198, 0.35);
  background: rgba(61, 214, 198, 0.08);
  color: #b8e0d8;
}

.export-box strong {
  color: #4fd4c4;
  font-size: 0.95rem;
}

.export-path {
  margin: 8px 0 4px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: #c8d6e8;
  user-select: all;
}

.export-box .hint {
  margin: 0;
  color: #8b9bb0;
}

.chip-neutral {
  background: rgba(139, 155, 176, 0.15);
  color: var(--muted);
}

.chip-ok {
  background: rgba(62, 207, 142, 0.15);
  color: var(--ok);
}

.audio-summary {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  border: 1px solid var(--border);
}

.audio-summary.ok {
  border-color: rgba(62, 207, 142, 0.4);
  color: var(--ok);
}

.audio-summary.bad {
  border-color: rgba(255, 92, 122, 0.45);
  color: var(--danger);
}

.viol-card .no-thumb {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.viol-card .ch {
  font-size: 0.72rem;
  color: var(--muted);
  margin-right: 4px;
}

.rule-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  font-size: 1rem;
  border: none;
  background: linear-gradient(135deg, var(--accent), #4570e0);
  color: white;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.3);
}

.btn.ghost {
  font-size: 0.82rem;
  color: var(--muted);
}

.error-inline {
  color: var(--warn);
  font-size: 0.85rem;
  margin-top: 10px;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.empty-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
  color: var(--accent);
}

.tips {
  text-align: left;
  display: inline-block;
  margin: 18px auto 0;
  padding-left: 18px;
  font-size: 0.88rem;
  line-height: 1.6;
}

.hidden { display: none !important; }

.progress-wrap {
  padding: 28px 8px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

#progressMsg {
  margin-top: 12px;
  color: var(--muted);
  text-align: center;
}

.verdict {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  margin-bottom: 14px;
}

.verdict.pass { border-color: rgba(62, 207, 142, 0.45); }
.verdict.fail { border-color: rgba(255, 92, 122, 0.5); }
.verdict.error { border-color: rgba(255, 176, 32, 0.5); }

.verdict-badge {
  min-width: 72px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 10px 8px;
  border-radius: 10px;
  background: #243041;
}

.verdict.pass .verdict-badge { background: rgba(62, 207, 142, 0.2); color: var(--ok); }
.verdict.fail .verdict-badge { background: rgba(255, 92, 122, 0.2); color: var(--danger); }
.verdict.error .verdict-badge { background: rgba(255, 176, 32, 0.2); color: var(--warn); }

.verdict h3 { margin: 0 0 4px; font-size: 1.05rem; }
.meta { margin: 0; color: var(--muted); font-size: 0.85rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.stat span {
  font-size: 0.75rem;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.section-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.chip {
  background: rgba(255, 92, 122, 0.15);
  color: var(--danger);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.viol-toolbar {
  flex-wrap: wrap;
  align-items: flex-start !important;
  gap: 10px;
  margin: 8px 0 10px;
}

.viol-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.viol-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.sev-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-btn:hover {
  border-color: rgba(91, 140, 255, 0.45);
  color: var(--text);
}

.filter-btn.active {
  border-color: rgba(91, 140, 255, 0.55);
  background: rgba(91, 140, 255, 0.15);
  color: #9bbcff;
}

.filter-btn.sev-high.active {
  border-color: rgba(255, 92, 122, 0.55);
  background: rgba(255, 92, 122, 0.15);
  color: var(--danger);
}

.filter-btn.sev-medium.active {
  border-color: rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.12);
  color: var(--warn);
}

.filter-btn.sev-low.active {
  border-color: rgba(139, 155, 176, 0.5);
  background: rgba(139, 155, 176, 0.12);
  color: #a8b8c8;
}

.size-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.size-btn {
  min-width: 34px;
  padding: 6px 10px !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
}

.size-label {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 48px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.viol-filtered-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.viol-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(8, 12, 18, 0.35);
  max-height: 360px;
  min-height: 140px;
}

.viol-list .empty-filter {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px 8px;
  text-align: center;
}

/* Fullscreen violations modal */
.viol-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 8, 14, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  padding: 16px;
  box-sizing: border-box;
}

.viol-modal.hidden {
  display: none !important;
}

.viol-modal-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background: #0f1620;
  border: 1px solid #2a3a52;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.viol-modal-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #152032, #101820);
}

.viol-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #d5e2f0;
}

.viol-list-fs {
  flex: 1;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 16px 18px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  align-content: start;
  overflow: auto;
}

.viol-list-fs .viol-card {
  margin: 0;
  height: fit-content;
}

.viol-list-fs .empty-viol,
.viol-list-fs .empty-filter {
  grid-column: 1 / -1;
}

.viol-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 92, 122, 0.06);
}

.viol-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}

.viol-card .sev {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
}

.sev.high { background: rgba(255, 92, 122, 0.25); color: var(--danger); }
.sev.medium { background: rgba(255, 176, 32, 0.2); color: var(--warn); }
.sev.low { background: rgba(139, 155, 176, 0.2); color: var(--muted); }

.viol-card h4 {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.viol-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.empty-viol {
  color: var(--ok);
  font-size: 0.9rem;
  padding: 8px 0 16px;
}

.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.frame-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  position: relative;
}

.frame-card.flagged {
  border-color: rgba(255, 92, 122, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 92, 122, 0.25);
}

.frame-card img {
  width: 100%;
  aspect-ratio: 9/12;
  object-fit: cover;
  display: block;
  background: #000;
  cursor: pointer;
}

.frame-card .cap {
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.frame-card .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
}

.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }
.dot.err { background: var(--warn); }

.error-box {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 92, 122, 0.4);
  background: rgba(255, 92, 122, 0.08);
  color: var(--danger);
}

.help {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.help summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.help ol {
  padding-left: 18px;
  line-height: 1.55;
}

.help code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.help a { color: var(--accent); }

.footer {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}

.lightbox img {
  max-width: min(92vw, 900px);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.lightbox.hidden { display: none; }

/* ── Staging list (per-video duration + FPS) ── */
.field-em {
  font-style: normal;
  font-weight: 500;
  color: var(--accent-2);
  font-size: 0.8em;
}

.staging-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.staging-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.staging-head h3 {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.staging-hint {
  margin: 4px 0 0;
}

.staging-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.staging-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.staging-row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 140px) minmax(150px, 180px) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e141c;
}

@media (max-width: 720px) {
  .staging-row {
    grid-template-columns: 1fr 1fr;
  }
  .staging-row .staging-remove {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

.staging-title {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.staging-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staging-meta {
  font-size: 0.82rem;
  color: #9fb0c5;
}

.staging-meta b {
  color: var(--accent-2);
  font-weight: 700;
}

.staging-meta.probing { color: var(--warn); }
.staging-meta.error { color: var(--danger); }

.staging-row select {
  font-size: 0.8rem;
  padding: 8px 10px;
}

.staging-frames {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.staging-frames strong {
  color: #4fd4c4;
  font-size: 0.9rem;
}

.staging-remove {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.staging-remove:hover {
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.5);
}

.staging-retry {
  border: 1px solid rgba(91, 140, 255, 0.4);
  background: rgba(91, 140, 255, 0.1);
  color: #9bbcff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.staging-retry:hover {
  background: rgba(91, 140, 255, 0.2);
}

.staging-row.is-error {
  border-color: rgba(255, 92, 122, 0.35);
  background: rgba(255, 92, 122, 0.04);
}

.staging-meta.error {
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
  max-height: 3.2em;
  overflow: hidden;
}

.staging-total {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.staging-total strong {
  color: var(--text);
}

/* ── Export history / import ── */
.export-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.export-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e141c;
  align-items: center;
}

.export-item-title {
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.export-item-meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.export-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.export-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.export-badge.pass {
  color: var(--ok);
  border-color: rgba(62, 207, 142, 0.45);
}

.export-badge.fail {
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.45);
}

.export-badge.error {
  color: var(--warn);
  border-color: rgba(255, 176, 32, 0.45);
}

/* ── Run / cancel row ── */
.run-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
  align-items: stretch;
}

.run-row .btn.primary {
  margin-top: 0;
  width: auto;
}

.btn.danger-btn {
  border-color: rgba(255, 92, 122, 0.45);
  background: rgba(255, 92, 122, 0.12);
  color: #ff8a9a;
  white-space: nowrap;
}

.btn.danger-btn:hover:not(:disabled) {
  background: rgba(255, 92, 122, 0.22);
}

/* ── Batch queue ── */
.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.queue-summary {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: auto;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.queue-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.queue-item:hover {
  border-color: rgba(91, 140, 255, 0.4);
}

.queue-item.active {
  border-color: rgba(91, 140, 255, 0.65);
  background: rgba(91, 140, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.2);
}

.queue-item-main {
  min-width: 0;
}

.queue-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.queue-item-meta {
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.queue-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.queue-badge.queued { color: #9bbcff; border-color: rgba(91, 140, 255, 0.4); }
.queue-badge.running { color: var(--accent-2); border-color: rgba(61, 214, 198, 0.45); }
.queue-badge.done.pass { color: var(--ok); border-color: rgba(62, 207, 142, 0.45); }
.queue-badge.done.fail { color: var(--danger); border-color: rgba(255, 92, 122, 0.45); }
.queue-badge.done { color: var(--ok); border-color: rgba(62, 207, 142, 0.35); }
.queue-badge.error { color: var(--warn); border-color: rgba(255, 176, 32, 0.45); }
.queue-badge.cancelled { color: var(--muted); }

.queue-item-progress {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: #0a0e13;
  overflow: hidden;
}

.queue-item-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.queue-mini-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.queue-mini-btn:hover {
  color: var(--text);
  border-color: rgba(91, 140, 255, 0.45);
}

.queue-mini-btn.danger:hover {
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.5);
}

/* URL multi-line */
.row-url {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.row-url textarea {
  min-height: 72px;
  resize: vertical;
}

/* ── Video preview + timeline ── */
.player-box {
  margin: 0 0 18px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0a0e13;
}

.result-video {
  width: 100%;
  max-height: 420px;
  border-radius: 10px;
  background: #000;
  display: block;
  object-fit: contain;
}

.timeline-wrap {
  margin-top: 12px;
}

.timeline-track {
  position: relative;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #141c26, #0e141c);
  border: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
}

.timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(91, 140, 255, 0.18);
  pointer-events: none;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  left: 0%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 3;
}

.timeline-markers {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.timeline-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 8px;
  margin-left: -4px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.92;
  transition: transform 0.1s, opacity 0.1s;
  z-index: 2;
}

.timeline-marker:hover,
.timeline-marker.active {
  transform: scaleY(1.15) scaleX(1.2);
  opacity: 1;
  z-index: 4;
}

.timeline-marker.high { background: var(--danger); box-shadow: 0 0 8px rgba(255, 92, 122, 0.55); }
.timeline-marker.medium { background: var(--warn); box-shadow: 0 0 8px rgba(255, 176, 32, 0.45); }
.timeline-marker.low { background: #8b9bb0; }

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.timeline-legend .mk {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}

.timeline-legend .mk.high { background: var(--danger); }
.timeline-legend .mk.medium { background: var(--warn); }
.timeline-legend .mk.low { background: #8b9bb0; }

.hint-inline {
  margin-left: auto;
  font-size: 0.72rem;
  color: #6d8098;
}

.viol-card {
  cursor: pointer;
}

.viol-card:hover {
  border-color: rgba(91, 140, 255, 0.45);
  background: rgba(91, 140, 255, 0.06);
}

.viol-card.focused {
  border-color: rgba(91, 140, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.35);
}

/* ──────────────────────────────────────────────────────────────
   Pixel Works · Policy Scan — moderation studio refresh
   ────────────────────────────────────────────────────────────── */
.studio-v2 {
  --bg: #111014;
  --panel: #1a181f;
  --panel-2: #24212a;
  --border: rgba(255, 255, 255, 0.14);
  --text: #f4f0e7;
  --muted: #aaa4b0;
  --accent: #ff4d9d;
  --accent-2: #9c7aff;
  --danger: #ff5d78;
  --warn: #ffbd4a;
  --ok: #cbff5a;
  --ink: #17151f;
  --radius: 22px;
  --shadow: none;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  font-weight: 600;
}

.studio-v2 .bg-grid {
  opacity: 0.65;
  background: none;
}

.studio-v2 .bg-grid::before,
.studio-v2 .bg-grid::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  pointer-events: none;
}

.studio-v2 .bg-grid::before { width: 520px; height: 520px; left: -240px; top: 260px; }
.studio-v2 .bg-grid::after { width: 430px; height: 430px; right: -220px; top: 80px; border-color: rgba(156, 122, 255, 0.14); }

.studio-v2 .app {
  max-width: 1480px;
  padding: 0 28px 54px;
}

.studio-v2 .header {
  min-height: 78px;
  margin: 0;
  padding: 14px 0;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.studio-v2 .brand { gap: 11px; }
.studio-v2 .logo {
  width: 38px;
  height: 34px;
  border: 2px solid var(--text);
  border-radius: 10px 7px 11px 8px;
  background: var(--ok);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--accent-2);
  font: 900 11px/1 Arial, sans-serif;
  transform: rotate(-3deg);
}

.studio-v2 .brand h1 {
  font: 900 1rem/1 "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  letter-spacing: -0.035em;
}

.studio-v2 .subtitle {
  margin-top: 5px;
  color: var(--muted);
  font: 900 0.58rem/1 Arial, sans-serif;
  letter-spacing: 0.13em;
}

.studio-v2 .header-right { flex-direction: row; align-items: center; }
.studio-v2 .api-badge,
.studio-v2 .user-chip {
  padding: 7px 10px;
  border-radius: 9px;
  background: transparent;
  font-size: 0.68rem;
}
.studio-v2 .api-badge.ok { border-color: rgba(203, 255, 90, 0.38); color: var(--ok); }
.studio-v2 .api-badge.warn { border-color: rgba(255, 189, 74, 0.44); color: var(--warn); }

.moderation-hero {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: 40px;
  padding: 38px 4% 42px;
  border-bottom: 1px solid var(--border);
}

.hero-kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font: 900 0.66rem/1 "Trebuchet MS", Arial, sans-serif;
  letter-spacing: 0.15em;
}
.hero-kicker span { color: var(--accent); }

.moderation-copy h2 {
  width: max-content;
  max-width: 100%;
  margin: 0;
  font: 900 clamp(54px, 6vw, 88px)/0.84 "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  letter-spacing: -0.072em;
}

.moderation-copy h2 span { display: block; }
.moderation-copy h2 strong {
  display: inline-block;
  margin-top: 20px;
  padding: 0.16em 0.24em 0.19em;
  border: 3px solid var(--text);
  border-radius: 18px 13px 21px 15px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 9px 10px 0 var(--accent-2);
  font-size: 0.49em;
  line-height: 0.9;
  transform: rotate(-1.3deg);
}

.moderation-copy > p:not(.hero-kicker) {
  max-width: 630px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  padding: 11px 14px;
  border: 1.5px solid var(--text);
  border-radius: 12px 9px 13px 10px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}
.hero-action:hover { background: var(--text); color: var(--ink); }

.scan-art { position: relative; width: min(100%, 410px); aspect-ratio: 1; justify-self: center; }
.scan-orbit { position: absolute; inset: 9%; border: 2px solid var(--text); border-radius: 51% 49% 52% 48%; transform: rotate(18deg); }
.scan-orbit.orbit-b { inset: 23% 0; border: 3px solid var(--accent-2); border-radius: 50%; transform: rotate(-29deg); }
.scan-core {
  position: absolute;
  inset: 27%;
  display: grid;
  place-content: center;
  border: 3px solid var(--text);
  border-radius: 55% 45% 56% 44% / 44% 55% 45% 56%;
  background: var(--accent);
  color: var(--ink);
  text-align: center;
  transform: rotate(6deg);
  box-shadow: 8px 9px 0 var(--text);
}
.scan-core strong { font: 900 clamp(1.7rem, 3vw, 2.7rem)/0.85 Arial, sans-serif; letter-spacing: -0.07em; }
.scan-core span { margin-top: 9px; font: 900 0.5rem/1 Arial, sans-serif; letter-spacing: 0.1em; }
.scan-tag { position: absolute; display: grid; place-items: center; border: 2px solid var(--text); color: var(--ink); font: 900 0.78rem/1 Arial, sans-serif; }
.tag-ai { left: 0; top: 35%; width: 56px; height: 56px; border-radius: 50%; background: var(--ok); transform: rotate(-9deg); }
.tag-safe { right: 14%; bottom: 5%; width: 48px; height: 48px; border-radius: 12px 50% 50% 14px; background: var(--accent-2); font-size: 1.2rem; }
.tag-risk { right: 0; top: 25%; width: 42px; height: 42px; border-radius: 50% 12px 50% 50%; background: var(--warn); font-size: 1rem; }

.studio-v2 .layout {
  grid-template-columns: minmax(480px, 0.88fr) minmax(520px, 1.12fr);
  gap: 18px;
  padding-top: 36px;
  align-items: start;
}

.studio-v2 .panel { box-shadow: none; }
.studio-v2 .setup-panel {
  display: contents;
  padding: 0;
  border: 0;
  background: transparent;
}

/* Keep active work above operational history. The setup section participates in
   the parent grid so Evidence Board stays visible while queue/library sit below. */
.studio-v2 .panel-intro { grid-column: 1; grid-row: 1; }
.studio-v2 .source-block { grid-column: 1; grid-row: 2; }
.studio-v2 .rules-block { grid-column: 1; grid-row: 3; }
.studio-v2 .settings-block { grid-column: 1; grid-row: 4; }
.studio-v2 .evidence-panel { grid-column: 2; grid-row: 1 / 5; }
.studio-v2 .queue-block { grid-column: 1; grid-row: 5; }
.studio-v2 .archive-block { grid-column: 2; grid-row: 5; }

.studio-v2 .queue-block,
.studio-v2 .archive-block {
  height: min(520px, 68vh);
  margin: 18px 0 0;
  display: flex;
  flex-direction: column;
}

.studio-v2 .queue-block .queue-list,
.studio-v2 .archive-block .export-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.panel-intro { margin-bottom: 24px; padding: 0 4px; }
.studio-v2 .panel-intro h2,
.studio-v2 .results-heading h2 {
  margin: 0;
  color: var(--text);
  font: 900 clamp(2.1rem, 3.2vw, 3.4rem)/0.92 "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  letter-spacing: -0.055em;
  text-transform: none;
}
.panel-intro > p:last-child,
.results-heading p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 0.83rem; }

.work-block {
  position: relative;
  margin-bottom: 13px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 23px 17px 24px 19px;
  background: var(--panel);
}
.work-block::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--accent); }
.rules-block::before { background: var(--ok); }
.settings-block::before { background: var(--accent-2); }
.queue-block::before { background: var(--warn); }
.archive-block::before { background: #71d6ff; }

.work-block-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.work-block-head.compact { align-items: center; }
.work-block-head .step-no {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 35px;
  border: 1.5px solid var(--text);
  border-radius: 11px 8px 12px 9px;
  background: var(--accent);
  color: var(--ink);
  font: 900 0.67rem/1 Arial, sans-serif;
  transform: rotate(-2deg);
}
.rules-block .step-no { background: var(--ok); }
.settings-block .step-no { background: var(--accent-2); }
.queue-block .step-no { background: var(--warn); }
.archive-block .step-no { background: #71d6ff; }
.studio-v2 .work-block-head h2 {
  margin: 1px 0 0;
  color: var(--text);
  font: 900 1.08rem/1.05 "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  letter-spacing: -0.025em;
  text-transform: none;
}
.work-block-head p { margin: 5px 0 0; color: var(--muted); font-size: 0.72rem; }

.studio-v2 .tabs { gap: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 13px; background: #111014; }
.studio-v2 .tab { border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.78rem; }
.studio-v2 .tab.active { background: var(--text); color: var(--ink); }

.studio-v2 .dropzone {
  min-height: 170px;
  border: 1.5px dashed rgba(244, 240, 231, 0.32);
  border-radius: 18px 13px 20px 15px;
  background: #111014;
}
.studio-v2 .dropzone:hover,
.studio-v2 .dropzone.dragover { border-color: var(--accent); background: rgba(255, 77, 157, 0.06); }
.studio-v2 .drop-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border: 2px solid var(--text);
  border-radius: 14px 9px 15px 10px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--accent-2);
}
.studio-v2 .file-name { color: var(--ok); }

.studio-v2 .field { color: var(--muted); font-size: 0.75rem; }
.studio-v2 input[type="text"],
.studio-v2 input[type="password"],
.studio-v2 input[type="url"],
.studio-v2 textarea,
.studio-v2 select {
  border: 1px solid var(--border);
  border-radius: 11px 8px 12px 9px;
  background: #111014;
  color: var(--text);
}
.studio-v2 textarea:focus,
.studio-v2 input:focus,
.studio-v2 select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(156, 122, 255, 0.14); }

.studio-v2 .btn {
  border: 1.5px solid rgba(244, 240, 231, 0.42);
  border-radius: 11px 8px 12px 9px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}
.studio-v2 .btn:hover:not(:disabled) { transform: translate(-2px, -2px); border-color: var(--text); box-shadow: 3px 4px 0 var(--text); }
.studio-v2 .btn.primary { border-color: var(--text); background: var(--accent); color: var(--ink); box-shadow: 5px 6px 0 var(--accent-2); }
.studio-v2 .btn.accent-btn { border-color: var(--text); background: var(--ok); color: var(--ink); }
.studio-v2 .btn.danger-btn { color: #ff8fa4; }
.studio-v2 .btn:disabled { opacity: 0.45; box-shadow: none; }

.rule-status-note {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgba(203, 255, 90, 0.25);
  border-radius: 13px;
  background: rgba(203, 255, 90, 0.055);
}
.rule-status-note > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--ok); color: var(--ink); font-weight: 900; }
.rule-status-note strong,
.rule-status-note small { display: block; }
.rule-status-note strong { color: var(--ok); font-size: 0.78rem; }
.rule-status-note small { margin-top: 3px; color: var(--muted); font-size: 0.69rem; line-height: 1.4; }
.studio-v2 .rules-toolbar { align-items: end; }
.studio-v2 .rules-select-field { min-width: min(100%, 290px); }

.studio-v2 .check-row {
  border: 1px solid var(--border);
  border-radius: 13px 10px 14px 11px;
  background: #111014;
}
.studio-v2 .check-row input { accent-color: var(--accent); }
.studio-v2 .check-row small { color: var(--muted); }

.studio-v2 .duration-card,
.studio-v2 .staging-box,
.studio-v2 .staging-row,
.studio-v2 .queue-item,
.studio-v2 .export-item,
.studio-v2 .queue-empty {
  border-color: var(--border);
  background: #111014;
}
.studio-v2 .queue-item:hover,
.studio-v2 .export-item:hover { border-color: rgba(244, 240, 231, 0.38); }
.studio-v2 .queue-item.active { border-color: var(--accent); background: rgba(255, 77, 157, 0.075); box-shadow: 0 0 0 1px var(--accent); }
.studio-v2 .queue-item-progress { background: #08070a; }
.studio-v2 .queue-item-progress > i { background: var(--accent); }
.studio-v2 .queue-badge.running { color: var(--ok); border-color: rgba(203, 255, 90, 0.42); }
.studio-v2 .queue-badge.queued { color: #c8b9ff; border-color: rgba(156, 122, 255, 0.45); }

.studio-v2 .results-panel {
  min-height: 760px;
  padding: clamp(20px, 2.5vw, 32px);
  border-radius: 27px 20px 28px 22px;
  background: var(--panel);
}
.results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.results-heading .live-dot {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(203, 255, 90, 0.38);
  border-radius: 8px;
  color: var(--ok);
  font: 900 0.58rem/1 Arial, sans-serif;
  letter-spacing: 0.11em;
}
.results-heading .live-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--ok); }

.studio-v2 .empty-state {
  min-height: 530px;
  display: grid;
  place-content: center;
  padding: 42px;
  border: 1.5px dashed rgba(244, 240, 231, 0.2);
  border-radius: 20px 15px 22px 17px;
  background: #111014;
  text-align: left;
}
.studio-v2 .empty-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 0 20px;
  border: 2px solid var(--text);
  border-radius: 50% 15px 50% 50%;
  background: var(--ok);
  color: var(--ink);
  box-shadow: 6px 7px 0 var(--accent-2);
  font-size: 1.55rem;
}
.studio-v2 .empty-state h3 { margin: 0; color: var(--text); font: 900 1.8rem/1 "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif; }
.studio-v2 .empty-state > p { max-width: 410px; margin: 10px 0 17px; color: var(--muted); }
.studio-v2 .tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.77rem; line-height: 1.7; }

.studio-v2 .progress-wrap,
.studio-v2 .player-box,
.studio-v2 .transcript-box,
.studio-v2 .export-box,
.studio-v2 .error-box {
  border: 1px solid var(--border);
  border-radius: 17px 12px 18px 14px;
  background: #111014;
}
.studio-v2 .progress-bar { background: #08070a; }
.studio-v2 .progress-fill { background: var(--accent); }
.studio-v2 .verdict { border-radius: 18px 13px 20px 15px; }
.studio-v2 .verdict.pass { border-color: rgba(203, 255, 90, 0.45); background: rgba(203, 255, 90, 0.07); }
.studio-v2 .verdict.fail { border-color: rgba(255, 93, 120, 0.48); background: rgba(255, 93, 120, 0.07); }
.studio-v2 .stat { border-color: var(--border); border-radius: 14px 10px 15px 11px; background: #111014; }
.studio-v2 .timeline-track { background: #08070a; }
.studio-v2 .timeline-progress { background: rgba(255, 77, 157, 0.2); }
.studio-v2 .timeline-playhead { background: var(--text); }
.studio-v2 .filter-btn.active { border-color: var(--text); background: var(--text); color: var(--ink); }
.studio-v2 .viol-card { border-radius: 17px 12px 18px 14px; background: #111014; }
.studio-v2 .viol-card:hover,
.studio-v2 .viol-card.focused { border-color: var(--accent); background: rgba(255, 77, 157, 0.045); box-shadow: 0 0 0 1px var(--accent); }
.studio-v2 .frame-card { border-radius: 13px 9px 14px 10px; background: #111014; }
.studio-v2 .viol-modal { background: rgba(8, 7, 10, 0.88); }
.studio-v2 .viol-modal-panel { border-color: var(--border); border-radius: 24px; background: var(--panel); }

.studio-v2 .footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 50px;
  padding: 25px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  text-align: left;
}
.studio-v2 .footer strong { color: var(--text); }

@media (min-width: 1181px) {
  .studio-v2 .evidence-panel { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow: auto; scrollbar-width: thin; }
}

@media (max-width: 1180px) {
  .studio-v2 .layout { grid-template-columns: 1fr; }
  .studio-v2 .panel-intro,
  .studio-v2 .source-block,
  .studio-v2 .rules-block,
  .studio-v2 .settings-block,
  .studio-v2 .evidence-panel,
  .studio-v2 .queue-block,
  .studio-v2 .archive-block { grid-column: 1; }
  .studio-v2 .panel-intro { grid-row: 1; }
  .studio-v2 .source-block { grid-row: 2; }
  .studio-v2 .rules-block { grid-row: 3; }
  .studio-v2 .settings-block { grid-row: 4; }
  .studio-v2 .evidence-panel { grid-row: 5; }
  .studio-v2 .queue-block { grid-row: 6; }
  .studio-v2 .archive-block { grid-row: 7; }
  .studio-v2 .queue-block,
  .studio-v2 .archive-block { height: auto; max-height: 520px; margin-top: 0; }
  .studio-v2 .results-panel { min-height: 600px; }
}

@media (max-width: 900px) {
  .studio-v2 .app { padding-inline: 16px; }
  .moderation-hero { grid-template-columns: 1fr; gap: 24px; padding: 34px 2% 38px; }
  .scan-art { width: min(54vw, 260px); }
  .studio-v2 .header { align-items: flex-start; }
  .studio-v2 .header-right { align-items: flex-end; flex-direction: column; }
  .studio-v2 .api-badge { max-width: 360px; }
}

@media (max-width: 600px) {
  .studio-v2 .app { padding-inline: 12px; }
  .studio-v2 .header { min-height: 70px; }
  .studio-v2 .header-right .api-badge { display: none; }
  .studio-v2 .logo { width: 34px; height: 31px; }
  .moderation-hero { min-height: auto; padding: 42px 4px; }
  .moderation-copy h2 { font-size: clamp(48px, 17vw, 72px); }
  .moderation-copy h2 strong { margin-top: 14px; border-width: 2px; box-shadow: 6px 7px 0 var(--accent-2); }
  .moderation-copy > p:not(.hero-kicker) { margin-top: 28px; font-size: 0.9rem; }
  .scan-art { width: min(70vw, 230px); }
  .studio-v2 .layout { padding-top: 34px; }
  .work-block { padding: 16px; }
  .studio-v2 .grid-3 { grid-template-columns: 1fr; }
  .studio-v2 .row-url { grid-template-columns: 1fr; }
  .studio-v2 .run-row { grid-template-columns: 1fr; }
  .studio-v2 .run-row .btn { width: 100%; }
  .studio-v2 .rules-toolbar { align-items: stretch; flex-direction: column; }
  .studio-v2 .rules-toolbar-btns .btn { width: 100%; }
  .studio-v2 .results-panel { padding: 17px; }
  .studio-v2 .empty-state { min-height: 420px; padding: 24px; }
  .studio-v2 .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .studio-v2 *, .studio-v2 *::before, .studio-v2 *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
/* Authentication --------------------------------------------------------- */
.account-menu { display: flex; align-items: center; gap: 10px; }
.account-menu form { margin: 0; }
.account-user { color: var(--muted, #77717f); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.logout-btn { border: 1px solid rgba(17,16,20,.18); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; padding: 8px 13px; }
.logout-btn:hover { background: #111014; color: #fff; }

.login-page { margin: 0; min-height: 100vh; background: #f4efe7; color: #17151d; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.login-page::before { position: fixed; inset: 0; background-image: linear-gradient(rgba(23,21,29,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23,21,29,.035) 1px, transparent 1px); background-size: 36px 36px; content: ""; pointer-events: none; }
.login-shell { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); min-height: 100vh; }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; overflow: hidden; padding: clamp(28px, 5vw, 72px); }
.login-logo { display: inline-flex; align-items: center; gap: 13px; width: max-content; color: inherit; text-decoration: none; font-size: 13px; letter-spacing: .16em; line-height: 1.05; }
.login-logo > span { display: grid; place-items: center; width: 46px; height: 46px; border: 2px solid #17151d; border-radius: 14px; background: #ff5ca8; box-shadow: 4px 4px 0 #17151d; font-weight: 900; letter-spacing: -.04em; }
.login-copy { position: relative; z-index: 2; max-width: 650px; margin: 10vh 0 8vh; }
.login-kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 22px; font-size: 12px; font-weight: 900; letter-spacing: .2em; }
.login-kicker i { width: 9px; height: 9px; border-radius: 50%; background: #baff39; box-shadow: 13px 0 0 #8b5cf6; }
.login-copy h1 { margin: 0; font-size: clamp(68px, 8.5vw, 132px); letter-spacing: -.075em; line-height: .78; }
.login-copy h1 em { color: #ff5ca8; font-family: Georgia, serif; font-weight: 500; }
.login-copy > p:last-child { max-width: 500px; margin-top: 34px; color: #625d68; font-size: 17px; line-height: 1.65; }
.login-orbit { position: absolute; right: -150px; bottom: -170px; width: 440px; height: 440px; border: 1px solid rgba(23,21,29,.2); border-radius: 50%; }
.login-orbit::before { position: absolute; inset: 55px; border: 1px solid rgba(23,21,29,.15); border-radius: 50%; content: ""; }
.login-orbit-core { position: absolute; inset: 135px; display: grid; place-items: center; border: 2px solid #17151d; border-radius: 50%; background: #baff39; font-size: 42px; font-weight: 950; }
.login-dot { position: absolute; display: block; width: 54px; height: 54px; border: 2px solid #17151d; border-radius: 18px; box-shadow: 4px 4px 0 #17151d; }
.dot-one { top: 52px; left: 30px; background: #8b5cf6; }
.dot-two { top: 130px; right: 4px; background: #ff5ca8; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #17151d; }
.login-card { width: min(100%, 510px); padding: clamp(30px, 5vw, 56px); border: 1px solid rgba(255,255,255,.14); border-radius: 30px; background: #211f28; box-shadow: 0 30px 80px rgba(0,0,0,.28); color: #fff; }
.login-step { color: #baff39; font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.login-card h2 { margin: 15px 0 8px; font-size: 44px; letter-spacing: -.045em; }
.login-card header p { margin: 0 0 34px; color: #aaa5b1; }
.login-error { margin: -10px 0 22px; border: 1px solid rgba(255,92,168,.42); border-radius: 12px; background: rgba(255,92,168,.1); color: #ffc2de; padding: 12px 14px; font-size: 14px; }
.login-field { display: grid; gap: 9px; margin-top: 20px; }
.login-field span { color: #c8c4ce; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.login-field input { width: 100%; box-sizing: border-box; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; outline: none; background: #17151d; color: #fff; padding: 15px 16px; font: inherit; transition: border-color .2s, box-shadow .2s; }
.login-field input:focus { border-color: #baff39; box-shadow: 0 0 0 3px rgba(186,255,57,.12); }
.login-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 28px; border: 2px solid #baff39; border-radius: 14px; background: #baff39; color: #17151d; cursor: pointer; padding: 15px 18px; font: inherit; font-weight: 900; }
.login-submit:hover { background: #caFF68; }
.login-submit span { font-size: 21px; }
.login-card footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 28px; color: #86818d; font-size: 12px; }
.login-card footer span { display: flex; align-items: center; gap: 7px; }
.login-card footer i { width: 7px; height: 7px; border-radius: 50%; background: #baff39; }
.login-card footer a { color: #aaa5b1; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 43vh; padding: 28px; }
  .login-copy { margin: 70px 0 20px; }
  .login-copy h1 { font-size: clamp(58px, 16vw, 92px); }
  .login-copy > p:last-child { margin-top: 24px; }
  .login-orbit { display: none; }
  .login-panel { min-height: 57vh; padding: 28px 18px; }
  .login-card { box-sizing: border-box; }
}
