:root {
  color-scheme: light;
  --page: #f2f5f9;
  --surface: #ffffff;
  --ink: #17233b;
  --muted: #637087;
  --line: #d9e0ea;
  --line-strong: #bbc7d8;
  --navy: #183a67;
  --navy-hover: #102c50;
  --blue-soft: #eef4fb;
  --green: #217348;
  --green-soft: #edf8f2;
  --red: #b42318;
  --red-soft: #fff2f0;
  --shadow: 0 10px 30px rgba(23, 35, 59, 0.07);
  font-family:
    "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo,
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, #eaf0f7 0, var(--page) 230px),
    var(--page);
  color: var(--ink);
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(47, 103, 174, 0.28);
  outline-offset: 3px;
}

.site-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(187, 199, 216, 0.8);
}

.header-inner,
.page-shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: 82px;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(24, 58, 103, 0.18);
}

.eyebrow,
.step-label {
  margin: 0;
  color: #4c6280;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: -2px 0 0;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.page-shell {
  padding: 54px 0 70px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 26px;
}

.intro h2,
.result-heading h2 {
  margin: 5px 0 8px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.intro p:not(.step-label) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.privacy-badge {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #bcd8c9;
  border-radius: 999px;
  background: var(--green-soft);
  color: #205c3c;
  font-size: 12px;
  font-weight: 700;
}

.privacy-badge svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#inventory-form,
.result-section {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.upload-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}

.number-badge {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.card-heading h3 {
  margin: 0;
  font-size: 16px;
}

.card-heading p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.drop-zone {
  display: flex;
  min-height: 218px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  border: 1.5px dashed #9baac0;
  border-radius: 7px;
  background: #f8fafc;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: #396da8;
  background: var(--blue-soft);
}

.drop-zone.is-dragging {
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-icon {
  display: grid;
  width: 52px;
  height: 58px;
  place-items: center;
  border: 1px solid #8aa3c1;
  border-radius: 5px 5px 9px 5px;
  background: #e9f0f8;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.file-icon.secondary {
  border-color: #91bda6;
  background: #eaf6ef;
  color: var(--green);
}

.drop-main {
  color: #263853;
  font-size: 13px;
  font-weight: 700;
}

.drop-help {
  color: var(--muted);
  font-size: 11px;
}

.choose-button {
  margin-top: 5px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: white;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.selection {
  display: flex;
  min-height: 218px;
  align-items: center;
  padding: 18px;
  gap: 12px;
  border: 1px solid #a7d1ba;
  border-radius: 7px;
  background: var(--green-soft);
}

.selection[hidden] {
  display: none;
}

.selection-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.selection-copy {
  min-width: 0;
  flex: 1;
}

.selection-copy strong,
.selection-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-copy strong {
  font-size: 13px;
}

.selection-copy span {
  margin-top: 3px;
  color: #52705e;
  font-size: 11px;
}

.clear-file {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #a7c7b5;
  border-radius: 4px;
  background: white;
  color: #315f47;
  font-size: 11px;
  font-weight: 700;
}

.field-error {
  min-height: 20px;
  margin: 6px 0 -6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.upload-card.has-error {
  border-color: #e2a29c;
  background: #fffdfd;
}

.error-summary {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #e8a7a1;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--red-soft);
  color: #7e2119;
}

.error-summary[hidden] {
  display: none;
}

.message-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.message-title svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.error-summary ul {
  margin: 6px 0 0 26px;
  padding: 0;
  font-size: 12px;
}

.process-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.process-notes > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}

.process-notes > div + div {
  border-left: 1px solid var(--line);
}

.note-icon {
  color: #6e819b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.process-notes p {
  margin: 0;
}

.process-notes strong,
.process-notes span {
  display: block;
}

.process-notes strong {
  font-size: 12px;
}

.process-notes p span {
  color: var(--muted);
  font-size: 10px;
}

.action-row {
  display: flex;
  align-items: center;
  flex-direction: column;
  margin-top: 26px;
}

.primary-button {
  min-width: min(100%, 360px);
  min-height: 52px;
  padding: 13px 24px;
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: white;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(24, 58, 103, 0.2);
  transition:
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--navy-hover);
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(24, 58, 103, 0.25);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #94a2b6;
  box-shadow: none;
}

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  margin-left: 9px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.primary-button.is-processing .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.result-section {
  margin-top: 24px;
  border-color: #b6d9c5;
  animation: appear 250ms ease both;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.result-section[hidden] {
  display: none;
}

.result-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.success-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 22px;
  font-weight: 900;
}

.step-label.success {
  color: var(--green);
}

.result-heading h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.metric-grid > div {
  padding: 15px 20px;
  text-align: center;
}

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

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

.metric-grid strong {
  margin-right: 3px;
  font-size: 28px;
  line-height: 1.2;
}

.metric-grid small {
  color: var(--muted);
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px;
  border-radius: 7px;
  background: #f2f6fb;
}

.download-panel strong,
.download-panel span {
  display: block;
}

.download-panel strong {
  font-size: 13px;
}

.download-panel span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.download-button {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid #9cacc1;
  border-radius: 5px;
  background: white;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.result-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

footer {
  padding: 20px;
  border-top: 1px solid var(--line);
  background: #e9eef5;
  color: #68778e;
  text-align: center;
  font-size: 11px;
}

footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .header-inner,
  .page-shell {
    width: min(100% - 24px, 1080px);
  }

  .page-shell {
    padding: 35px 0 52px;
  }

  .intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  #inventory-form,
  .result-section {
    padding: 18px;
  }

  .upload-grid,
  .process-notes {
    grid-template-columns: 1fr;
  }

  .process-notes > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .download-button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .header-inner {
    min-height: 70px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  h1 {
    font-size: 18px;
  }

  .intro h2 {
    font-size: 26px;
  }

  .upload-card {
    padding: 16px;
  }

  .drop-zone,
  .selection {
    min-height: 195px;
  }

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

  .metric-grid > div {
    padding: 13px 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
