:root {
  /* Brand */
  --brand: #dc2626;
  --brand-hover: #b91c1c;
  --brand-active: #991b1b;
  --brand-50: #fef2f2;
  --brand-100: #fee2e2;
  --brand-200: #fecaca;
  --word: #2563eb;
  --word-50: #eff6ff;

  /* Neutrals */
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --canvas: #eef1f5;
  --success: #16a34a;
  --success-50: #f0fdf4;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 24px 48px -12px rgb(15 23 42 / 0.18);
  --ring: 0 0 0 3px rgb(220 38 38 / 0.25);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

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

button {
  font: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.text-brand {
  color: var(--brand);
}

/* Logo */
.logo {
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: var(--radius-sm);
}

.logo img {
  display: block;
  height: 34px;
  width: auto;
}

.logo .logo__mark {
  display: none;
  height: 32px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.85;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgb(153 27 27 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.12);
}

.btn--primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.btn--primary:active:not(:disabled) {
  background: var(--brand-active);
  transform: translateY(1px);
}

.btn--ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: #cbd5e1;
  background: var(--surface-2);
}

.btn--sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.btn--lg {
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  border-radius: 12px;
}

.btn--block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--line-2);
}

/* File badges */
.file-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 46px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
}

.file-badge--word {
  background: var(--word);
}

.file-badge--lg {
  width: 56px;
  height: 68px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
}

.kicker {
  display: inline-block;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker--light {
  color: #fca5a5;
}

/* Progress */
.progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-100);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #ef4444);
  transition: width 0.2s ease;
}

.progress--indeterminate .progress__bar {
  position: absolute;
  width: 40%;
  animation: indeterminate 1.3s ease-in-out infinite;
}

@keyframes indeterminate {
  from {
    left: -40%;
  }
  to {
    left: 100%;
  }
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--brand {
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-color: var(--brand-100);
  border-top-color: var(--brand);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty / error page */
.empty-state {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--surface-2);
}

.empty-state h1 {
  margin-top: 24px;
  font-size: 1.75rem;
}

.empty-state p {
  max-width: 460px;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
