:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --ink: #1f2933;
  --muted: #65717c;
  --line: #d8e0e5;
  --accent: #176f6b;
  --accent-strong: #105a56;
  --danger: #9f2d2d;
  --shadow: 0 18px 48px rgba(27, 44, 55, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

.app-header {
  display: flex;
  align-items: flex-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 {
  margin: 0;
  line-height: 1.25;
}

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

h2 {
  font-size: 18px;
}

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

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

.tool-panel,
.result-panel {
  padding: 18px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.7fr) minmax(180px, 0.7fr) minmax(140px, 0.5fr) 112px;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

input,
select,
button,
.download {
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

input[type="file"] {
  padding: 8px;
}

input:focus,
select:focus,
button:focus,
.download:focus {
  outline: 3px solid rgba(23, 111, 107, 0.2);
  outline-offset: 2px;
}

.primary,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.result-panel {
  margin-top: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.result-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-color: rgba(159, 45, 45, 0.28);
  background: #fff6f4;
  color: var(--danger);
  font-weight: 700;
}

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

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .result-list {
    grid-template-columns: 1fr;
  }

  .primary {
    width: 100%;
  }
}
