/* ========== Reset & Base ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans Thai', sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
}

svg {
  display: block;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ========== Layout ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 16px;
  z-index: 30;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.main {
  margin-left: 280px;
  min-height: 100vh;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #020617;
  color: #ffffff;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6ee7b7;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Sidebar nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #94a3b8;
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  text-align: left;
  color: #475569;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: #f1f5f9;
}

.nav-item.active {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 4px 12px -2px rgba(5, 150, 105, 0.4);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  color: #94a3b8;
  flex-shrink: 0;
}

.nav-item.active svg {
  color: #ffffff;
}

.nav-item-text {
  min-width: 0;
  flex: 1;
}

.nav-item-label {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.nav-item-sub {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.active .nav-item-sub {
  color: #d1fae5;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  align-items: center;
  justify-content: center;
}

.hamburger svg {
  width: 20px;
  height: 20px;
}

.topbar-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #059669;
}

.topbar-title {
  font-size: 24px;
  font-weight: 800;
  color: #020617;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 16px;
}

.search-box .search-icon {
  width: 20px;
  height: 20px;
  color: #94a3b8;
  flex-shrink: 0;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 13px;
  color: #0f172a;
}

.search-box input::placeholder {
  color: #94a3b8;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-dark {
  background: #020617;
  color: #ffffff;
}

.btn-dark:hover {
  background: #1e293b;
}

.btn-emerald {
  background: #059669;
  color: #ffffff;
}

.btn-emerald:hover {
  background: #047857;
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.btn-outline:hover {
  background: #f8fafc;
}

.btn-white {
  background: #ffffff;
  color: #020617;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 12px;
}

.btn-white:hover {
  background: #f1f5f9;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  border-radius: 10px;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Content */
.content {
  padding: 32px;
}

/* ========== Card ========== */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.card-body {
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

/* ========== Status Badge ========== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.badge-emerald {
  background: #d1fae5;
  color: #047857;
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.badge-rose {
  background: #ffe4e6;
  color: #be123c;
}

.badge-slate {
  background: #f1f5f9;
  color: #475569;
}

/* ========== Grids ========== */
.grid {
  display: grid;
  gap: 20px;
}

.grid-stats {
  grid-template-columns: repeat(4, 1fr);
}

.grid-2 {
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
}

.grid-2-rev {
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
}

.grid-sku {
  grid-template-columns: 480px 1fr;
  gap: 24px;
}

.grid-warranty {
  grid-template-columns: 1fr 430px;
  gap: 24px;
}

.grid-simple {
  grid-template-columns: 420px 1fr;
  gap: 24px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ========== Stat Card ========== */
.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.stat-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.stat-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: #020617;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.stat-helper {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap svg {
  width: 24px;
  height: 24px;
}

/* ========== Dashboard Tasks ========== */
.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.task-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 20px;
  border-radius: 24px;
  text-align: left;
  transition: all 0.15s ease;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}

.task-card:hover {
  background: #ffffff;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.08);
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.task-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #ffffff;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.task-icon svg {
  width: 24px;
  height: 24px;
}

.task-count {
  font-size: 28px;
  font-weight: 800;
  color: #020617;
  letter-spacing: -0.02em;
}

.task-title {
  font-weight: 800;
  color: #1e293b;
  margin-top: 4px;
}

.task-detail {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.5;
}

.task-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  color: #047857;
  margin-top: 16px;
}

.task-link svg {
  width: 14px;
  height: 14px;
}

/* ========== Profit panel ========== */
.profit-hero {
  background: #020617;
  color: #ffffff;
  padding: 20px;
  border-radius: 24px;
}

.profit-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6ee7b7;
}

.profit-hero-value {
  font-size: 36px;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.profit-hero-sub {
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 4px;
}

.profit-bar {
  margin-top: 20px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.profit-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #34d399;
}

.profit-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.profit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 16px;
}

.profit-row-label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.profit-row-right {
  text-align: right;
}

.profit-row-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #020617;
}

