:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --line: #ded9ce;
  --text: #22231f;
  --muted: #6f7169;
  --green: #197c5c;
  --green-2: #0f5f47;
  --coral: #d8513f;
  --amber: #b7791f;
  --blue: #25636f;
  --soft: #eeebe3;
  --danger: #bd2f2f;
  --shadow: 0 10px 28px rgba(34, 35, 31, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--green); color: var(--green); }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.primary:hover { background: var(--green-2); color: #fff; }
.danger { border-color: #e4aaa3; color: var(--danger); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  outline: none;
}
textarea { min-height: 82px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25, 124, 92, 0.14);
}
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

.admin-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: #24251f;
  color: #fff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  padding: 0 8px 16px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--green);
  border-radius: 8px;
  color: #fff;
}
.nav { display: grid; gap: 4px; }
.nav button {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: #dbddd5;
  padding: 10px 12px;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.admin-main { min-width: 0; }
.topbar {
  height: 62px;
  background: rgba(255,255,255,0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.content { padding: 20px; display: grid; gap: 16px; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toolbar h1 { margin: 0; font-size: 22px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  border-left: 4px solid var(--green);
  background: #fff;
  padding: 14px;
  border-radius: 8px;
}
.stat strong { display: block; font-size: 24px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
.table-panel { overflow-x: auto; padding: 0; }
.table-panel table { min-width: 920px; }
.table-panel .site-table { min-width: 1180px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: #faf9f5; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}
.badge.ok { background: #dbf0e8; color: var(--green-2); }
.badge.warn { background: #fff1d7; color: var(--amber); }
.badge.bad { background: #f9ded9; color: var(--danger); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #ece8dd;
}
.login-box {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 14px;
}
.login-box h1 { margin: 0; font-size: 24px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.notice { color: var(--muted); font-size: 12px; line-height: 1.5; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #24251f;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 10;
}
.shop-shell { min-height: 100vh; background: #f8f6f0; }
.shop-head {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--line);
}
.shop-title { font-size: 18px; font-weight: 800; }
.shop-tabs { display: flex; gap: 8px; }
.shop-tabs button { padding: 7px 10px; }
.shop-main { width: min(980px, 100%); margin: 0 auto; padding: 14px; display: grid; gap: 14px; }
.feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.video-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  box-shadow: var(--shadow);
}
.video-cover {
  aspect-ratio: 4 / 5;
  width: 100%;
  object-fit: cover;
  background: #ddd;
}
.video-body { padding: 10px; display: grid; gap: 8px; }
.price { color: var(--coral); font-weight: 800; }
.product-hero {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}
.product-hero img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.sku-row, .order-row {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.tier-list { display: flex; flex-wrap: wrap; gap: 8px; }
.bottom-nav {
  display: none;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(3, 1fr);
}
.bottom-nav button { border: 0; border-radius: 0; padding: 12px 4px; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-3, .cols-4, .feed, .product-hero { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; align-items: flex-start; height: auto; min-height: 62px; flex-direction: column; justify-content: center; gap: 8px; }
  table { white-space: nowrap; }
  .shop-tabs { display: none; }
  .bottom-nav { display: grid; }
}
