:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #0f1720;
  --muted: #667788;
  --line: #e4e9ee;
  --line-strong: #d0d8e0;
  --sidebar: #0f1c24;
  --sidebar-2: #162833;
  --accent: #0f766e;
  --accent-hover: #0b5f59;
  --accent-soft: #e7f4f2;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --shadow: 0 1px 2px rgba(15, 23, 32, 0.06), 0 8px 24px rgba(15, 23, 32, 0.04);
  --radius: 12px;
  --font: "IBM Plex Sans", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.error { color: var(--danger); margin: 10px 0 0; font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: #f8fafb; }
.btn-ghost { background: transparent; color: #d7e2e8; border-color: rgba(255,255,255,.12); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.btn-danger:hover { background: #fee4e2; }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); background: #f8fafb; }

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1aaa9b 0%, #0f766e 55%, #0b4f4a 100%);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }

/* Auth */
.auth-body {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(1000px 480px at 10% 10%, rgba(15, 118, 110, .16), transparent 60%),
    linear-gradient(135deg, #0f1c24 0%, #183040 45%, #f4f6f8 45%, #f4f6f8 100%);
}
.auth-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(8, 18, 28, .28);
}
.auth-brand {
  padding: 42px 36px;
  color: #e8eef2;
  background:
    radial-gradient(500px 240px at 20% 0%, rgba(26, 170, 155, .28), transparent 60%),
    linear-gradient(160deg, #0f1c24, #16303c 70%, #0f766e);
}
.auth-brand h1 { margin: 14px 0 10px; font-size: 30px; color: #fff; }
.auth-brand p { margin: 0; color: #b7c7d1; line-height: 1.65; }
.brand-kicker { margin-top: 18px !important; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #8fd0c8 !important; }
.brand-points { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.brand-points li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.auth-card { padding: 42px 36px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-form { margin-top: 22px; display: grid; gap: 14px; }
.auth-form .field, .auth-form label {
  display: grid;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.auth-form input {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .15);
}

/* App shell */
.app-body {
  min-height: 100%;
  display: grid;
  grid-template-columns: 248px 1fr;
}
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #d7e2e8;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar-brand span { color: #8aa0ad; font-size: 12px; }
.sidebar-nav { display: grid; gap: 6px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #b7c7d1;
  font-size: 13px;
  font-weight: 600;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
}
.nav-item.active, .nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-link { text-decoration: none; }
.nav-icon { opacity: .85; }
.sidebar-foot { display: grid; gap: 10px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.user-chip strong { display: block; color: #fff; font-size: 13px; }
.user-chip small { color: #8aa0ad; }

.app-main {
  min-width: 0;
  padding: 28px 28px 40px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.page-header h1 { font-size: 28px; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters-card { padding: 16px 18px; margin-bottom: 16px; }
.filter-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1.3fr auto;
  gap: 12px;
  align-items: end;
}
.field {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.field input, .field select, .field textarea,
.product-form input, .product-form select, .product-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
}
.field input:focus, .field select:focus, .field textarea:focus,
.product-form input:focus, .product-form select:focus, .product-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.price-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.range-sep { color: var(--muted); font-size: 12px; font-weight: 500; }
.filter-actions { display: flex; align-items: end; }

.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafb;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: #f8fbfb; }
.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}
.product-cell img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  background: #edf2f5;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.product-cell strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
}
.product-cell small { color: var(--muted); font-size: 11px; }
.sku-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #334155;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 4px 7px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-archived { background: #f1f5f9; color: #475569; }
.col-actions { width: 100px; text-align: right; }
.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fcfdfd;
}
.page-label { color: var(--muted); font-size: 12px; font-weight: 600; min-width: 64px; text-align: center; }
.workflow-guide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bfe5df;
  border-radius: 12px;
  background: #f0fdfa;
  font-size: 12px;
}
.workflow-guide strong { margin-right: 4px; }
.workflow-guide span { padding: 5px 8px; border-radius: 999px; background: #fff; border: 1px solid #d5ebe7; }
.workflow-guide small { width: 100%; color: var(--muted); }
.status-next { display: grid; justify-items: start; gap: 6px; min-width: 150px; }
.status-next small { color: var(--muted); line-height: 1.4; }

/* Drawer editor */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, .36);
  backdrop-filter: blur(2px);
  z-index: 40;
  display: none;
}
.drawer-backdrop.is-open {
  display: block;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100vh;
  background: #fff;
  z-index: 50;
  display: none;
  flex-direction: column;
  box-shadow: -18px 0 50px rgba(15, 23, 32, .18);
}
.drawer.is-open {
  display: flex;
  animation: slideIn .18s ease;
}
.drawer[hidden],
.drawer-backdrop[hidden] {
  display: none !important;
}
@keyframes slideIn {
  from { transform: translateX(18px); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
  background: #fff;
  flex: 0 0 auto;
}
.drawer-header h2 { font-size: 20px; }
.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px 20px 110px;
  display: grid;
  gap: 18px;
}
.form-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfe;
}
.form-section h3 {
  font-size: 13px;
  color: #334155;
  margin-bottom: 2px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-label { position: relative; overflow: hidden; cursor: pointer; }
.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
#preview-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.product-workflow-progress { display: grid; gap: 10px; padding: 14px; border-radius: 12px; background: #f0fdfa; border: 1px solid #bfe5df; }
.product-workflow-progress p { margin: 0; color: var(--muted); font-size: 12px; }
.workflow-progress-head { display: flex; justify-content: space-between; gap: 10px; }
.workflow-progress-head span { color: var(--accent); font-size: 12px; font-weight: 600; }
.workflow-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.workflow-steps span { display: grid; justify-items: center; gap: 4px; color: #94a3b8; font-size: 10px; text-align: center; }
.workflow-steps i { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: #e2e8f0; color: #64748b; font-style: normal; font-weight: 700; }
.workflow-steps .done i { background: var(--accent); color: #fff; }
.workflow-steps .done, .workflow-steps .current { color: var(--ink); }
.workflow-steps .current i { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.section-heading a { color: var(--accent); font-size: 12px; white-space: nowrap; }
.field-help, .field small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.55; }
.image-upload-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.image-preview-box {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 11px;
}
.image-preview-box #preview-image { width: 100%; height: 100%; border: 0; border-radius: 0; }
.image-upload-card .btn, .gallery-upload .btn { margin-top: 8px; }
.file-name { display: inline-block; margin-left: 8px; color: var(--muted); font-size: 12px; vertical-align: middle; }
.gallery-upload { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gallery-preview { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; }
.gallery-preview figure { margin: 0; min-width: 72px; }
.gallery-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.gallery-preview figcaption { color: var(--muted); font-size: 10px; margin-top: 3px; text-align: center; }
.drawer-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.form-actions { display: flex; gap: 8px; }
.settings-card { padding: 22px; max-width: 720px; display: grid; gap: 14px; }
.settings-card textarea, .settings-card input { width: 100%; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
dialog { width: min(720px, calc(100% - 32px)); border: 0; border-radius: 16px; padding: 24px; box-shadow: 0 24px 80px rgba(8,18,28,.28); }
dialog::backdrop { background: rgba(15,23,32,.45); }
.dialog-close { float: right; }
dialog #inquiry-detail { display: grid; gap: 14px; }
dialog pre, #mfa-recovery { white-space: pre-wrap; overflow: auto; background: #f1f5f9; padding: 12px; border-radius: 8px; }
#release-dialog { width: min(540px, calc(100% - 32px)); }
#release-form { display: grid; gap: 18px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-explainer { color: var(--muted); font-size: 13px; line-height: 1.65; padding: 12px; border-radius: 10px; background: #f0fdfa; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-message { min-height: 20px; color: var(--danger); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 480px; padding: 13px 16px; border-radius: 10px; background: #0f2933; color: #fff; box-shadow: 0 12px 36px rgba(8,18,28,.24); font-size: 13px; }
.release-monitor { padding: 20px; margin-bottom: 16px; display: grid; gap: 14px; border-color: #bfe5df; }
.release-monitor[hidden] { display: none !important; }
.release-monitor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.release-monitor-head h2 { font-size: 19px; }
.live-dot { color: var(--success); font-size: 12px; font-weight: 700; }
.live-dot::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #12b76a; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.release-progress { display: grid; gap: 6px; min-width: 190px; }
.release-progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.release-progress-label strong { color: #334155; }
.release-progress-label span { color: var(--accent); font-weight: 700; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #dfe9e8; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#0f766e,#25a89b); transition: width .35s ease; }
.release-progress small { color: var(--muted); }
.release-progress.is-failed .progress-track i { background: var(--danger); }
.release-progress.is-failed .release-progress-label strong { color: var(--danger); }
.release-stage-list { display: grid; grid-template-columns: repeat(6,1fr); gap: 6px; color: var(--muted); font-size: 10px; text-align: center; }

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 42px 16px;
}

@media (max-width: 1100px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    grid-template-columns: 1fr;
  }
  .sidebar-nav { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .workflow-steps, .release-stage-list { grid-template-columns: repeat(3, 1fr); }
}
