:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #656d76;
  --line: #d8dee4;
  --line-strong: #afb8c1;
  --accent: #0b5fff;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(31, 35, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.status {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

#pdfInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-button,
button,
select {
  border: 1px solid var(--ink);
  border-radius: 6px;
  min-height: 44px;
}

.upload-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
}

.upload-button {
  background: var(--ink);
  color: var(--accent-ink);
}

.upload-button span {
  font-size: 24px;
  line-height: 1;
}

button.secondary {
  background: var(--panel);
  color: var(--ink);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.list-panel {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.list-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
}

.check-all {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.sort-control {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select {
  min-width: 210px;
  padding: 0 38px 0 12px;
  background: var(--panel);
  color: var(--ink);
}

.pdf-list {
  display: grid;
  gap: 0;
  max-height: min(62vh, 620px);
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.pdf-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.pdf-item:last-child {
  border-bottom: 0;
}

.pdf-name {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.pdf-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.remove-one {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 300px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
}

.empty-state span {
  max-width: 420px;
  line-height: 1.45;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding: 14px 0;
  }

  .toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .actions {
    justify-content: stretch;
  }

  .upload-button,
  button.primary,
  button.secondary {
    flex: 1 1 160px;
  }

  .list-header {
    align-items: stretch;
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  select {
    min-width: 0;
    width: min(230px, 58vw);
  }

  .pdf-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 12px;
  }
}
