:root {
  --import-ink: #17342f;
  --import-green: #1f6b58;
  --import-mint: #d9eee6;
  --import-coral: #e27453;
  --import-paper: #fbfaf4;
  --import-line: #d7ded8;
}

body {
  background:
    radial-gradient(circle at 86% 8%, rgba(226, 116, 83, .12), transparent 27rem),
    linear-gradient(135deg, #f4f7f1 0%, #fbfaf4 48%, #edf5f0 100%);
}

.order-import-main {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.import-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding: 14px 4px 30px;
}

.import-hero h2 {
  max-width: 760px;
  margin: 5px 0 8px;
  color: var(--import-ink);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.18;
  letter-spacing: .02em;
}

.import-hero p:last-child { color: #5a6d68; }

.import-steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.import-steps li {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 80px;
  color: #82908c;
  font-size: 12px;
  font-weight: 700;
}

.import-steps span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--import-line);
  border-radius: 50%;
  background: var(--import-paper);
}

.import-steps .is-current { color: var(--import-green); }
.import-steps .is-current span { border-color: var(--import-green); background: var(--import-green); color: white; }

.import-panel,
.import-result {
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid rgba(31, 107, 88, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 18px 55px rgba(25, 61, 51, .08);
  backdrop-filter: blur(12px);
}

.import-panel { padding: 28px; }

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

.panel-heading h2,
.import-result h2 { margin: 2px 0 0; color: var(--import-ink); font-size: 24px; }
.step-label { margin: 0; color: var(--import-coral); font-size: 11px; font-weight: 800; letter-spacing: .16em; }

.sheet-link {
  color: var(--import-green);
  font-weight: 750;
  text-underline-offset: 4px;
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(360px, 1.2fr);
  gap: 22px;
  margin-bottom: 22px;
}

.source-grid .field { margin: 0; }
.source-grid input { width: 100%; }

.sheet-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sheet-chip {
  border: 1px solid var(--import-line);
  border-radius: 999px;
  padding: 7px 12px;
  background: white;
  color: var(--import-ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.sheet-chip:hover,
.sheet-chip.is-active { border-color: var(--import-green); background: var(--import-mint); }
.sheet-chip small { margin-left: 5px; color: var(--import-green); }
.field-note { min-height: 20px; margin: 8px 2px 0; color: #687a75; font-size: 12px; }

.copy-guide {
  position: relative;
  padding: 18px 20px 18px 58px;
  border-radius: 13px;
  background: var(--import-ink);
  color: #effaf6;
}

.copy-guide::before {
  position: absolute;
  left: 20px;
  top: 21px;
  content: "C:Q";
  color: #91cfba;
  font-family: Consolas, monospace;
  font-weight: 800;
}

.copy-guide p { margin: 6px 0; }
.copy-guide small { color: #b8ccc5; }

.google-load-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid rgba(31, 107, 88, .22);
  border-radius: 14px;
  padding: 20px;
  background:
    linear-gradient(110deg, rgba(217, 238, 230, .85), rgba(255, 255, 255, .96)),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(31, 107, 88, .06) 31px 32px);
}
.google-load-card strong { color: var(--import-ink); font-size: 18px; }
.google-load-card p { max-width: 720px; margin: 5px 0 0; color: #577068; font-size: 13px; }
.google-load-button { min-width: 270px; }
.google-account-field {
  display: grid;
  gap: 5px;
  max-width: 460px;
  margin-top: 12px;
  color: var(--import-ink);
  font-size: 12px;
  font-weight: 750;
}
.google-account-field input {
  width: 100%;
  border: 1px solid #91ad9f;
  border-radius: 9px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .94);
  color: var(--import-ink);
  font: inherit;
  font-size: 14px;
}
.google-account-field input:focus { border-color: var(--import-green); outline: 3px solid rgba(31, 107, 88, .12); }
.google-account-field input[readonly] {
  border-color: #b9cbc3;
  background: rgba(240, 246, 243, .94);
  color: #35564c;
  cursor: default;
}

.manual-import {
  margin-top: 16px;
  border-top: 1px solid var(--import-line);
  color: #60716c;
}
.manual-import summary {
  padding: 16px 2px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.manual-import-content { padding-top: 15px; }
.paste-field { display: grid; gap: 8px; color: var(--import-ink); font-weight: 750; }
.paste-field textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px dashed #9eb6ae;
  border-radius: 13px;
  padding: 16px;
  background: #fcfdfb;
  color: #203d36;
  font: 13px/1.55 Consolas, "Yu Gothic UI", sans-serif;
}
.paste-field textarea:focus { border-style: solid; border-color: var(--import-green); outline: 3px solid rgba(31, 107, 88, .12); }

.source-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}
.source-actions > span { color: #60716c; font-size: 13px; }

.import-message {
  margin: 16px 0 0;
  border-radius: 9px;
  padding: 11px 13px;
  background: var(--import-mint);
  color: var(--import-ink);
}
.import-message.is-error { background: #fde8e2; color: #8b301f; }

.selection-actions { display: flex; gap: 8px; }
.preview-counts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; }

.sequence-check {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(250px, .8fr) minmax(220px, 1fr);
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.sequence-number-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  min-height: 118px;
  padding: 18px 20px;
  border: 1px solid #b8ccc3;
  border-radius: 14px;
  background: linear-gradient(135deg, #f6faf8, #e7f1ed);
}

.sequence-number-card::after {
  position: absolute;
  right: -16px;
  bottom: -38px;
  width: 96px;
  height: 96px;
  border: 18px solid rgba(31, 107, 88, .08);
  border-radius: 50%;
  content: "";
}

.sequence-number-card.is-difference {
  border-color: #e5b583;
  background: linear-gradient(135deg, #fffaf2, #f8ead7);
}

.sequence-number-card > span { color: #64766f; font-size: 12px; font-weight: 750; }
.sequence-number-card > strong {
  position: relative;
  z-index: 1;
  color: var(--import-ink);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(30px, 3vw, 44px);
  letter-spacing: .03em;
  line-height: 1;
}
.sequence-number-card > small { color: #71817c; font-size: 11px; }

.sequence-bridge {
  display: grid;
  place-content: center;
  gap: 5px;
  min-height: 118px;
  padding: 14px 18px;
  border: 1px dashed #9fb4aa;
  border-radius: 14px;
  background: #f8fbfa;
  text-align: center;
}

.sequence-arrow { color: #6e887e; font-size: 24px; line-height: 1; }
.sequence-bridge strong { color: #48665c; font-size: 15px; }
.sequence-bridge small { color: #71817c; font-size: 11px; }
.sequence-bridge[data-status="connected"] { border-color: #66a58f; background: #e9f6f0; }
.sequence-bridge[data-status="connected"] strong { color: #14634e; }
.sequence-bridge[data-status="gap"],
.sequence-bridge[data-status="overlap"] { border-color: #dd9a55; background: #fff4e5; }
.sequence-bridge[data-status="gap"] strong,
.sequence-bridge[data-status="overlap"] strong { color: #9a4d14; }
.sequence-bridge[data-status="unknown"] { border-color: #cf8f82; background: #fff1ee; }
.sequence-bridge[data-status="unknown"] strong { color: #8b301f; }

.count-card {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 130px;
  border-radius: 10px;
  padding: 10px 14px;
  background: #eff3f0;
  color: #566761;
}
.count-card strong { color: var(--import-ink); font-size: 22px; }
.count-new { background: var(--import-mint); }
.count-warning { background: #fff1cf; }
.count-existing { background: #edf0f2; }
.count-error { background: #fde4dc; }

.import-table-frame {
  overflow: auto;
  max-height: 620px;
  border: 1px solid var(--import-line);
  border-radius: 12px;
}
.import-table { width: 100%; min-width: 1450px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.import-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 11px 10px;
  background: var(--import-ink);
  color: white;
  text-align: left;
  white-space: nowrap;
}
.import-table td { border-bottom: 1px solid #e3e8e4; padding: 10px; vertical-align: top; }
.import-table tr:last-child td { border-bottom: 0; }
.import-table tr.is-muted td { background: #f4f5f4; color: #75807d; }
.import-table tr.is-warning td { background: #fffdf5; }
.import-table tr.is-error td { background: #fff5f2; }
.import-table td:nth-child(1),
.import-table td:nth-child(2),
.import-table th:nth-child(1),
.import-table th:nth-child(2) { position: sticky; z-index: 1; left: 0; }
.import-table td:nth-child(2),
.import-table th:nth-child(2) { left: 54px; }
.import-table td:nth-child(1),
.import-table td:nth-child(2) { background: white; }
.import-table tr.is-muted td:nth-child(-n+2) { background: #f4f5f4; }
.import-table tr.is-warning td:nth-child(-n+2) { background: #fffdf5; }
.import-table tr.is-error td:nth-child(-n+2) { background: #fff5f2; }
.import-checkbox { width: 18px; height: 18px; accent-color: var(--import-green); }

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--import-mint);
  color: var(--import-green);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.status-incomplete { background: #fff0c7; color: #7b5700; }
.status-already_imported { background: #e8ecee; color: #536169; }
.status-error { background: #fbded5; color: #9b3823; }
.message-list { margin: 0; padding-left: 17px; color: #735929; }
.message-list.is-error { color: #9b3823; }
.no-message { color: #93a09c; }

.commit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--import-line);
  padding-top: 20px;
}
.commit-bar div { display: grid; gap: 3px; }
.commit-bar strong { color: var(--import-ink); font-size: 18px; }
.commit-bar small { color: #687a75; }

.import-result {
  padding: 40px;
  border-color: rgba(31, 107, 88, .4);
  background: var(--import-ink);
  color: white;
}
.import-result h2 { color: white; }
.import-result .step-label { color: #91cfba; }
.result-actions { display: flex; gap: 10px; margin-top: 22px; }

@media (max-width: 900px) {
  .order-import-main { width: min(100% - 24px, 1500px); padding-top: 20px; }
  .import-hero { display: block; }
  .import-steps { margin-top: 24px; }
  .source-grid { grid-template-columns: 1fr; }
  .panel-heading, .commit-bar, .google-load-card { align-items: flex-start; flex-direction: column; }
  .google-load-button { width: 100%; min-width: 0; }
  .selection-actions { width: 100%; overflow-x: auto; }
  .sequence-check { grid-template-columns: 1fr; }
  .sequence-bridge { min-height: 92px; }
  .sequence-arrow { transform: rotate(90deg); }
  .import-panel { padding: 20px; }
}

@media (max-width: 560px) {
  .import-hero h2 { font-size: 31px; }
  .source-actions, .result-actions { align-items: stretch; flex-direction: column; }
  .source-actions .button, .commit-bar .button, .result-actions .button { width: 100%; text-align: center; }
  .copy-guide { padding-left: 20px; }
  .copy-guide::before { position: static; display: block; margin-bottom: 5px; }
}
