:root {
  color-scheme: light dark;
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-strong: #f0f2f7;
  --text: #111827;
  --muted: #4b5563;
  --border: #d1d5db;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --accent: #9333ea;
  --danger: #dc2626;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #111827;
    --surface-strong: #1f2937;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --success: #34d399;
    --accent: #c084fc;
    --danger: #f87171;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 32%), var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

img,
svg {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: grid;
  gap: 24px;
  padding: 28px 0 24px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 2.5vw, 3rem);
  line-height: 1.05;
}

.hero-copy {
  max-width: 54rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.lang-toggle {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: inherit;
  border-radius: 999px;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.lang-toggle:hover {
  background: rgba(255,255,255,0.16);
}

main {
  display: grid;
  gap: 24px;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-header,
.section-title {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2,
.section-title h2 {
  margin: 0;
  font-size: 1.45rem;
}

.panel-header p,
.section-title p {
  margin: 0;
  color: var(--muted);
}

.secondary-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
}

.upload-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0;
}

.upload-card {
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 22px;
  background: var(--surface-strong);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-card:hover,
.upload-card:focus-within {
  border-color: var(--primary);
}

.upload-card h3 {
  margin: 0 0 10px;
}

.upload-card input[type="file"] {
  width: 100%;
  margin-top: 12px;
}

.upload-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.instructions-card {
  margin-top: 10px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.05);
}

.instructions-card h3 {
  margin-top: 0;
}

.instructions-card ol {
  margin: 12px 0 0;
  padding-left: 1.35rem;
  color: var(--muted);
}

.error-message {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
  display: none;
}

.stats-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: 20px;
}

.stat-card {
  padding: 20px;
  border-radius: 20px;
  background: var(--surface-strong);
}

.stat-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.stat-card strong {
  font-size: 2rem;
  line-height: 1;
}

.results-section .tab-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 12px 18px;
}

.tab-button.active {
  background: var(--primary);
  color: #ffffff;
  border-color: transparent;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 20px 0;
}

.control-label {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.control-label input,
.control-label select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.pagination-info {
  margin: 0;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pagination-current {
  min-width: 7.5rem;
  text-align: center;
  font-weight: 600;
  color: inherit;
}

.pagination-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.results-table th,
.results-table td {
  text-align: left;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  color: var(--muted);
  font-weight: 600;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table td strong {
  display: inline-block;
  color: var(--text);
}

.results-table td a {
  color: var(--primary);
  text-decoration: none;
}

.results-table td a:hover,
.results-table td a:focus {
  text-decoration: underline;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
}

.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.privacy-section p {
  margin: 0 0 1rem;
  line-height: 1.8;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
}

@media (max-width: 840px) {
  .upload-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .section-title,
  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px;
  }

  .results-table {
    min-width: 100%;
  }

  .results-table th,
  .results-table td {
    padding: 14px 12px;
  }

  .pagination-bar {
    align-items: stretch;
  }

  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .pagination-button {
    flex: 1;
  }
}