:root {
  --bg: #f3f6f5;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5ece9;
  --teal: #0f766e;
  --teal-soft: #eaf5f2;
  --amber: #f59e0b;
  --amber-soft: #fff7e6;
  --red: #ef4444;
  --green: #10b981;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(15, 118, 110, 0.08), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(245, 158, 11, 0.07), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(229, 236, 233, 0.9);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f766e, #115e59);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.25);
  flex: 0 0 auto;
}

.brand-mark.large {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 22px;
  margin: 0 auto 12px;
}

.brand-copy { min-width: 0; }

.brand-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub { font-size: 9px; color: var(--muted); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-amber { background: var(--amber-soft); color: #92400e; }
.pill-soft { background: var(--teal-soft); color: var(--teal); }

.text-link {
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 2px;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 10px;
  color: #92400e;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
}

.demo-banner .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 104px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.6px;
  line-height: 1.2;
}

.page-head p { margin: 4px 0 0; font-size: 11px; }

.page-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 10px;
  white-space: nowrap;
}

.page-head-meta strong { font-size: 11px; color: var(--teal); }

.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.card-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.2px;
}

.card-head p { margin: 3px 0 0; font-size: 10px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
}

.kpi-label { font-size: 10px; color: var(--muted); }

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.05;
}

.kpi-value span {
  margin-left: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.kpi-value.small { font-size: 18px; letter-spacing: -0.3px; }

.kpi-hint { font-size: 9px; color: var(--muted); line-height: 1.4; }

.chart { width: 100%; height: 230px; }
.chart-lg { height: 280px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.mini-list { display: flex; flex-direction: column; }

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child { border-bottom: 0; }

.mini-title { font-size: 12px; font-weight: 600; }
.mini-sub { font-size: 9px; color: var(--muted); margin-top: 2px; }

.mini-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}

.mini-time { font-size: 9px; color: var(--muted); white-space: nowrap; }

.rank-list { display: flex; flex-direction: column; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child { border-bottom: 0; }

.rank-no {
  width: 20px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank-main { flex: 1; min-width: 0; }

.rank-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  font-size: 9px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 5px;
  background: #f1f5f4;
  color: #475569;
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-soft { background: var(--teal-soft); color: var(--teal); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}

.badge-a { background: #dcfce7; color: #166534; }
.badge-b { background: #ccfbf1; color: #115e59; }
.badge-c { background: #fef3c7; color: #92400e; }
.badge-d { background: #e2e8f0; color: #475569; }

.status {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.status-green { background: #dcfce7; color: #166534; }
.status-amber { background: #fef3c7; color: #92400e; }
.status-red { background: #fee2e2; color: #991b1b; }
.status-gray { background: #e2e8f0; color: #475569; }

.alert-list { display: flex; flex-direction: column; }

.alert-row {
  display: flex;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.alert-row:last-child { border-bottom: 0; }

.alert-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--teal);
}

.alert-dot.warning { background: var(--amber); }
.alert-dot.error { background: var(--red); }
.alert-dot.info { background: var(--teal); }

.alert-title { font-size: 12px; font-weight: 600; }
.alert-msg { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.alert-time { font-size: 9px; color: #94a3b8; margin-top: 3px; }

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.category-card { display: flex; flex-direction: column; gap: 6px; }

.category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.category-code {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.category-card h2 { margin: 0; font-size: 15px; }
.category-price { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }

.category-stats { display: flex; gap: 20px; }

.category-stats div { display: flex; flex-direction: column; gap: 1px; }
.category-stats span { font-size: 9px; color: var(--muted); }
.category-stats strong { font-size: 12px; }

.category-note { margin: 0; font-size: 10px; color: var(--muted); line-height: 1.6; }

.notes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.note-item {
  border-left: 3px solid var(--teal);
  padding: 2px 0 2px 10px;
}

.note-item strong { font-size: 12px; }
.note-item p { margin: 4px 0 0; font-size: 10px; color: var(--muted); line-height: 1.6; }

.filter-card { display: flex; flex-direction: column; gap: 10px; }

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.filter { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filter span { font-size: 9px; color: var(--muted); }

.filter select {
  width: 100%;
  padding: 8px 7px;
  border: 1px solid #dbe4e1;
  border-radius: 10px;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 11px;
  outline: none;
}

.filter select:focus { border-color: var(--teal); }

.filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
}

.sku-list { display: flex; flex-direction: column; gap: 10px; }

.sku-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
}

.sku-main { min-width: 0; }

.sku-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sku-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  font-size: 9px;
  color: var(--muted);
}

.sku-stats { display: flex; gap: 16px; grid-column: 1; }
.sku-stats div { display: flex; flex-direction: column; gap: 1px; }
.sku-stats span { font-size: 9px; color: var(--muted); }
.sku-stats strong { font-size: 13px; }

.sku-side {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.platform-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.platform-card { display: flex; flex-direction: column; gap: 8px; }

.platform-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.platform-top h2 { margin: 0; font-size: 15px; }
.platform-top p { margin: 3px 0 0; font-size: 9px; }

.platform-share {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.platform-share strong { font-size: 24px; letter-spacing: -0.8px; }
.platform-share span { font-size: 9px; color: var(--muted); }

.platform-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.platform-meta div { display: flex; flex-direction: column; gap: 3px; }
.platform-meta span { font-size: 9px; color: var(--muted); }
.platform-meta strong { font-size: 11px; }

.platform-note { margin: 0; font-size: 10px; color: var(--muted); line-height: 1.5; }

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-list li { display: flex; gap: 10px; }

.step-no {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  flex: 0 0 auto;
}

.step-list strong { font-size: 12px; }
.step-list p { margin: 3px 0 0; font-size: 10px; color: var(--muted); line-height: 1.5; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  min-width: 560px;
}

.data-table th {
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table .strong { font-weight: 700; }

.table-note { margin: 10px 0 0; font-size: 9px; color: var(--muted); line-height: 1.6; }

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  position: relative;
  padding: 8px 0 8px 22px;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}

.check-list li:last-child { border-bottom: 0; }

.check-list li::before {
  content: "○";
  position: absolute;
  left: 2px;
  color: #94a3b8;
  font-size: 12px;
}

.check-list li.done::before { content: "✓"; color: var(--green); font-weight: 800; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.info-grid div { display: flex; flex-direction: column; gap: 3px; }
.info-grid span { font-size: 9px; color: var(--muted); }
.info-grid strong { font-size: 11px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1180px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active { color: var(--teal); background: var(--teal-soft); }

.empty {
  padding: 18px 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 60px;
  background: #eef3f1;
  border-color: transparent;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(700px 500px at 10% 0%, rgba(15, 118, 110, 0.45), transparent 60%),
    radial-gradient(600px 400px at 100% 100%, rgba(245, 158, 11, 0.22), transparent 55%),
    #0b1220;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.login-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.18);
  filter: blur(90px);
  top: -120px;
  right: -120px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 380px);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  border-radius: 24px;
  padding: 28px 24px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.login-brand { text-align: center; }
.login-brand h1 { margin: 0; font-size: 20px; letter-spacing: -0.5px; }
.login-brand p { margin: 6px 0 0; font-size: 10px; color: var(--muted); }

.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 10px; color: var(--muted); }

.field input {
  width: 100%;
  padding: 12px;
  border: 1px solid #dbe4e1;
  border-radius: 12px;
  background: #f8faf9;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.field input:focus { border-color: var(--teal); background: #fff; }

.btn-primary {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #0f766e, #115e59);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.22);
}

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

.form-error {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 11px;
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  font-size: 9px;
  color: var(--muted);
}

@media (min-width: 720px) {
  .page { padding: 22px 24px 110px; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bottom-nav {
    max-width: 560px;
    bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    padding-bottom: 6px;
  }
  .page-head h1 { font-size: 26px; }
}
