:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: Consolas, Monaco, "Courier New", monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body.has-shared-nav {
  padding: 72px 20px 40px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

h1 {
  color: var(--text);
  font-size: 1.5rem;
  margin-bottom: 8px;
}

h2 {
  color: var(--text);
  font-size: 1.15rem;
  margin: 24px 0 12px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

p { margin-bottom: 10px; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
  text-align: center;
  margin-bottom: 24px;
}

.subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
}

.description {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 16px;
  margin-bottom: 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #f1f5f9; color: var(--text); }
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  font-family: var(--font-mono);
  resize: vertical;
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.result-section {
  margin-top: 24px;
  padding: 20px;
  border-radius: var(--radius);
  display: none;
}

.result-valid {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: #166534;
}

.result-invalid {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: #991b1b;
}

.result-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.status-message {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: none;
}

.status-success {
  background: var(--success-bg);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-error {
  background: var(--error-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-left: 6px;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-light);
  font-weight: 500;
}

.stats-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.stats-item strong {
  color: var(--text);
  font-size: 1rem;
}

.action-bar {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.table-container {
  overflow-x: auto;
  max-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  background: #fafafa;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:hover { background: #f8fafc; }
tr.filled-row { background: #fcfcfc; color: #94a3b8; }

.clean-sku {
  background: #f8fafc;
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  border: 1px dashed var(--border);
  font-family: var(--font-mono);
  word-break: break-all;
}

.char-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.char-item {
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.char-code {
  color: var(--text-light);
  font-size: 0.85rem;
}

.info-box {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
}

.info-box ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.info-box li {
  margin-bottom: 6px;
}

.footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-light);
  font-size: 0.85rem;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.guide-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 16px;
  font-family: var(--font);
  transition: all 0.2s;
}

.guide-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.guide-container {
  transition: max-height 0.3s ease-out;
  overflow: hidden;
  max-height: 500px;
  margin-bottom: 12px;
}

.guide-container.hidden {
  max-height: 0;
}

.guide-section {
  background: #fafafa;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.guide-section ol, .guide-section ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.guide-section li {
  margin-bottom: 6px;
}

.guide-section code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.input-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.grid-layout {
  display: grid;
  gap: 20px;
}

.platform-switcher {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border);
}

.switch-option {
  padding: 8px 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-light);
  transition: all 0.2s;
  user-select: none;
  font-size: 0.9rem;
}

.switch-option:hover { background: #f1f5f9; }
.switch-option.active { color: #fff; background: var(--primary); }

.toggle-icon {
  transition: transform 0.3s;
  font-size: 0.8rem;
  color: var(--text-light);
}

.toggle-icon.rotated { transform: rotate(180deg); }

.upload-status {
  font-size: 0.85rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  min-height: 1.5em;
}

.upload-status.success { color: #166534; background: var(--success-bg); }
.upload-status.error { color: #991b1b; background: var(--error-bg); }

.error-box {
  background: var(--error-bg);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.loading {
  display: none;
  text-align: center;
  margin: 16px 0;
}

.spinner {
  border: 3px solid #e2e8f0;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.data-count {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  body.has-shared-nav { padding: 72px 12px 20px; }

  .card { padding: 16px; }

  .button-group { flex-direction: column; }
  .button-group .btn { width: 100%; }

  .char-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  h1 { font-size: 1.3rem; }
}
