:root {
  --bg: #0c1220;
  --bg-elevated: #111b2e;
  --panel: #152238;
  --text: #e8eef5;
  --muted: #8da0b5;
  --border: #2a3d56;
  --primary: #0ea5e9;
  --primary-dim: #0369a1;
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --accent-line: linear-gradient(90deg, #0ea5e9, #22d3ee 40%, #a78bfa);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.hero {
  position: relative;
  padding-bottom: 4px;
}

.hero::after {
  content: "";
  display: block;
  height: 3px;
  width: 100%;
  max-width: 320px;
  margin-top: 14px;
  border-radius: 3px;
  background: var(--accent-line);
  opacity: 0.85;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-tagline {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 36rem;
}

.hero p,
.muted {
  color: var(--muted);
}

.card {
  margin-top: 22px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.card > h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.toolbar,
.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button-stack {
  align-self: end;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.secondary {
  background: #334155;
  color: #f1f5f9;
}

.btn.secondary:hover {
  background: #3f4f63;
}

.btn.danger {
  background: #b91c1c;
  color: #fff;
}

.btn.danger:hover {
  background: #dc2626;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: #475569;
}

.btn.link {
  background: transparent;
  color: #7dd3fc;
  padding: 4px 0;
  font-weight: 500;
}

.btn.link:hover {
  color: #bae6fd;
  text-decoration: underline;
}

.btn.link-muted {
  background: transparent;
  color: var(--muted);
  padding: 4px 0;
  font-weight: 500;
  font-size: 0.85rem;
}

.btn.link-muted:hover {
  color: #cbd5e1;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0.02em;
  background: rgba(15, 23, 42, 0.6);
}

tr:last-child td {
  border-bottom: none;
}

.status-uploading {
  color: var(--warning);
}

.status-uploaded,
.status-queued {
  color: #7dd3fc;
}

.status-processing {
  color: var(--warning);
}

.status-done {
  color: var(--success);
}

.status-failed {
  color: #fca5a5;
}

.progress {
  min-width: 160px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #0f172a;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
}

.progress-text {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.download-progress-panel {
  margin-top: 12px;
  max-width: 520px;
}

.download-progress-bar .progress-bar {
  max-width: 520px;
}

.download-progress-text {
  word-break: break-all;
}

.download-progress-panel .progress-fill.is-indeterminate {
  width: 32%;
  animation: download-bar-shift 0.9s ease-in-out infinite alternate;
}

@keyframes download-bar-shift {
  from {
    margin-left: 0;
  }
  to {
    margin-left: 68%;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  max-width: 280px;
}

.actions-divider {
  color: var(--border);
  user-select: none;
}

.checkbox-label {
  color: var(--text);
  flex-direction: row;
  align-items: center;
}

.preview-cell {
  width: 140px;
}

.preview-thumb {
  display: block;
  max-height: 72px;
  max-width: 128px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.preview-placeholder {
  font-size: 12px;
}

.hidden {
  display: none !important;
}

/* ---------- modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-card-body {
  padding: 16px 18px 20px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.json-view {
  margin: 0;
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  background: #0a0f18;
  color: #cbd5e1;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: auto;
  max-height: min(70vh, 560px);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-video {
  display: block;
  width: 100%;
  max-height: min(72vh, 640px);
  border-radius: 10px;
  background: #000;
}

.video-playback-error {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 10px;
}

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

.body-login {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #164e63 0%, transparent 55%), var(--bg);
}

.page-login-only {
  max-width: 440px;
  margin: 0 auto;
  padding-top: 56px;
}

.hero-login {
  text-align: center;
  margin-bottom: 8px;
}

.hero-login h1 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

.hero-login .muted {
  text-align: center;
  font-size: 0.95rem;
}

.card-login {
  margin-top: 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-status-line {
  min-height: 1.25em;
  margin-top: 10px;
}

.hero-compact .hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero-compact h1 {
  margin: 0 0 8px;
}

.hero-sub {
  margin: 0;
  font-size: 14px;
}

.user-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.user-bar strong {
  font-weight: 600;
  color: var(--text);
}

.main-status-line {
  margin: 12px 0 0;
  min-height: 1.25em;
  font-size: 0.9rem;
}
