:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --line: #cfd5db;
  --line-strong: #aeb8c2;
  --text: #17202a;
  --muted: #596470;
  --accent: #24637d;
  --accent-dark: #16465c;
  --success: #256d45;
  --danger: #a13838;
  --warning-bg: #fff7df;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1360px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 36px 0 42px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.25;
}

h2 {
  font-size: 22px;
  line-height: 1.3;
}

.lead {
  max-width: 900px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

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

.status-pill.is-working {
  border-color: #d5b85d;
  background: #fff8df;
  color: #735c12;
}

.status-pill.is-success {
  border-color: #9dc7aa;
  background: #edf8f1;
  color: var(--success);
}

.status-pill.is-error {
  border-color: #d9a3a3;
  background: #fff1f1;
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.input-panel {
  padding: 30px;
}

.result-stack {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.result-stack .panel {
  padding: 28px 30px;
}

.panel-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.panel-heading p,
.field-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drop-zone {
  display: grid;
  gap: 7px;
  min-height: 96px;
  padding: 20px 22px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfb;
  cursor: pointer;
}

.drop-zone:focus-within,
.drop-zone.is-dragover {
  border-color: var(--accent);
  background: #f0f7fa;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-weight: 700;
}

.drop-copy {
  color: var(--muted);
  line-height: 1.5;
}

.field-hint {
  margin: 10px 0 26px;
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

input:focus {
  outline: 3px solid rgba(36, 99, 125, 0.18);
  border-color: var(--accent);
}

input:disabled {
  color: #6c737c;
  background: #f2f4f5;
}

.policy-box {
  display: grid;
  gap: 7px;
  margin: 26px 0;
  border: 1px solid #e0d2a5;
  border-radius: 6px;
  padding: 16px;
  background: var(--warning-bg);
  color: #4c4126;
  font-size: 13px;
  line-height: 1.55;
}

.primary-action,
.secondary-action {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  min-height: 56px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.primary-action:disabled {
  cursor: progress;
  background: #7892a0;
}

.secondary-action {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-action:disabled {
  cursor: progress;
  color: #7c858f;
  background: #f2f4f5;
}

.message-area {
  min-height: 28px;
  margin-bottom: 16px;
}

.message {
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.message.success {
  border: 1px solid #a6cdb2;
  background: #edf8f1;
  color: var(--success);
}

.message.error {
  border: 1px solid #dfa6a6;
  background: #fff1f1;
  color: var(--danger);
}

.message.warning {
  border: 1px solid #e0d2a5;
  background: var(--warning-bg);
  color: #4c4126;
}

.result-table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
}

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

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

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px 14px;
}

.file-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.file-name {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-sub {
  color: var(--muted);
  font-size: 12px;
}

.file-link {
  flex: 0 0 auto;
  border-radius: 6px;
  padding: 9px 12px;
  background: #eef4f7;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100vw - 28px, 720px);
    padding-top: 22px;
  }

  .app-header,
  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  h1 {
    font-size: 26px;
  }

  .input-panel,
  .result-stack .panel {
    padding: 22px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
