:root {
  --bg: #ffffff;
  --soft: #f6f7f9;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #667085;
  --blue: #2f6fed;
  --blue-soft: #edf4ff;
  --danger: #c2410c;
  --radius: 12px;
  --font: "IBM Plex Sans", "Noto Sans JP", "BIZ UDPGothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--soft);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-header,
.app-main {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
}

.app-header {
  padding: 40px 0 24px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 8vw, 3.1rem);
  line-height: 1.12;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.app-main {
  padding-bottom: 72px;
}

.notice,
.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.notice {
  color: var(--muted);
  font-size: 0.88rem;
}

.notice p {
  margin-bottom: 4px;
}

.notice p:last-child {
  margin-bottom: 0;
}

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

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.4;
}

.file-picker {
  display: flex;
  min-height: 48px;
  margin-bottom: 14px;
  padding: 11px 14px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.file-picker input {
  display: none;
}

.preview-box {
  display: flex;
  min-height: 220px;
  margin-bottom: 14px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.preview-box img {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

.button.primary {
  width: 100%;
  min-height: 52px;
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button.quiet:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.button:disabled {
  border-color: var(--line);
  background: #f3f4f6;
  color: var(--muted);
  cursor: default;
}

.status {
  min-height: 1.7em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status.is-error {
  color: var(--danger);
}

.warnings {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--danger);
  font-size: 0.84rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

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

th,
td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

td:last-child,
th:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td input {
  width: 100%;
  min-width: 96px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

td input:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(47, 111, 237, 0.12);
}

.result-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.row-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .app-header,
  .app-main {
    width: min(100% - 28px, 920px);
  }

  .app-header {
    padding-top: 34px;
  }

  .notice,
  .panel {
    padding: 14px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .preview-box {
    min-height: 260px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}
