@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface2: #fafaf8;
  --border: #e2e0d8;
  --border2: #c8c5ba;
  --text: #1a1916;
  --text2: #6b6860;
  --text3: #a8a59e;
  --accent: #2d5016;
  --accent-bg: #eef4e8;
  --accent-light: #c5dba8;
  --brand-taupe: #918a7b;
  --brand-taupe-deep: #716b5f;
  --brand-taupe-active: #888379;
  --warn: #7a3d00;
  --warn-bg: #fff3e8;
  --warn-light: #ffcb96;
  --error: #6b1010;
  --error-bg: #fff0f0;
  --success: #1a4d0a;
  --success-bg: #edfce5;
  --sidebar-width: 260px;
  --mono: "JetBrains Mono", monospace;
  --sans: "Noto Sans KR", sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  padding: 24px 15px 18px;
  display: flex;
  flex-direction: column;
  background: var(--brand-taupe-deep);
  color: #fff;
  z-index: 120;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 32px; }
.brand-mark {
  width: 52px;
  height: 52px;
  display: block;
  flex-shrink: 0;
}
.brand strong { display: block; font-size: 16px; line-height: 1.2; }
.brand span { display: block; color: rgba(255, 255, 255, .6); font-size: 11px; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 7px; }
.nav-link {
  display: block;
  padding: 14px 13px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, .75);
  text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; transform: translateX(2px); }
