:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --line: #d8dee8;
  --text: #172033;
  --muted: #667085;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --warning-bg: #fff7ed;
  --warning-line: #fed7aa;
  --warning-text: #9a3412;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.5;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 20px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.is-warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.input-panel,
.table-section,
.warnings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 16px;
}

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

textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #fbfcfe;
  color: var(--text);
  font-family: Consolas, "Malgun Gothic", monospace;
  font-size: 14px;
  outline: none;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

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

.primary-button {
  background: var(--blue);
  color: white;
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
}

.secondary-button,
.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover,
.ghost-button:hover {
  background: var(--surface-muted);
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  color: var(--blue);
  font-size: 34px;
  line-height: 1;
}

.warnings {
  margin-bottom: 18px;
  padding: 18px 20px;
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.warnings h2 {
  font-size: 16px;
}

.warnings ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.is-hidden {
  display: none;
}

.table-section {
  overflow: hidden;
}

.table-section .section-head {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-muted);
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 13px;
}

tbody tr:hover {
  background: #f8fbff;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.recognized-cell {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.recognized-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--blue-dark);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.strong-cell {
  color: var(--blue);
  font-weight: 800;
}

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

.has-warning {
  background: #fffbeb;
}

.tables-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid,
  .tables-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    padding: 16px;
  }

  .summary-card strong {
    font-size: 30px;
  }

  .input-panel {
    padding: 16px;
  }

  .action-row button {
    flex: 1 1 130px;
  }
}
