:root {
  --brand: #e83a45;
  --brand-soft: #fff1f2;
  --blue: #1677ff;
  --blue-soft: #eff6ff;
  --ink: #111827;
  --body: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --page: #f6f8fb;
  --surface: #fff;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
body.locked .sidebar, body.locked .shell { display: none; }

.site-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 54px;
  padding: 16px 24px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }
body.locked .site-footer {
  position: fixed;
  z-index: 110;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: #f8fafc;
}
body.locked .login-screen { display: grid; }
.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 15px;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}
.login-panel h1 { margin-top: 8px; font-size: 26px; }
.login-panel p, .login-panel small { color: var(--muted); }
.login-panel label { display: grid; gap: 7px; color: var(--body); font-size: 14px; font-weight: 600; }
.login-panel input { padding: 12px; border: 1px solid #cbd5e1; border-radius: 6px; }
.login-panel button { padding: 12px; color: #fff; border: 0; border-radius: 6px; background: var(--brand); font-weight: 700; }
#login-error { min-height: 18px; color: #b91c1c; font-size: 13px; }

.login-brand, .brand { display: flex; align-items: center; gap: 11px; }
.login-brand > span, .brand > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--brand);
  border-radius: 7px;
  font-size: 21px;
  font-weight: 900;
}
.login-brand b, .login-brand small, .brand b, .brand small { display: block; }
.login-brand b, .brand b { font-size: 18px; }
.login-brand small, .brand small { margin-top: 2px; font-size: 11px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand { padding: 0 10px 21px; border-bottom: 1px solid #eef2f7; }
.brand small { color: var(--muted); }
nav { display: grid; gap: 5px; margin-top: 18px; }
.nav-item {
  position: relative;
  width: 100%;
  padding: 11px 14px;
  color: var(--body);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
.nav-item:hover { background: #f8fafc; }
.nav-item.active { color: #be2632; background: var(--brand-soft); }
.nav-item.active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  content: "";
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.shell { min-width: 0; padding: 0 30px 40px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  margin: 0 -30px 26px;
  padding: 13px 30px;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 24px; line-height: 1.2; }
.topbar p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.top-actions, .form-actions, .filter-bar, .category-actions { display: flex; align-items: center; gap: 9px; }
.button, .table-action, .upload-button {
  min-height: 36px;
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.button.primary, .table-action { color: #fff; background: var(--brand); }
.button.secondary { color: var(--blue); background: var(--blue-soft); border: 1px solid #bfdbfe; }
.button.quiet { color: var(--body); background: #f1f5f9; }
.table-action.danger { color: #b91c1c; background: #fef2f2; }
.text-button { color: var(--blue); background: none; border: 0; font-size: 13px; font-weight: 700; }

.view { display: none; }
.view.active { display: block; }
.section-heading, .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.section-heading { margin-bottom: 15px; }
.section-heading.spaced { margin-top: 26px; }
.section-heading h2 { font-size: 20px; }
.section-heading p, .panel-head p { margin-top: 5px; color: var(--muted); font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.metric, .panel, .notice, .readiness-card, .launch-report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric { position: relative; overflow: hidden; min-height: 122px; padding: 19px 20px; }
.metric::after { position: absolute; right: 18px; top: 18px; width: 34px; height: 34px; content: ""; background: #f1f5f9; border-radius: 7px; }
.metric.red::after { background: #fee2e2; }
.metric.blue::after { background: #dbeafe; }
.metric.green::after { background: #dcfce7; }
.metric.orange::after { background: #ffedd5; }
.metric span, .metric small { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin: 12px 0 7px; font-size: 30px; line-height: 1; }
.overview .metric { min-height: 105px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 14px; margin-top: 14px; }
.panel { padding: 20px; }
.panel-head { margin-bottom: 14px; }
.panel-head h3 { font-size: 16px; }
.alert-list { display: grid; gap: 9px; }
.alert-item { display: flex; justify-content: space-between; gap: 16px; padding: 12px; background: #fff7ed; border-radius: 6px; color: #9a3412; font-size: 13px; }
.empty-alert { padding: 24px; color: var(--muted); text-align: center; background: #f8fafc; border-radius: 6px; }

.product-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.product-groups { position: sticky; top: 92px; }
.sku-workspace { min-width: 0; display: grid; gap: 14px; }
.sku-form { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .settings-form label { display: grid; gap: 7px; color: var(--body); font-size: 13px; font-weight: 600; }
.span-2 { grid-column: 1 / -1; }
input, select, textarea, .search-input {
  width: 100%;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(59, 130, 246, .1); }
textarea { min-height: 74px; resize: vertical; }
.form-actions { margin-top: 14px; }
#sku-save-status, #asset-save-status, #merchant-save-status, #marketing-save-status { color: #15803d; font-size: 13px; }
.category-image-list { display: grid; gap: 11px; }
.category-image-card { padding: 11px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 7px; }
.category-image-card img, .category-image-placeholder { width: 100%; height: 120px; object-fit: cover; background: #eaf2fb; border-radius: 6px; }
.category-image-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.category-edit-fields { display: grid; gap: 7px; margin-top: 9px; }
.category-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.category-actions { flex-wrap: wrap; }
.upload-button { position: relative; overflow: hidden; color: #334155; background: #e2e8f0; }
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-button.compact { display: inline-flex; min-height: 32px; justify-content: center; }
.status-badge {
  display: inline-flex;
  padding: 5px 8px;
  color: #15803d;
  background: #ecfdf3;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}
.status-badge.disabled { color: #b91c1c; background: #fef2f2; }

.table-wrap { width: 100%; overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
th { color: var(--muted); background: #f8fafc; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }
.compact-table td, .compact-table th { padding: 10px 11px; }
.sku-management-table { min-width: 1080px; }
.sku-management-table th:nth-child(1) { width: 190px; }
.sku-management-table th:nth-child(2) { width: 300px; }
.sku-management-table th:nth-child(3) { width: 130px; }
.sku-management-table th:nth-child(4) { width: 250px; }
.sku-media-cell { display: grid; gap: 7px; }
.sku-thumb, .sku-thumb-empty { width: 126px; height: 84px; border-radius: 6px; }
.sku-thumb { object-fit: cover; background: #eef2f7; }
.sku-thumb-empty { display: grid; place-items: center; color: var(--muted); background: #eef2f7; }
.sku-spec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 7px; }
.mini-label { display: block; margin: 3px 0 5px; color: var(--muted); font-size: 11px; }
.filter-bar { flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar .search-input { max-width: 320px; }
.filter-bar select { width: 160px; }
.asset-form { margin-bottom: 14px; }
.settings-form { max-width: 760px; display: grid; gap: 13px; }
.toggle-label { display: flex !important; grid-template-columns: 20px 1fr; align-items: center; }
.toggle-label input { width: 18px; height: 18px; }
.marketing-stats { display: grid; grid-template-columns: repeat(2, 140px); gap: 12px; }
.marketing-stats div { padding: 15px; background: #f8fafc; border-radius: 6px; }
.marketing-stats strong, .marketing-stats span { display: block; }
.marketing-stats strong { font-size: 25px; }
.marketing-stats span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.notice { padding: 18px; margin-bottom: 14px; }
.notice p { margin-top: 7px; color: var(--muted); line-height: 1.65; }

.readiness-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 14px; }
.readiness-card, .launch-report-card { padding: 18px; }
.launch-report-card + .launch-report-card { margin-top: 14px; }
.launch-report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.launch-report-head p, .readiness-card small, .muted { color: var(--muted); }
.launch-report-head strong, .readiness-card strong { color: #b91c1c; }
.launch-report-card.ready strong, .readiness-card.ready strong { color: #15803d; }
.launch-status-pills { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.launch-status-pills span { padding: 5px 8px; color: #9a3412; background: #fff7ed; border-radius: 5px; font-size: 12px; }
.launch-status-pills span.ready { color: #15803d; background: #ecfdf3; }
.launch-report-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.launch-report-columns section { padding: 12px; background: #f8fafc; border-radius: 6px; }
.launch-report-columns ul, .owner-todo-list { padding-left: 18px; }
.launch-report-columns li, .owner-todo-list li { margin: 8px 0; color: var(--body); font-size: 13px; }
.launch-report-columns small, .owner-todo-list small, .owner-todo-list em { display: block; margin-top: 3px; color: var(--muted); font-style: normal; }
.readiness-card ul { padding: 0; list-style: none; }
.readiness-card li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; margin-top: 10px; }
.readiness-card li > span { display: grid; place-items: center; width: 22px; height: 22px; color: #fff; background: #b91c1c; border-radius: 50%; font-size: 11px; }
.readiness-card li.ready > span { background: #15803d; }
.launch-summary { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .product-workspace { grid-template-columns: 1fr; }
  .product-groups { position: static; }
  .category-image-list { grid-template-columns: repeat(2, 1fr); }
  .launch-report-columns { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .shell { padding: 0 14px 28px; }
  .topbar { margin: 0 -14px 18px; padding: 12px 14px; }
  .metric-grid, .form-grid, .readiness-grid, .launch-report-columns { grid-template-columns: 1fr; }
  .span-2, .launch-summary { grid-column: auto; }
  .category-image-list { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 5px; }
}
