* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  background: #F8FAFC;
  color: #1E3A5F;
  font-size: 13px;
}

.header {
  background: #1E3A5F;
  padding: 12px 16px;
}

.header-brand {
  font-size: 9px;
  font-family: Consolas, monospace;
  color: #64A879;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 3px;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.header-sub {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 2px;
}

.steps {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid #CBD5E1;
  background: #fff;
  color: #94A3B8;
  transition: all 0.3s;
}

.step-dot.active {
  border-color: #1D4ED8;
  background: #1D4ED8;
  color: #fff;
}

.step-dot.done {
  border-color: #16A34A;
  background: #16A34A;
  color: #fff;
}

.step-label {
  font-size: 9px;
  color: #94A3B8;
  margin-top: 3px;
  text-align: center;
  white-space: nowrap;
}

.step-label.active {
  color: #1D4ED8;
  font-weight: 600;
}

.step-label.done {
  color: #16A34A;
}

.step-line {
  flex: 0.4;
  height: 2px;
  background: #E2E8F0;
  margin-bottom: 14px;
  transition: background 0.3s;
}

.step-line.done {
  background: #16A34A;
}

.content {
  padding: 14px 16px;
}

.card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: opacity 0.3s;
}

.card.locked {
  opacity: 0.4;
  pointer-events: none;
}

.card-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}
.card-header > * + * {
  margin-left: 6px;
}

.card-header.blue {
  background: #EFF6FF;
  color: #1D4ED8;
  border-bottom: 1px solid #DBEAFE;
}

.card-header.orange {
  background: #FFF7ED;
  color: #C2410C;
  border-bottom: 1px solid #FED7AA;
}

.step-highlight {
  font-size: 15px;
  font-weight: 900;
  margin-right: 2px;
}

.card-body {
  padding: 12px;
}

.instruction {
  font-size: 11.5px;
  color: #64748B;
  line-height: 1.6;
  margin-bottom: 10px;
}

.instruction b {
  color: #1E3A5F;
}

.product-search {
  width: 100%;
  padding: 6px 10px;
  border: 1.5px solid #E2E8F0;
  border-radius: 5px;
  font-size: 12px;
  color: #1E3A5F;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.product-search:focus {
  border-color: #93C5FD;
}

.product-list {
  display: flex;
  flex-direction: column;
  max-height: 180px;
  overflow-y: auto;
}
.product-list > * + * {
  margin-top: 6px;
}

.no-result {
  font-size: 11px;
  color: #94A3B8;
  text-align: center;
  padding: 10px 0;
}

.product-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1.5px solid #E2E8F0;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: Consolas, monospace;
  font-size: 11px;
  color: #1E3A5F;
}

.product-item:hover {
  border-color: #93C5FD;
  background: #F8FAFC;
}

.product-item.checked {
  border-color: #1D4ED8;
  background: #EFF6FF;
}

.product-item input[type="checkbox"] {
  accent-color: #1D4ED8;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  cursor: pointer;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}

.product-name {
  font-weight: 700;
}

.product-sub {
  font-size: 9.5px;
  color: #64748B;
  margin-top: 1px;
  font-family: 'Segoe UI', sans-serif;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
  min-height: 22px;
}
.selected-tags > * {
  margin: 2px 3px 2px 0;
}

.selected-tag {
  padding: 2px 8px;
  border-radius: 10px;
  background: #1D4ED8;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  font-family: Consolas, monospace;
}

.text-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 3px solid #CBD5E1;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.7;
  color: #475569;
  max-height: 100px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.text-box.selected {
  border-left-color: #1D4ED8;
  background: #EFF6FF;
  color: #1E3A5F;
}

.text-box.new-text {
  border-left-color: #16A34A;
  background: #F0FDF4;
  color: #14532D;
  max-height: 130px;
}

.btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  margin-top: 10px;
  transition: background 0.2s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  background: #CBD5E1;
  color: #94A3B8;
  cursor: not-allowed;
}

.btn-navy {
  background: #1E3A5F;
  color: #fff;
}

