:root {
  --bg: #ffffff;
  --bg-soft: #f4f4f5;
  --surface: #ffffff;
  --surface-alt: #f4f4f5;
  --border: #e0e0e2;
  --text: #1e1e1c;
  --text-dim: #63666a;
  --primary: #63666a;
  --primary-dark: #1e1e1c;
  --neutral-tint: rgba(30, 30, 28, 0.06);
  --ok: #2f7d5c;
  --ok-bg: rgba(47, 125, 92, 0.09);
  --bad: #b3402f;
  --bad-bg: rgba(179, 64, 47, 0.09);
  --radius: 14px;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---------- Brand ---------- */

.accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 55%, var(--border) 100%);
}

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

.footer-logo {
  height: 22px;
  width: auto;
  display: block;
  opacity: 0.55;
}

/* ---------- App shell ---------- */

body {
  background-image: radial-gradient(circle at 15% 0%, var(--bg-soft) 0%, var(--bg) 45%);
  background-attachment: fixed;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 1.35rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.main {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.hero {
  padding-bottom: 2.25rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--neutral-tint);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  color: var(--text);
  max-width: 620px;
}

.hero p {
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 620px;
  margin: 0 0 1.75rem;
}

.hero strong {
  color: var(--text);
  font-weight: 700;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ---------- Footer ---------- */

.footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
}

/* ---------- Buttons ---------- */

.primary-btn {
  background: var(--primary-dark);
  color: #ffffff;
  font-weight: 700;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(30, 30, 28, 0.18);
}

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

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

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

/* ---------- Dropzone ---------- */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--neutral-tint);
  box-shadow: 0 10px 30px rgba(30, 30, 28, 0.06);
}

.dropzone-icon-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.dropzone-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.dropzone-title {
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.dropzone-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0;
}

/* ---------- Queue ---------- */

.queue {
  margin-top: 2rem;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.queue-header h2 {
  font-size: 1.1rem;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.queue-item .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.queue-item .file-size {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

.remove-btn:hover {
  color: var(--bad);
}

/* ---------- Results ---------- */

.results {
  margin-top: 2.5rem;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.results-header h2 {
  font-size: 1.1rem;
}

.summary {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

.stat strong {
  color: var(--text);
  font-weight: 700;
  margin-left: 0.3rem;
}

.stat-ok strong {
  color: var(--ok);
}

.stat-bad strong {
  color: var(--bad);
}

.progress-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-fill.ok {
  background: var(--ok);
}

.progress-fill.bad {
  background: var(--bad);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(30, 30, 28, 0.04);
  transition: box-shadow 0.15s ease;
}

.result-card:hover {
  box-shadow: 0 8px 24px rgba(30, 30, 28, 0.08);
}

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
}

.result-file-info {
  min-width: 0;
}

.result-file-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  color: var(--text);
  text-decoration: none;
}

button.result-file-name {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

button.result-file-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.result-doc-type {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.badge {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.result-details {
  border-top: 1px solid var(--border);
  padding: 0.25rem 1.25rem 1rem;
  display: none;
}

.result-card.open .result-details {
  display: block;
}

.check-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

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

.check-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.check-icon.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.check-icon.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.check-icon.info {
  background: var(--neutral-tint);
  color: var(--text-dim);
  font-style: italic;
}

.info-tag {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--neutral-tint);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.check-text .req {
  font-weight: 600;
  color: var(--text);
}

.check-text .detail {
  color: var(--text-dim);
  margin-top: 0.1rem;
}

.result-error {
  padding: 1rem 1.25rem;
  color: var(--bad);
  font-size: 0.85rem;
}

.global-error {
  margin-top: 1.5rem;
  color: var(--bad);
  background: var(--bad-bg);
  border: 1px solid rgba(179, 64, 47, 0.3);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .topbar {
    padding: 1rem 1.25rem;
  }

  .main {
    padding: 1.75rem 1.1rem 3rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .steps {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ---------- PDF preview modal ---------- */

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.pdf-modal[hidden] {
  display: none;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 28, 0.55);
}

.pdf-modal-panel {
  position: relative;
  width: min(900px, 100%);
  height: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.pdf-modal-title {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-modal-frame {
  flex: 1;
  border: none;
  width: 100%;
}

@media (max-width: 600px) {
  .pdf-modal {
    padding: 0.75rem;
  }
}
