:root {
  color-scheme: light;
  --navy: #07347f;
  --navy-deep: #052c6e;
  --blue: #075cf0;
  --blue-hover: #004acb;
  --page: #eef3f9;
  --panel: #ffffff;
  --text: #182235;
  --muted: #61759b;
  --line: #d7e0ed;
  --success: #15803d;
  --success-bg: #ddf3e2;
  --danger: #d52d32;
  --danger-bg: #fde3e3;
  --warning: #9a5b00;
  --warning-bg: #fff0cc;
  --error: #8d3ab8;
  --error-bg: #f1e3fa;
  --shadow: 0 6px 18px rgba(32, 55, 88, .13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
  font-family: 'Manrope', 'Aptos', 'Inter', 'Calibri', sans-serif;
  font-size: 16px;
}

button, textarea { font: inherit; }

.page-shell { width: min(100% - 64px, 1560px); margin-inline: auto; }

.site-header {
  background: linear-gradient(120deg, var(--navy-deep), var(--navy));
  color: #fff;
  padding: 27px 0 29px;
}

.site-header h1 { margin: 0; font-size: clamp(1.65rem, 2.3vw, 2.45rem); line-height: 1.15; letter-spacing: .01em; font-weight: 700; }
.site-header p { margin: 14px 0 0; font-size: clamp(1rem, 1.25vw, 1.28rem); }
.main-content { padding-block: 30px 42px; }
.panel { background: var(--panel); border-radius: 6px; box-shadow: var(--shadow); padding: 28px 32px; }
.panel + .panel { margin-top: 28px; }
.panel h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; font-weight: 700; }
.input-panel label { display: block; margin: 10px 0 13px; color: var(--muted); font-size: .98rem; }

textarea {
  display: block;
  width: 100%;
  min-height: 174px;
  resize: vertical;
  border: 1px solid #b9cbe3;
  border-radius: 4px;
  padding: 18px 20px;
  color: #182235;
  background: #fff;
  line-height: 1.75;
  transition: border-color .15s, box-shadow .15s;
}

textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7, 92, 240, .16); }
.input-actions { display: flex; gap: 18px; margin-top: 22px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #bdcde2;
  border-radius: 4px;
  padding: 0 20px;
  background: #fff;
  color: #202838;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}

.button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.button:hover:not(:disabled) { border-color: #8ba6c8; background: #f6f9fd; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:focus-visible, .subject-text:focus-visible, .table-scroll:focus-visible { outline: 3px solid rgba(7, 92, 240, .35); outline-offset: 2px; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-primary { min-width: 190px; background: var(--blue); border-color: var(--blue); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--blue-hover); border-color: var(--blue-hover); }
.button.is-loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.input-message { margin: 14px 0 0; color: var(--danger); font-weight: 600; }
.input-message.is-success { color: var(--success); }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 16px 12px; }
.copy-all { min-height: 44px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }

table { width: 100%; min-width: 1340px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 14px 16px; text-align: left; vertical-align: middle; }
th { height: 54px; background: var(--navy); color: #fff; font-size: .9rem; font-weight: 700; white-space: nowrap; }
th:nth-child(1) { width: 145px; } th:nth-child(2) { width: 150px; } th:nth-child(3) { width: 116px; }
th:nth-child(4) { width: 276px; } th:nth-child(5) { width: 104px; } th:nth-child(6) { width: 126px; }
th:nth-child(7) { width: auto; } th:nth-child(8) { width: 170px; }
th:nth-child(5), th:nth-child(6), td:nth-child(5), td:nth-child(6) { text-align: center; }
tbody tr { height: 96px; border-bottom: 1px solid var(--line); }
tbody tr:last-child { border-bottom: 0; }
td { font-size: .91rem; font-weight: 500; }
.ada-cell, .number-cell, .date-cell { white-space: nowrap; }
.number-cell { font-weight: 700; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 4px; white-space: nowrap; font-size: .84rem; font-weight: 600; }
.status-badge::before { display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid currentColor; border-radius: 50%; font-size: 11px; line-height: 1; }
.status-found { color: var(--success); background: var(--success-bg); }.status-found::before { content: '✓'; }
.status-not_found { color: var(--danger); background: var(--danger-bg); }.status-not_found::before { content: '×'; }
.status-invalid { color: var(--warning); background: var(--warning-bg); }.status-invalid::before { content: '!'; }
.status-error { color: var(--error); background: var(--error-bg); }.status-error::before { content: '!'; }
.table-button { min-height: 40px; padding: 0 12px; border-color: #d0dbea; color: var(--blue); font-size: .8rem; white-space: nowrap; }
.table-button svg { width: 19px; height: 19px; }
.empty-action { color: #687386; text-align: center; }
.subject-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.42; cursor: help; }
.subject-tooltip {
  position: fixed; z-index: 50; width: min(520px, calc(100vw - 32px)); max-height: min(320px, calc(100vh - 32px)); overflow-y: auto;
  padding: 12px 14px; border-radius: 4px; background: #172238; color: #fff; box-shadow: 0 7px 22px rgba(0,0,0,.25);
  font-size: .84rem; line-height: 1.5; pointer-events: none;
}
.results-note { margin: 22px 12px 0; color: var(--muted); font-size: .9rem; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 20; max-width: 390px; padding: 13px 18px; border-radius: 5px; background: #172238; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.22); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 28px, 1560px); }
  .panel { padding: 22px 18px; }
  .results-toolbar { align-items: stretch; flex-direction: column; margin-left: 0; }
  .copy-all { align-self: flex-start; }
  .input-actions { gap: 10px; flex-wrap: wrap; }
  .button-primary { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