.profit-row-percent {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

/* ========== Warranty/Customer Summary ========== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.summary-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 20px;
  border-radius: 24px;
}

.summary-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.summary-value {
  font-size: 28px;
  font-weight: 800;
  color: #020617;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.summary-helper {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.progress-item .progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.progress-item .progress-name {
  font-weight: 700;
  color: #334155;
}

.progress-item .progress-pct {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #020617;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #10b981;
}

.progress-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ========== Table ========== */
.table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table tbody td {
  padding: 16px;
  font-size: 13px;
  border-top: 1px solid #e2e8f0;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fafbfc;
}

.cell-id {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #64748b;
}

.cell-sku {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #020617;
}

.cell-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.cell-name {
  font-weight: 600;
  color: #1e293b;
}

.cell-actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.cell-stock-zero {
  color: #e11d48;
  font-weight: 700;
}

.cell-margin-loss { color: #e11d48; font-weight: 800; }
.cell-margin-low  { color: #b45309; font-weight: 700; }
.cell-margin-good { color: #047857; font-weight: 800; }

/* ========== Model + Variant Table ========== */
.model-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.model-table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
}

.model-table tbody td {
  padding: 14px 16px;
  font-size: 13px;
  border-top: 1px solid #e2e8f0;
  vertical-align: middle;
}

.model-row { cursor: pointer; transition: background 0.15s; }
.model-row:hover { background: #f8fafc; }
.model-row.expanded { background: #f0fdf4; }

.model-row .expand-icon {
  display: inline-block;
  width: 16px; height: 16px;
  color: #94a3b8;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.model-row.expanded .expand-icon { transform: rotate(90deg); color: #059669; }

.model-name { font-weight: 700; color: #0f172a; }
.model-sub  { font-size: 11px; color: #94a3b8; margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

.variant-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800;
  color: #047857; background: #d1fae5;
  padding: 3px 10px; border-radius: 999px;
}

.variants-cell { padding: 0 !important; background: #fafbfc; }
.variants-inner {
  padding: 16px 24px 24px 56px;
  border-top: 1px solid #e2e8f0;
}

.variants-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.variants-title {
  font-size: 12px; font-weight: 800; color: #475569;
  text-transform: uppercase; letter-spacing: 0.08em;
}

.variants-table {
  width: 100%;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.variants-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}

.variants-table td {
  padding: 12px 14px;
  font-size: 12px;
  border-top: 1px solid #f1f5f9;
  vertical-align: middle;
}

.v-sku {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #020617;
  font-size: 11px;
}
.v-name  { font-weight: 600; color: #1e293b; }
.v-price { font-family: 'JetBrains Mono', monospace; font-weight: 700; text-align: right; color: #0f172a; }
.v-cost  { text-align: right; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }
.v-stock { text-align: right; font-weight: 700; }
.v-stock.zero { color: #e11d48; }
.v-stock.low  { color: #b45309; }
.v-margin { text-align: right; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.v-margin.good { color: #047857; }
.v-margin.low  { color: #b45309; }
.v-margin.loss { color: #e11d48; }

@media (max-width: 768px) {
  .variants-inner { padding: 12px 16px 16px 16px; }
}

/* ========== Login Overlay ========== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(135deg, #020617 0%, #1e293b 60%, #064e3b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 28px;
  padding: 40px 32px 32px;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.45);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: #020617;
  color: #6ee7b7;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo svg { width: 32px; height: 32px; }

.login-brand h1 {
  font-size: 24px;
  font-weight: 800;
  color: #020617;
  letter-spacing: -0.02em;
}
.login-brand p {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

.login-form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-help {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

/* ========== User Bar (topbar) ========== */
.user-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 14px;
}

.user-bar.hidden {
  display: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 8px;
  border-right: 1px solid #e2e8f0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-avatar svg { width: 16px; height: 16px; }

.user-email {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
}

.user-logout:hover {
  background: #fff1f2;
  color: #be123c;
}

.user-logout svg { width: 16px; height: 16px; }

@media (max-width: 1024px) {
  .user-info { padding-right: 4px; }
  .user-email { max-width: 120px; font-size: 11px; }
}

@media (max-width: 768px) {
  .user-email { display: none; }
  .user-info { padding-right: 4px; border-right: none; }
}

/* ========== Flex Message Preview (LINE bubble look) ========== */
.flex-preview {
  max-width: 300px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px -8px rgba(2, 6, 23, 0.12);
}

.fp-header {
  padding: 18px 20px;
  color: #ffffff;
}

.fp-header-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.fp-header-sub {
  font-size: 10px;
  margin-top: 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fp-body {
  padding: 18px 20px;
  background: #ffffff;
}

.fp-label {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.fp-value {
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
  line-height: 1.4;
}

.fp-sep {
  height: 1px;
  background: #f1f5f9;
  margin: 14px 0;
}

.fp-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.fp-footer {
  padding: 0 16px 16px;
}

.fp-button {
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  letter-spacing: 0.01em;
}

@media (max-width: 1280px) {
  .flex-preview { max-width: 360px; }
}

/* ========== SKU page ========== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  transition: all 0.15s;
}

.field-input:focus {
  border-color: #10b981;
  background: #ffffff;
}

.field-readonly {
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.field-helper {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.sku-display {
  background: #020617;
  color: #ffffff;
  padding: 20px;
  border-radius: 24px;
  margin-top: 24px;
}

.sku-display-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6ee7b7;
}

.sku-display-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sku-display-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 800;
  word-break: break-all;
}

.sku-display-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.mapping-table {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.mapping-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid #e2e8f0;
}

.mapping-row:last-child {
  border-bottom: none;
}

.mapping-label {
  background: #f8fafc;
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 800;
  color: #64748b;
}

.mapping-value {
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  word-break: break-all;
}

.callout {
  background: #fef3c7;
  color: #92400e;
  padding: 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 20px;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 4px;
}

.callout-title svg {
  width: 16px;
  height: 16px;
}

/* ========== Activity list ========== */
.activity-table {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.activity-head, .activity-row {
  display: grid;
  grid-template-columns: 80px 1fr 170px 120px;
  align-items: center;
}

.activity-head {
  background: #f8fafc;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
}

.activity-row {
  padding: 16px;
  font-size: 13px;
  border-top: 1px solid #e2e8f0;
}

.activity-row .activity-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #64748b;
}

.activity-row .activity-action {
  font-weight: 600;
  color: #1e293b;
}

.activity-row .activity-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

/* ========== Simple Module ========== */
.simple-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.simple-icon svg {
  width: 28px;
  height: 28px;
}

.simple-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.simple-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 16px;
  border-radius: 16px;
  font-weight: 700;
  color: #1e293b;
}

.simple-list-item svg {
  width: 20px;
  height: 20px;
  color: #059669;
  flex-shrink: 0;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #020617;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Sidebar overlay (mobile) ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  z-index: 25;
}

.sidebar-overlay.show {
  display: block;
}

/* ========== Responsive ========== */
@media (max-width: 1280px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2-rev { grid-template-columns: 1fr; }
  .grid-sku, .grid-warranty, .grid-simple { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.2);
  }
  .main {
    margin-left: 0;
  }
  .hamburger {
    display: inline-flex;
  }
  .search-box {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 16px 20px;
    flex-wrap: wrap;
  }
  .search-box {
    width: 100%;
    order: 3;
  }
  .topbar-right {
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .content {
    padding: 20px;
  }
  .topbar-title {
    font-size: 20px;
  }
  .grid-stats {
    grid-template-columns: 1fr;
  }
  .task-grid {
    grid-template-columns: 1fr;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .simple-list {
    grid-template-columns: 1fr;
  }
  .card-body {
    padding: 20px;
  }
  .activity-head, .activity-row {
    grid-template-columns: 60px 1fr 100px;
  }
  .activity-row .activity-ref {
    display: none;
  }
  .activity-head > div:nth-child(3) {
    display: none;
  }
  .mapping-row {
    grid-template-columns: 130px 1fr;
  }
  .mapping-label {
    padding: 12px;
    font-size: 11px;
  }
  .mapping-value {
    padding: 12px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .topbar-right .btn-dark span,
  .btn-dark { font-size: 12px; padding: 8px 14px; }
}

/* ========== Data States (Loading / Empty / Error) ========== */
.state-box {
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.state-box.state-error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.state-box .state-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.state-box.state-error .state-title {
  color: #be123c;
}

.state-box code {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: #0f172a;
}

.state-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: #059669;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Danger button ========== */
.btn-icon.btn-icon-danger:hover {
  background: #fff1f2;
  color: #be123c;
}

.btn-danger {
  background: #e11d48;
  color: #ffffff;
}

.btn-danger:hover {
  background: #be123c;
}

/* ========== Modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px -12px rgba(2, 6, 23, 0.35);
  animation: modalIn 0.18s ease-out;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.modal-open {
  overflow: hidden;
}

/* ========== Form (modal) ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
}

.form-label .required {
  color: #e11d48;
  font-weight: 800;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  transition: all 0.15s;
}

.form-input:focus {
  border-color: #10b981;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.form-input-mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.form-input-readonly {
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
  border-style: dashed;
}

.form-input-readonly:focus {
  border-color: #cbd5e1;
  box-shadow: none;
  background: #f1f5f9;
}

.form-hint {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0;
  text-transform: none;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 540px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .modal-footer {
    flex-direction: column-reverse;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}
