:root {
  --bg: #0f1116;
  --surface: #181b22;
  --surface-2: #20242e;
  --border: #2b303b;
  --text: #e8eaed;
  --text-dim: #9aa1ad;
  --accent: #4f8cff;
  --accent-hover: #3d7bef;
  --success: #3fb950;
  --danger: #f85149;
  --warn: #d29922;
  --radius: 10px;
  --radius-lg: 16px;
  --gap: 16px;
  --shadow: 0 4px 16px rgba(0,0,0,.35);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --border: #d8dce3;
    --text: #1a1d23;
    --text-dim: #5c6370;
    --shadow: 0 4px 16px rgba(0,0,0,.10);
  }
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 860px;
  margin-inline: auto;
  padding: 24px 20px;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-ghost:hover {
  background: var(--surface-2);
}

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

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-lg {
  padding: 15px 28px;
  font-size: 17px;
  width: -webkit-fit-content;
  width: fit-content;
}

/* Input */
.input,
select.input {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.input:focus,
select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,140,255,.25);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

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

/* Progress */
.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  /* Starts empty here rather than via a style attribute in the markup:
     the Content-Security-Policy forbids inline styles. JavaScript updates
     the width through the CSSOM, which the policy does allow. */
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease;
}

/* File row */
.file-row {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.file-row:last-child {
  border-bottom: none;
}

.file-info {
  flex-grow: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-dim);
}

.badge-warn {
  color: var(--warn);
}

.badge-danger {
  color: var(--danger);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 20px;
  box-shadow: var(--shadow);
  z-index: 100;
}

.toast[hidden] {
  display: none;
}

.toast-success {
  border-color: var(--success);
}

/* Utilities */
.row {
  display: flex;
  gap: var(--gap);
  align-items: center;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grow {
  flex: 1;
}

.muted {
  color: var(--text-dim);
  font-size: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.hidden {
  display: none;
}

.center {
  text-align: center;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

/* Headings */
h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
}

h2 {
  font-size: 19px;
  font-weight: 600;
}

.logo {
  color: var(--accent);
}

/* Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 16px 14px;
  }
  
  .card {
    padding: 18px;
  }
  
  .file-row {
    flex-wrap: wrap;
  }
  
  .btn {
    font-size: 14px;
  }
  
  h1 {
    font-size: 22px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
}
