:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-subtle: #eef3f1;
  --line: #cfd8d4;
  --line-strong: #9aa9a4;
  --text: #1b2321;
  --muted: #64716d;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warning: #a05a00;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(18, 34, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  letter-spacing: 0;
}

body {
  min-width: 320px;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
  color: var(--muted);
}

.status-pill {
  min-width: 104px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ok {
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.35);
  background: #e6f4f1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  gap: 18px;
  align-items: start;
}

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

.form-panel,
.review-panel {
  padding: 18px;
}

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

.panel-header.compact {
  margin-bottom: 12px;
}

.panel-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field,
.check-field {
  display: grid;
  gap: 6px;
}

.field span,
.upload-label,
.check-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
}

.field input:focus-visible,
.upload-box:focus-within,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.check-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface-subtle);
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.upload-box {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  margin-top: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
  cursor: pointer;
}

.upload-box.secondary {
  min-height: 62px;
  background: var(--surface-subtle);
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 38px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

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

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.metric-grid div {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: var(--surface-subtle);
}

.metric-grid div + div {
  border-left: 1px solid var(--line);
}

.metric-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-grid strong {
  font-size: 22px;
}

.list-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-list,
.warning-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li,
.warning-list li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  background: #fff;
  font-size: 13px;
}

.warning-list li {
  border-color: rgba(160, 90, 0, 0.35);
  color: var(--warning);
  background: #fff8ea;
}

.empty {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  background: #fff !important;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-weight: 800;
}

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

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

.danger-text {
  color: var(--danger);
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 16px;
  }

  .topbar,
  .workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace {
    gap: 12px;
  }
}

@media (max-width: 560px) {
  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .upload-box {
    grid-template-columns: 1fr;
  }

  .upload-action {
    width: 100%;
  }
}