.nav-link.active { background: var(--brand-taupe-active); color: #fff; }
.nav-label { display: block; font-size: 13px; font-weight: 700; }
.nav-detail { display: block; margin-top: 4px; font-size: 11px; opacity: .6; }
.sidebar-foot { margin: auto 10px 0; color: rgba(255, 255, 255, .58); font-size: 11px; line-height: 1.7; }

.portal-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.tool-view { display: none; animation: reveal .18s ease; }
.tool-view.active { display: block; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
.feature-header {
  height: 56px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand-taupe-active);
  color: #fff;
}
.logo { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.logo span { margin-left: 8px; opacity: .6; font-size: 13px; font-weight: 400; }
.header-badge {
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .15);
  font-size: 11px;
  letter-spacing: .3px;
}
.container { max-width: 900px; margin: 0 auto; padding: 32px 24px 80px; }

.section {
  padding: 28px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.section-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.section-num-muted { background: #898170; }
.section-title { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.section-desc { margin-left: auto; color: var(--text3); font-size: 12px; }
.guide-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.7;
}
.sheets-input-wrap { display: flex; align-items: stretch; gap: 10px; }
.sheets-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: 13px var(--sans);
  outline: none;
}
.sheets-input:focus { border-color: var(--accent); background: #fff; }
.sheets-status { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--text3); font-size: 12px; }
.sheets-status.success { color: var(--success); }
.sheets-status.failure { color: var(--error); }
.status-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--border2);
}
.status-dot.ok { background: #4caf50; }
.status-dot.err { background: #e53935; }
.status-dot.loading { background: var(--warn-light); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; gap: 12px; }
.upload-card {
  min-height: 140px;
  padding: 20px 16px;
  position: relative;
  background: var(--surface2);
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, transform .15s;
}
.upload-card:hover, .upload-card.drag-over { border-color: var(--accent); background: var(--accent-bg); }
.upload-card.has-file { border-style: solid; border-color: var(--accent-light); background: var(--accent-bg); }
.upload-card input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.upload-icon { margin-bottom: 8px; font-size: 22px; }
.upload-label { margin-bottom: 4px; color: var(--text2); font-size: 12px; font-weight: 700; letter-spacing: .2px; }
.upload-sub { color: var(--text3); font-size: 11px; }
.upload-filename {
  min-height: 18px;
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: var(--accent);
  font: 11px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn {
  padding: 11px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font: 500 13px var(--sans);
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1e3a0f; }
.btn-secondary { border-color: var(--border2); background: #fff; color: var(--text); }
.btn-secondary:hover { background: var(--surface2); }
.generate-wrap { display: flex; justify-content: center; padding: 8px 0; }
.btn-generate {
  padding: 14px 48px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--accent);
  box-shadow: 0 4px 16px rgba(45, 80, 22, .25);
  color: #fff;
  font: 700 15px var(--sans);
  cursor: pointer;
  letter-spacing: -.2px;
  transition: background .2s, transform .2s, opacity .2s;
}
.btn-generate:hover { background: #1e3a0f; transform: translateY(-1px); }
.btn-generate:disabled, .btn:disabled { opacity: .45; cursor: wait; transform: none; }
.progress-wrap { display: none; margin-top: 16px; }
.progress-wrap.visible { display: block; }
.progress-bar-track {
  height: 4px;
  overflow: hidden;
  background: var(--border);
  border-radius: 99px;
}
.progress-bar-fill {
  width: 76%;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  animation: breathe 1.1s ease-in-out infinite alternate;
}
@keyframes breathe { to { opacity: .45; } }
.progress-text { margin-top: 8px; color: var(--text2); font-size: 12px; text-align: center; }
.progress-bar {
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--border);
}
.progress-bar-moving {
  width: 42%;
  height: 100%;
  background: var(--accent);
  animation: moving 1s ease-in-out infinite alternate;
}
@keyframes moving { to { transform: translateX(138%); } }
.error-box {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid #ffcdD2;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error);
  font-size: 13px;
}
.error-box.visible { display: block; }
.converted-section, .result-section { display: none; }
.converted-section.visible, .result-section.visible { display: block; }
.converted-buttons, .download-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.result-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.meta-card { padding: 14px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); }
.meta-label { margin-bottom: 4px; color: var(--text3); font-size: 11px; letter-spacing: .3px; }
.meta-value { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.meta-value.ok { color: var(--success); }
.validation-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--success);
  font-size: 13px;
  font-weight: 500;
}
.validation-banner pre { margin: 7px 0 0; white-space: pre-wrap; font: 12px/1.7 var(--mono); }
.supplier-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text2);
  font: 500 12px var(--sans);
  cursor: pointer;
}
.tab.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.copy-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.copy-label { color: var(--text3); font-size: 12px; }
.btn-copy {
  padding: 7px 14px;
  border: 1.5px solid var(--accent-light);
  border-radius: var(--radius);
  background: #fff;
  color: var(--accent);
  font: 600 12px var(--sans);
  cursor: pointer;
}
.btn-copy:hover { background: var(--accent-bg); }
.output-box {
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  padding: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: 13px/1.8 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.download-bar { margin-top: 16px; }
.shipping-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.count-card { padding: 15px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.count-card label { display: block; margin-bottom: 5px; color: var(--text3); font-size: 11px; }
.count-card strong { font: 700 25px var(--mono); }
.count-card strong.ok { color: var(--success); }
.btn-download { width: 100%; border-radius: var(--radius); }
.toast {
  position: fixed;
  bottom: 32px;
  left: calc(50% + var(--sidebar-width) / 2);
  padding: 12px 24px;
  transform: translateX(-50%) translateY(80px);
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  transition: transform .25s ease;
  z-index: 999;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    bottom: auto;
    width: 100%;
    height: 112px;
    padding: 12px 14px;
  }
  .brand { padding: 0 2px 10px; }
  .brand-mark { width: 42px; height: 42px; }
  .sidebar-foot { display: none; }
  .nav { flex-direction: row; }
  .nav-link { flex: 1; padding: 9px 10px; }
  .nav-detail { display: none; }
  .portal-main { padding-top: 112px; margin-left: 0; }
  .feature-header { position: static; padding: 0 18px; }
  .toast { left: 50%; }
}
@media (max-width: 680px) {
  .container { padding: 22px 16px 52px; }
  .section { padding: 20px; }
  .section-desc, .logo span { display: none; }
  .upload-grid, .shipping-counts, .result-meta { grid-template-columns: 1fr; }
  .sheets-input-wrap { flex-direction: column; }
  .btn-generate { width: 100%; padding-inline: 12px; }
}
