:root {
  --bg: #eef1f8;
  --ink: #1a2840;
  --muted: #5a6a82;
  --line: #ccd3e4;
  --line-strong: #9dacc4;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --navy: #2b3b59;
  --navy-2: #3d5480;
  --navy-soft: #e4e9f5;
  --blue: #2b5bd4;
  --blue-soft: #e8ecf5;
  --cream: #f8faff;
  --danger: #c0392b;
  --shadow: 0 8px 32px rgba(15, 30, 53, 0.09), 0 1px 4px rgba(15, 30, 53, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 30, 53, 0.11);
  --font-sans: "IBM Plex Sans KR", "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-display: "Pretendard Variable", Pretendard, "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 8% 0%, rgba(43, 59, 89, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #f5f7fc 0%, var(--bg) 50%, #e8edf7 100%);
  font-family: var(--font-sans);
  font-weight: 500;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.text-link {
  min-height: 40px;
  border: 1.5px solid rgba(43, 59, 89, 0.22);
  border-radius: 12px;
  padding: 9px 16px;
  color: var(--navy);
  background: var(--surface-solid);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button:hover,
.text-link:hover {
  border-color: rgba(43, 59, 89, 0.42);
  box-shadow: 0 4px 12px rgba(43, 59, 89, 0.1);
  transform: translateY(-1px);
}

.primary-btn {
  border-color: var(--navy);
  color: #ffffff;
  background: var(--navy);
  box-shadow: 0 6px 20px rgba(43, 59, 89, 0.28);
}

.primary-btn:hover {
  background: var(--navy-2);
  border-color: var(--navy-2);
  box-shadow: 0 8px 24px rgba(43, 59, 89, 0.34);
}

.ghost-btn {
  color: var(--ink);
}

.hero {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 2px 40px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.author-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(191, 156, 55, 0.62);
  border-radius: 10px;
  padding: 10px 16px 11px;
  color: #2b3b59;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background:
    linear-gradient(180deg, rgba(255, 254, 244, 0.96), rgba(255, 250, 225, 0.9));
  box-shadow:
    0 14px 30px rgba(116, 88, 24, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  line-height: 1.05;
}

.author-badge-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #8b6a12;
  text-transform: uppercase;
  line-height: 1;
}

.author-crown {
  display: inline-block;
  margin-right: 4px;
  color: #b58a18;
  font-size: 12px;
  transform: translateY(-1px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
}

.hero-copy {
  min-height: 340px;
  border: 1.5px solid var(--line);
  border-radius: 28px;
  padding: clamp(32px, 5.5vw, 56px);
  background: var(--cream);
  box-shadow: var(--shadow-lg);
}

.eyebrow,
.step-label,
.card-kicker {
  font-family: var(--font-mono);
  margin: 0 0 14px;
  color: var(--navy-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: clamp(56px, 9vw, 92px);
  font-weight: 950;
  line-height: 0.88;
  letter-spacing: -0.055em;
  word-break: keep-all;
}

h2 {
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.lead {
  max-width: 520px;
  margin-bottom: 32px;
  color: #3a4e6a;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.8;
}

.hero-actions,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-card {
  display: grid;
  align-content: start;
  gap: 0;
  border: 1.5px solid var(--line);
  border-radius: 28px;
  padding: 28px 28px 32px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
}

.card-kicker {
  margin-bottom: 20px;
}

.total-line {
  display: grid;
  gap: 3px;
  padding: 18px 0 0;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}

.total-line:first-of-type {
  margin-top: 0;
}

.total-line span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.total-line strong {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 950;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--ink);
}

.total-line.emphasis {
  margin-top: 8px;
  border: 1.5px solid rgba(43, 59, 89, 0.2);
  border-radius: 16px;
  padding: 16px 18px 18px;
  background: var(--navy-soft);
}

.total-line.emphasis strong {
  color: var(--navy);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto 56px;
}

.guide-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 2px 0 18px;
}

.step-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 14px 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.step-chip b {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--navy);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.step-chip span {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.input-section {
  margin-bottom: 14px;
}

.section-label-row {
  margin-bottom: 14px;
}

.section-label-row h2 {
  margin-bottom: 0;
}

.panel-sub {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel-desc {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.input-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-section {
  margin-bottom: 14px;
}

.settings-section .settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tool-panel,
.table-section {
  border: 1.5px solid var(--line);
  border-radius: 24px;
  padding: 26px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.accent-panel {
  background: linear-gradient(160deg, #edf1f8 0%, #f5f8fd 100%);
}

.section-head p:not(.step-label),
.table-toolbar p:not(.step-label) {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: #2d3b55;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.name-mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.name-mode-group label {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.name-mode-group label:has(input:checked) {
  border-color: rgba(47, 95, 221, 0.55);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 95, 221, 0.12);
}

.name-mode-group input {
  width: auto;
  margin: 0;
  accent-color: var(--blue);
}

.name-mode-group strong {
  font-size: 14px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.name-mode-group small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 95, 221, 0.65);
  box-shadow: 0 0 0 4px rgba(47, 95, 221, 0.1);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.upload-box {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  border: 1.5px dashed rgba(43, 59, 89, 0.3);
  border-radius: 18px;
  padding: 20px;
  background: rgba(232, 237, 248, 0.65);
  cursor: pointer;
}

.upload-box span {
  color: var(--navy);
  font-weight: 900;
}

.upload-box small {
  color: var(--muted);
}

.upload-box input {
  display: none;
}

.upload-box.drag-over {
  border-color: var(--navy);
  background: rgba(232, 237, 248, 1);
}

.excel-upload-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.excel-upload-divider::before,
.excel-upload-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.excel-upload-box {
  background: rgba(228, 233, 245, 0.35);
  border-color: rgba(43, 59, 89, 0.22);
}

.excel-upload-box span {
  color: var(--navy-2);
}

#excelStatus {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.preview-wrap {
  position: relative;
}

.preview-wrap img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 22px;
  width: 22px;
  padding: 0;
  border-radius: 999px;
  border-color: transparent;
  background: rgba(0,0,0,0.55);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.preview-remove:hover {
  background: rgba(190,59,50,0.85);
  transform: none;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 16, 32, 0.88);
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  min-height: 36px;
  width: 36px;
  padding: 0;
  border-radius: 50%;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.22);
  transform: none;
}

.ocr-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -2px 0 16px;
  flex-wrap: wrap;
}

.ocr-actions span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.table-section {
  margin-top: 0;
}

.table-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 7px;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: #f0f3fa;
  color: #2d3e58;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-align: left;
}

td {
  font-weight: 650;
}

.empty-row td {
  padding: 32px 16px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

td:first-child,
th:first-child {
  width: 58px;
  text-align: center;
}

td:nth-child(4),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8) {
  text-align: right;
}

td input[type="checkbox"] {
  width: auto;
}

.row-input {
  min-width: 72px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.download-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.download-guide {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.download-guide strong {
  color: var(--ink);
  font-weight: 900;
}

button:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none !important;
}

.name-input {
  min-width: 380px;
}

.select-col {
  width: 36px;
  text-align: center !important;
}

.row-selected td {
  background: rgba(47, 95, 221, 0.04);
}

.merge-btn {
  border-color: var(--navy-2);
  color: #ffffff;
  background: var(--navy-2);
  box-shadow: 0 6px 20px rgba(43, 59, 89, 0.22);
}

.merge-btn:hover:not(:disabled) {
  background: var(--navy);
  border-color: var(--navy);
}

.remove-btn,
.danger-btn {
  border-color: rgba(190, 59, 50, 0.24);
  color: var(--danger);
}

.mode-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.mode-chip {
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  border-color: var(--line);
  color: var(--muted);
  background: #f2f5fa;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.mode-chip:hover {
  border-color: var(--line-strong);
  background: #ebeef8;
  transform: none;
}

.mode-chip.active {
  border-color: rgba(47, 95, 221, 0.4);
  color: var(--blue);
  background: var(--blue-soft);
}

.ship-chips {
  margin-top: 4px;
}

.ship-fee-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  margin-right: 2px;
}

.ship-row td {
  background: #f5f8fc;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

#summaryFoot tr td {
  background: var(--navy-soft);
  border-top: 2px solid var(--line-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 10px 7px;
}

#summaryFoot .summary-label {
  color: var(--muted);
  font-weight: 700;
}

#summaryFoot .summary-num {
  text-align: right;
  color: var(--ink);
}

.qty-input {
  min-width: 64px;
}

.unit-input {
  min-width: 48px;
}

.price-input {
  min-width: 88px;
}

@media (max-width: 920px) {
  .topbar,
  .hero-grid,
  .guide-band,
  .input-split {
    grid-template-columns: 1fr;
  }

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

  .hero-copy {
    min-height: auto;
  }

  .settings-section .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .hero,
  main {
    width: min(100% - 24px, 1180px);
  }

  .hero-copy,
  .hero-card,
  .tool-panel,
  .table-section {
    border-radius: 18px;
    padding: 18px;
  }

  h1 {
    font-size: 44px;
  }
}
