:root {
  color-scheme: light;
  --ink: #17324d;
  --muted: #60758a;
  --line: #d8e3eb;
  --panel: #ffffff;
  --page: #edf4f8;
  --primary: #087f73;
  --primary-dark: #05675e;
  --info-bg: #eaf4ff;
  --info-border: #94bfe6;
  --success-bg: #e9f7f1;
  --success-border: #79c1a5;
  --danger-bg: #fff0ed;
  --danger-border: #e2a19a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(145deg, #f7fbfd 0%, var(--page) 72%);
}

button, input, select { font: inherit; }

.results-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; }
.subtitle { margin: 10px 0 0; color: var(--muted); }

.back-link, .button, .page-button {
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
  transition: background 120ms ease, transform 120ms ease;
}

.back-link {
  display: inline-flex;
  padding: 11px 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
}

.status-card, .report-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(34, 65, 89, 0.08);
}

.status-card { padding: 16px 18px; margin-bottom: 20px; white-space: pre-wrap; }
.status-card.info { background: var(--info-bg); border-color: var(--info-border); }
.status-card.success { background: var(--success-bg); border-color: var(--success-border); }
.status-card.error { background: var(--danger-bg); border-color: var(--danger-border); color: #8f2e29; }
.report-panel { overflow: hidden; }

.report-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.report-meta div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.report-meta div:last-child { border-right: 0; }
.report-meta span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.report-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 18px 20px;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.search-control { flex: 1 1 320px; }
.page-size-control { flex: 0 0 92px; }
.search-control span, .page-size-control span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
input, select { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); border: 1px solid #b8cad7; border-radius: 9px; background: #fff; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(8,127,115,0.22); outline-offset: 2px; }

.download-actions { display: flex; gap: 10px; margin-left: auto; }
.button, .page-button { min-height: 42px; padding: 9px 14px; border: 1px solid transparent; cursor: pointer; }
.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); }
.button.secondary, .page-button { color: var(--ink); border-color: #b8cad7; background: #fff; }
.button:disabled, .page-button:disabled { opacity: 0.48; cursor: not-allowed; }
.button:hover:not(:disabled), .page-button:hover:not(:disabled), .back-link:hover { transform: translateY(-1px); }

.download-note { margin: 0; padding: 12px 20px; color: #8f2e29; background: var(--danger-bg); border-bottom: 1px solid var(--danger-border); }
.table-wrap { overflow: auto; max-height: min(62vh, 720px); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #e7eef3; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #fff; background: #1e4964; font-size: 0.78rem; letter-spacing: 0.035em; text-transform: uppercase; }
tbody tr:nth-child(even) { background: #f7fafc; }
tbody tr:hover { background: #eaf5f5; }
td { font-size: 0.91rem; }
.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 20px; color: var(--muted); background: #fbfdfe; }
.pagination { display: flex; align-items: center; gap: 12px; }
.page-button { min-height: 36px; padding: 7px 11px; }

@media (max-width: 900px) {
  .report-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-meta div:nth-child(2) { border-right: 0; }
  .report-meta div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .table-toolbar { flex-wrap: wrap; }
  .download-actions { width: 100%; margin-left: 0; }
}

@media (max-width: 620px) {
  .results-shell { width: min(100% - 24px, 1480px); padding-top: 22px; }
  .results-header { flex-direction: column; }
  .report-meta { grid-template-columns: 1fr; }
  .report-meta div { border-right: 0; border-bottom: 1px solid var(--line); }
  .download-actions { flex-direction: column; }
  .button { width: 100%; }
  .table-footer { align-items: flex-start; flex-direction: column; }
}
