:root {
  --bg: #07090f;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f8;
  --muted: #93a0b4;
  --faint: #5c6778;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --success: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- background glows ---------- */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 560px; height: 560px;
  top: -180px; left: 50%;
  transform: translateX(-70%);
  background: radial-gradient(circle, rgba(79, 140, 255, 0.16), transparent 70%);
}
.bg-glow-2 {
  width: 480px; height: 480px;
  bottom: -200px; right: -120px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.12), transparent 70%);
}

.hidden { display: none !important; }

code, .mono { font-family: var(--mono); }

code {
  background: rgba(79, 140, 255, 0.12);
  color: #9dc0ff;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.85em;
}

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.35);
}
.brand-sm .brand-icon { width: 38px; height: 38px; border-radius: 11px; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sm .brand-name { font-size: 0.95rem; }
.brand-sub { font-size: 0.75rem; color: var(--muted); margin-top: 1px; }

/* ---------- login ---------- */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 2rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.login-lock {
  margin: 1.6rem 0 0.9rem;
  width: 68px; height: 68px;
  display: grid; place-items: center;
  border-radius: 18px;
  color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.25);
}

.login-title { font-size: 1.3rem; font-weight: 700; margin: 0 0 0.4rem; letter-spacing: -0.02em; }
.login-hint { color: var(--muted); font-size: 0.9rem; line-height: 1.5; margin: 0 0 1.5rem; }

.login-footer { margin-top: 1.4rem; font-size: 0.75rem; color: var(--muted); opacity: 0.7; }

/* ---------- inputs & buttons ---------- */
.field { position: relative; margin-bottom: 1rem; }

.input {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}
.input-lg { padding: 0.9rem 2.8rem 0.9rem 1.1rem; font-size: 1rem; }
.input.mono { font-family: var(--mono); font-size: 0.85rem; }

.field-eye {
  position: absolute;
  right: 0.6rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
}
.field-eye:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border: none;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 20px rgba(79, 140, 255, 0.3);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(79, 140, 255, 0.45); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); }

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

.btn-lg { padding: 0.9rem 1.4rem; font-size: 0.98rem; }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------- admin layout ---------- */
.admin { position: relative; z-index: 1; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 15, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-right { display: flex; align-items: center; gap: 0.6rem; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}
.status-text { font-size: 0.8rem; color: var(--muted); margin-right: 0.5rem; }

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ---------- stepper ---------- */
.stepper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  padding: 0 0.5rem;
}

.step { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; width: 110px; }

.step-num {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--border-strong);
  color: var(--muted);
  background: var(--surface);
  transition: all 0.25s;
}

.step-label { font-size: 0.76rem; color: var(--muted); font-weight: 500; text-align: center; }

.step-line {
  flex: 1;
  height: 2px;
  margin-top: 18px;
  background: var(--border-strong);
  border-radius: 2px;
  transition: background 0.25s;
}

.step.active .step-num {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 5px rgba(79, 140, 255, 0.15);
}
.step.active .step-label { color: var(--text); }

.step.done .step-num {
  border-color: var(--success);
  color: var(--success);
  background: rgba(52, 211, 153, 0.08);
}
.step.done .step-label { color: var(--success); }
.step-line.done { background: var(--success); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-head { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 1.25rem; }
.card-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.card-head p { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.card-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
}
.icon-blue { color: #7fb1ff; background: rgba(79, 140, 255, 0.12); border: 1px solid rgba(79, 140, 255, 0.25); }
.icon-violet { color: #b39dff; background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.25); }
.icon-green { color: #6ee7b7; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.25); }
.icon-slate { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  padding: 2.2rem 1.25rem 1.6rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  background: rgba(0, 0, 0, 0.18);
}
.dropzone:hover { border-color: rgba(79, 140, 255, 0.5); background: rgba(79, 140, 255, 0.04); }
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
  transform: scale(1.01);
}

.dz-icon { color: var(--accent); margin-bottom: 0.7rem; opacity: 0.9; }
.dz-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.35rem; }
.dz-sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.7rem; }
.dz-note { margin-top: 0.9rem; font-size: 0.74rem; color: var(--muted); opacity: 0.8; }

/* ---------- progress ---------- */
.progress { margin-top: 1rem; }
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.progress-info span:first-child {
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-track {
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s;
}

/* ---------- file chip ---------- */
.file-chip {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 11px;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-size: 0.84rem;
  color: var(--success);
  word-break: break-all;
}
.file-chip::before {
  content: "✓";
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.15);
  font-weight: 700;
  font-size: 0.75rem;
}

/* ---------- bundle preview ---------- */
.bundle-preview {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.25rem;
}
.bp-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.6rem;
  font-weight: 600;
}
.bundle-preview pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.7;
  color: #b8c6da;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- link result ---------- */
.link-result { margin-top: 1.4rem; animation: rise 0.35s ease; }

.lr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 0.8rem;
}

.link-box { display: flex; gap: 0.6rem; }
.link-box .input { flex: 1; min-width: 0; }

.lr-actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; flex-wrap: wrap; }

/* ---------- history ---------- */
.history-wrap { overflow-x: auto; }

.history { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.history th {
  text-align: left;
  padding: 0.55rem 0.6rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.history td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
  vertical-align: middle;
}
.history tr:last-child td { border-bottom: none; }
.history .mono-cell { font-family: var(--mono); font-size: 0.78rem; color: #9dc0ff; }
.history .muted-cell { color: var(--muted); font-size: 0.8rem; }
.history a { color: var(--accent); text-decoration: none; }
.history a:hover { text-decoration: underline; }

.dl-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.history-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 0.5rem 0.75rem;
}

/* ---------- toasts ---------- */
.toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 100;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem;
  border-radius: 12px;
  background: rgba(20, 26, 38, 0.95);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 340px;
}
.toast.success { border-color: rgba(52, 211, 153, 0.4); }
.toast.error { border-color: rgba(248, 113, 113, 0.4); }
.toast .t-icon { flex-shrink: 0; }
.toast.success .t-icon { color: var(--success); }
.toast.error .t-icon { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.25s; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .step { width: 84px; }
  .step-label { font-size: 0.68rem; }
  .topbar { padding: 0.75rem 1rem; }
  .status-text { display: none; }
  .card { padding: 1.15rem; }
  .link-box { flex-direction: column; }
}