.btn-navy:hover:not(:disabled) {
  background: #1D4ED8;
}

.btn-purple {
  background: #7C3AED;
  color: #fff;
}

.btn-green {
  background: #16A34A;
  color: #fff;
}

.status {
  display: none;
  align-items: center;
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.status > * + * {
  margin-left: 8px;
}

.status.show {
  display: flex;
}

.status.warn {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.status.loading {
  background: #F5F3FF;
  color: #7C3AED;
  border: 1px solid #DDD6FE;
}

.status.success {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #DCFCE7;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1)
  }
  50% {
    opacity: .4;
    transform: scale(.7)
  }
}

.dot.pulse {
  animation: pulse 1s infinite;
}

.footer {
  background: #1E3A5F;
  color: #475569;
  font-size: 9px;
  text-align: center;
  padding: 8px;
  font-family: Consolas, monospace;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.footer span {
  color: #4ADE80;
}

/* ── Upload Section ──────────────────────────────────────────────────────── */

.upload-toggle {
  background: #1E3A5F;
  color: #94A3B8;
  font-size: 11px;
  font-family: Consolas, monospace;
  letter-spacing: 1px;
  padding: 8px 16px;
  cursor: pointer;
  -ms-user-select: none;
  user-select: none;
  transition: background 0.2s, color 0.2s;
}

.upload-toggle:hover {
  background: #1D4ED8;
  color: #fff;
}

.upload-section {
  padding: 0 16px 14px;
}

.upload-label {
  display: block;
  font-size: 11px;
  color: #64748B;
  margin-bottom: 4px;
  font-weight: 600;
}

.upload-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  font-family: Consolas, monospace;
  border: 1.5px solid #E2E8F0;
  border-radius: 5px;
  color: #1E3A5F;
  background: #F8FAFC;
  outline: none;
  transition: border-color 0.2s;
}

.upload-input:focus {
  border-color: #1D4ED8;
  background: #EFF6FF;
}

.file-drop-area {
  border: 1.5px dashed #CBD5E1;
  border-radius: 5px;
  padding: 12px;
  text-align: center;
  font-size: 11.5px;
  color: #64748B;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.file-drop-area:hover {
  border-color: #1D4ED8;
  background: #EFF6FF;
  color: #1D4ED8;
}

.file-drop-area.has-file {
  border-color: #16A34A;
  background: #F0FDF4;
  color: #14532D;
}

.upload-progress {
  margin-top: 10px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 40%;
  background: #1D4ED8;
  border-radius: 3px;
  animation: indeterminate 1.4s infinite ease-in-out;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.upload-status-msg {
  font-size: 11px;
  color: #7C3AED;
  margin-top: 6px;
  font-weight: 600;
}
/* ── Tab Bar ──────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #E2E8F0;
}

.tab-btn {
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.tab-btn.active {
  color: #1E3A5F;
  border-bottom-color: #1E3A5F;
}

/* ── LLM Output Tab ───────────────────────────────────────────────────────── */
.llm-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748B;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.llm-raw-box {
  background: #0F172A;
  border-radius: 6px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.llm-parsed-box {
  background: #F1F5F9;
  border-radius: 6px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
}

.llm-tag-heading { color: #60A5FA; font-weight: 700; }
.llm-tag-body    { color: #94A3B8; }
.llm-tag-list    { color: #34D399; font-weight: 700; }
.llm-tag-list2   { color: #6EE7B7; }
.llm-tag-unknown { color: #F87171; }

.llm-parsed-row {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid #E2E8F0;
}
.llm-parsed-row:last-child { border-bottom: none; }

.llm-parsed-tag {
  flex-shrink: 0;
  width: 52px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-align: center;
  align-self: flex-start;
}
.tag-HEADING { background: #1D4ED8; color: #fff; }
.tag-BODY    { background: #64748B; color: #fff; }
.tag-LIST    { background: #059669; color: #fff; }
.tag-LIST2   { background: #0D9488; color: #fff; }

.llm-parsed-text {
  color: #1E3A5F;
  font-size: 11px;
  word-break: break-word;
}
