:root {
  --bg: #090b11;
  --bg-elevated: #101520;
  --panel: rgba(14, 19, 29, 0.88);
  --panel-strong: rgba(10, 14, 22, 0.96);
  --ink: #eef2fb;
  --muted: #8f9bb3;
  --line: rgba(173, 192, 255, 0.12);
  --line-strong: rgba(173, 192, 255, 0.24);
  --accent: #86a8ff;
  --accent-dark: #5f7fe0;
  --accent-soft: rgba(134, 168, 255, 0.14);
  --danger: #ff6d78;
  --success: #3aa675;
  --gold: #d2b57f;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --font-ui: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", "Fira Code", "SFMono-Regular", "Menlo", "Consolas", monospace;
  --font-display: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", "Menlo", monospace;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(95, 127, 224, 0.18), transparent 24%),
    radial-gradient(circle at 85% 20%, rgba(210, 181, 127, 0.12), transparent 16%),
    radial-gradient(circle at bottom right, rgba(58, 166, 117, 0.1), transparent 22%),
    linear-gradient(180deg, #07090f 0%, #0d1119 46%, #090b11 100%);
  font-family: var(--font-ui);
  letter-spacing: -0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.018), rgba(255,255,255,0.018)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 3px,
      rgba(255,255,255,0.012) 4px
    );
  opacity: 0.35;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(18, 24, 37, 0.96), rgba(10, 13, 21, 0.98));
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-block {
  display: flex;
  flex-direction: column;
}

.brand-link {
  font-size: 1.85rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.brand-tag,
.muted-line,
.subtle-copy,
.validation-copy {
  color: var(--muted);
}

.topbar .brand-tag,
.topbar .muted-line {
  color: rgba(238, 242, 251, 0.68);
}

.topnav {
  display: flex;
  gap: 18px;
}

.topnav a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(238, 242, 251, 0.92);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.topnav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-wrap {
  max-width: 1240px;
  margin: 0 auto;
}

.auth-panel {
  min-height: 75vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(16, 21, 32, 0.9), rgba(11, 15, 23, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-card {
  width: min(520px, 100%);
  padding: 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header h1,
.panel-card h2,
.auth-card h1 {
  font-family: var(--font-display);
  color: #f7f9ff;
  text-shadow: 0 0 24px rgba(134, 168, 255, 0.08);
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.9rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1;
}

.eyebrow {
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--gold);
  font-family: var(--font-display);
}

.status-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(134, 168, 255, 0.22);
  background: var(--accent-soft);
  color: #dce6ff;
  font-weight: 700;
}

.dashboard-grid,
.two-column-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
}

.panel-card {
  padding: 24px;
}

.upload-panel {
  min-height: 360px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 24px;
  text-align: center;
  border: 1px dashed rgba(134, 168, 255, 0.34);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(18, 24, 37, 0.82), rgba(11, 15, 23, 0.95));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.dropzone.dragover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(134, 168, 255, 0.18),
    0 0 0 6px rgba(134, 168, 255, 0.08);
}

.dropzone-input {
  display: none;
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f1f5ff;
  font-family: var(--font-display);
}

.dropzone-subtitle {
  color: var(--muted);
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 14, 0.82);
  backdrop-filter: blur(14px);
}

.upload-overlay-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(16, 21, 32, 0.96), rgba(9, 12, 19, 0.98));
  box-shadow: var(--shadow);
}

.upload-progress-shell {
  position: relative;
  width: 100%;
  height: 18px;
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid rgba(58, 166, 117, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.upload-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #2b7d58 0%, #3aa675 45%, #79e3ad 100%);
  box-shadow: 0 0 24px rgba(58, 166, 117, 0.45);
  transition: width 0.16s ease;
}

.upload-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: #d9ffe8;
}

.history-list,
.duplicate-list,
.batch-target-list {
  display: grid;
  gap: 14px;
}

.history-item,
.duplicate-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.review-flags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.validation-copy,
.validation-block {
  margin-top: 12px;
  white-space: pre-wrap;
}

.validation-block {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(173, 192, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: #b8c4dc;
}

.warning-block {
  border-color: rgba(255, 109, 120, 0.18);
  background: rgba(255, 109, 120, 0.08);
  color: #ffd5d9;
}

.cover-preview-wrap {
  margin: 14px 0 18px;
}

.cover-preview {
  width: min(100%, 280px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.batch-track-number {
  min-width: 110px;
}

.stack-form .form-control,
.stack-form .form-select,
.auth-card .form-control,
.form-control,
.form-select {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(4, 7, 12, 0.5);
  color: #f2f6ff;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(134, 168, 255, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(134, 168, 255, 0.16);
  background: rgba(4, 7, 12, 0.72);
  color: #ffffff;
}

.form-check-input {
  background-color: rgba(4, 7, 12, 0.8);
  border-color: var(--line-strong);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.table {
  color: #edf2ff;
}

.table > :not(caption) > * > * {
  padding: 1rem 0.75rem;
  background: transparent;
  border-bottom-color: rgba(173, 192, 255, 0.09);
}

.table tbody td {
  color: #edf2ff;
}

.table thead th {
  color: #d8e1f5;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.btn {
  border-radius: 14px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(180deg, #86a8ff, #5f7fe0);
  border-color: #6e8be5;
  color: #08111f;
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(180deg, #98b6ff, #6b8ae6);
  border-color: #8eabff;
  color: #07101d;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-success {
  background: linear-gradient(180deg, #3aa675, #2f845d);
  border-color: #46ba83;
}

.btn-outline-danger {
  color: #ff9aa2;
  border-color: rgba(255, 109, 120, 0.5);
}

.btn-outline-danger:hover {
  background: rgba(255, 109, 120, 0.12);
  border-color: #ff6d78;
  color: #ffd9dc;
}

.btn-outline-secondary,
.btn-outline-light {
  color: #d9e3fb;
  border-color: var(--line-strong);
}

.btn-outline-secondary:hover,
.btn-outline-light:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(173, 192, 255, 0.34);
  color: #ffffff;
}

.badge.text-bg-secondary {
  background: rgba(134, 168, 255, 0.14) !important;
  color: #dce6ff !important;
}

.badge.text-bg-success {
  background: rgba(58, 166, 117, 0.18) !important;
  color: #c8ffe2 !important;
}

.badge.text-bg-danger,
.badge.text-bg-warning {
  background: rgba(255, 109, 120, 0.16) !important;
  color: #ffd7db !important;
}

.alert {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.alert-success {
  color: #d0ffe7;
  border-color: rgba(58, 166, 117, 0.3);
  background: rgba(58, 166, 117, 0.12);
}

.alert-danger {
  color: #ffd9dc;
  border-color: rgba(255, 109, 120, 0.34);
  background: rgba(255, 109, 120, 0.1);
}

.form-text,
small {
  color: var(--muted) !important;
}

pre,
code {
  color: #d7e2fb;
  font-family: var(--font-display);
}

@media (max-width: 900px) {
  .topbar,
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-grid,
  .two-column-grid {
    grid-template-columns: 1fr;
  }
}
