:root {
  color-scheme: light;
  --ink: #1d2329;
  --muted: #64707d;
  --line: #d9e0e7;
  --panel: #ffffff;
  --surface: #f4f7f8;
  --field: #fbfcfd;
  --green: #16805b;
  --amber: #a86a00;
  --red: #b73535;
  --blue: #255f85;
  --teal: #0f766e;
  --shadow: 0 18px 40px rgba(26, 39, 52, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 370px) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #eef3f2;
  border-right: 1px solid var(--line);
  padding: 24px;
  overflow: auto;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: #d8e8e5;
  color: var(--teal);
  border: 1px solid #bdd2ce;
  border-radius: 8px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.25rem;
  line-height: 1.25;
}

.brand p,
.eyebrow,
.field span,
small,
.audit-notes,
.empty-state,
.legend,
.count-badge {
  color: var(--muted);
}

.brand p {
  margin-top: 5px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar .panel + .panel {
  margin-top: 16px;
}

.panel h2,
.panel h3 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span {
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 95, 133, 0.16);
}

.drop-zone,
.document-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  border: 1px dashed #9fb1be;
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--ink);
  padding: 20px;
  text-align: center;
}

.drop-zone input,
.document-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon,
.document-drop span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--blue);
  background: #e7f0f5;
  border-radius: 8px;
}

.manual-add {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 12px;
}

.icon-button,
.primary-button,
.secondary-button {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  background: var(--ink);
  color: #fff;
}

.primary-button {
  background: var(--teal);
  color: #fff;
  padding: 0 16px;
}

.secondary-button {
  background: #e8eef2;
  color: #26323d;
  border: 1px solid #c7d2da;
  padding: 0 14px;
}

.secondary-button.compact {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.secondary-button.full {
  width: 100%;
  margin-top: 10px;
}

.import-status {
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.text-button {
  margin-top: 10px;
  background: transparent;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.text-button.danger {
  color: var(--red);
}

.text-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.checklist {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 8px 8px 10px;
  background: #f5f7f8;
  border: 1px solid #e1e7ec;
  border-radius: 8px;
  font-size: 0.9rem;
}

.checklist li.empty-checklist {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.checklist li input {
  min-height: 34px;
  padding: 7px 9px;
  background: #fff;
}

.remove-btn {
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}

.workspace {
  padding: 26px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 5px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.15;
}

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

.upload-band {
  margin-bottom: 18px;
}

.document-drop {
  min-height: 138px;
  background: #fbfcfd;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  margin-bottom: 18px;
}

.wide {
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h3 {
  margin: 0;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  background: #f0f4f6;
  border: 1px solid #dbe3e8;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.document-list {
  display: grid;
  gap: 12px;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.document-name {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.document-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-pill {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  min-height: 32px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.readable {
  color: var(--green);
  background: #dff3eb;
}

.status-pill.reference {
  color: var(--amber);
  background: #fff2d8;
}

.doc-notes {
  grid-column: 1 / -1;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.scoreboard div {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 82px;
  padding: 12px;
  background: #f6f8f9;
  border: 1px solid #e1e7ec;
  border-radius: 8px;
  text-align: center;
}

.scoreboard strong {
  font-size: 1.55rem;
}

.scoreboard span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.audit-notes {
  margin-top: 13px;
  line-height: 1.45;
}

.results-panel {
  box-shadow: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.complete {
  background: var(--green);
}

.dot.review {
  background: var(--amber);
}

.dot.missing {
  background: var(--red);
}

.results-list {
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(180px, 260px);
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
}

.result-row.complete {
  border-left-color: var(--green);
}

.result-row.review {
  border-left-color: var(--amber);
}

.result-row.missing {
  border-left-color: var(--red);
}

.result-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.result-status.complete {
  color: var(--green);
  background: #dff3eb;
}

.result-status.review {
  color: var(--amber);
  background: #fff2d8;
}

.result-status.missing {
  color: var(--red);
  background: #ffe5e5;
}

.result-title {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.result-evidence {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .document-row,
  .result-row {
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-self: start;
  }
}

@media (max-width: 820px) {
  body { -webkit-text-size-adjust: 100%; }
  .app-shell { min-height: auto; }
  .sidebar, .workspace { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .panel { padding: 14px; box-shadow: none; }
  .brand { grid-template-columns: 42px 1fr; }
  .brand-mark { width: 42px; height: 42px; }
  input, select, textarea, .icon-button, .primary-button, .secondary-button { min-height: 46px; }
  textarea { min-height: 104px; }
  .actions, .checklist-actions { justify-content: stretch; }
  .actions > *, .checklist-actions > *, .primary-button, .secondary-button { width: 100%; }
  .review-grid, .document-row, .scoreboard, .result-row { grid-template-columns: 1fr; }
  .status-pill { justify-self: start; width: fit-content; min-width: 128px; }
}

@media (max-width: 430px) {
  .manual-add { grid-template-columns: 1fr; }
  .icon-button { width: 100%; }
  .checklist li { grid-template-columns: 1fr; }
  .remove-btn { width: 100%; }
}
