:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #17202a;
  --muted: #617080;
  --line: #d8e0e8;
  --accent: #117a65;
  --accent-strong: #0b5d4d;
  --warning: #b9770e;
  --danger: #b42318;
  --success-bg: #e7f6ef;
  --danger-bg: #fdecec;
  --shadow: 0 10px 26px rgba(30, 45, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
}

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

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

.topbar h1,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
}

.section-heading h2 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  white-space: nowrap;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
}

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

.panel {
  padding: 20px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.horizontal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.field-group {
  margin-bottom: 16px;
}

.upload-zone {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 18px;
  border: 2px dashed #9db3c3;
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}

.upload-zone:focus-within,
input[type="file"]:focus + .upload-zone {
  outline: 3px solid rgba(17, 122, 101, 0.22);
}

input[type="file"] {
  width: 100%;
  margin-top: 8px;
}

.upload-label {
  font-size: 17px;
  font-weight: 800;
}

.upload-help,
.assistive-text,
.muted {
  color: var(--muted);
}

.file-name {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
}

.field-error,
.client-errors {
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.client-errors p {
  margin: 4px 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

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

.button:focus {
  outline: 3px solid rgba(17, 122, 101, 0.28);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.64;
  cursor: wait;
}

.wide {
  width: 100%;
}

.running-state {
  margin: 10px 0 0;
  color: var(--warning);
  font-weight: 700;
}

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

.alert p {
  margin: 2px 0 0;
}

.alert-success {
  background: var(--success-bg);
  border-color: #9cd8bd;
}

.alert-error {
  background: var(--danger-bg);
  border-color: #f3b5b5;
}

.output-list {
  display: grid;
  gap: 10px;
}

.output-list > div {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.output-list span {
  color: var(--muted);
}

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

.result-metrics div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.result-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.result-metrics strong {
  font-size: 20px;
}

.path-block {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #f8fbfc;
}

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

.path-block p,
.path-text {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty-state {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #9db3c3;
  border-radius: 8px;
  background: #fbfdff;
}

.empty-state p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.recent-table {
  display: grid;
  gap: 0;
  overflow-x: auto;
}

.recent-row {
  display: grid;
  grid-template-columns: 170px 80px minmax(320px, 1fr) 72px;
  gap: 12px;
  align-items: center;
  min-width: 720px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.recent-row.header {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  border-top: 0;
}

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

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

  .topbar h1 {
    font-size: 23px;
  }

  .layout-grid,
  .result-metrics {
    grid-template-columns: 1fr;
  }

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

  .output-list > div {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .recent-table {
    overflow-x: visible;
  }

  .recent-row.header {
    display: none;
  }

  .recent-row {
    grid-template-columns: 1fr;
    gap: 6px;
    min-width: 0;
    padding: 12px 0;
  }

  .recent-row > span {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .recent-row > span::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }
}
