:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #d9dee5;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --warning-bg: #fff7ed;
  --warning-text: #9a3412;
  --ok-bg: #ecfdf3;
  --ok-text: #166534;
  --low-bg: #fef2f2;
  --low-text: #991b1b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  margin-bottom: 28px;
}

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

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
}

.lead {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.search-card,
.results-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}

.search-card {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  background: var(--card);
}

textarea {
  resize: vertical;
  padding: 12px 14px;
}

input {
  width: 92px;
  padding: 10px 12px;
}

select {
  width: auto;
  padding: 10px 32px 10px 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235f6b7a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(37, 99, 235, 0.15);
}

.controls {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
}

.control-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 11px 20px;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--low-text);
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 22px;
}

#summary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td {
  font-size: 14px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.flag {
  display: inline-block;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.flag.high_confidence {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.flag.needs_review,
.flag.modifier_conflict {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.flag.low_confidence {
  background: var(--low-bg);
  color: var(--low-text);
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1100px);
    padding: 28px 0;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .control-group {
    width: 100%;
  }

  input,
  select {
    width: 100%;
  }
}
