/* 康农甄选后台 · 简洁白 */
:root {
  --ink: #222;
  --muted: #888;
  --line: #ececec;
  --bg: #f5f5f5;
  --card: #ffffff;
  --primary: #111;
  --success: #222;
  --danger: #cf1322;
  --warn: #d48806;
  --radius: 12px;
  --side: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
  width: var(--side);
  background: #fff;
  color: var(--ink);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 20;
  border-right: 1px solid var(--line);
}
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}
.sidebar-header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.nav-group {
  padding: 16px 18px 6px;
  font-size: 11px;
  color: #aaa;
  letter-spacing: .5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 10px;
  padding: 11px 14px;
  color: #444;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  transition: background .12s ease, color .12s ease, opacity .12s ease;
}
.nav-item:hover {
  background: #f5f5f5;
  color: #111;
  text-decoration: none;
}
.nav-item.active {
  background: #111;
  color: #fff;
}
.nav-item.is-loading {
  opacity: .55;
  pointer-events: none;
}
body.kn-nav-busy .main {
  opacity: .72;
  transition: opacity .12s ease;
}
.kn-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  background: linear-gradient(90deg, #07c160, #111);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.kn-top-progress.on {
  opacity: 1;
  animation: knProgress 1.1s ease-in-out infinite;
}
@keyframes knProgress {
  0% { transform: scaleX(0.08); }
  50% { transform: scaleX(0.72); }
  100% { transform: scaleX(0.95); }
}
.nav-item.logout {
  margin-top: 18px;
  color: #999;
}
.nav-item.logout:hover {
  background: #fff1f0;
  color: var(--danger);
}
button.nav-item.kn-order-alert-test {
  width: calc(100% - 16px);
  margin: 10px 8px 0;
  border: 0;
  background: #f2faf5;
  color: #07c160;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
}
button.nav-item.kn-order-alert-test:hover {
  background: #e8f8ee;
  color: #06ad56;
  text-decoration: none;
}
.nav-ico { width: 18px; text-align: center; opacity: .7; }

.main {
  margin-left: var(--side);
  flex: 1;
  padding: 28px 32px 48px;
  min-width: 0;
}
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.top-bar h1 {
  font-size: 22px;
  font-weight: 700;
  color: #111;
}
.top-bar .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.top-actions { display: flex; gap: 10px; align-items: center; }

.msg {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  background: #f7f7f7;
  border: 1px solid #e8e8e8;
  color: #333;
}
.msg.err {
  background: #fff2f0;
  border-color: #ffccc7;
  color: #cf1322;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--line);
}
.stat-card .label { font-size: 13px; color: var(--muted); }
.stat-card .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  color: #111;
}
.stat-card .value.green,
.stat-card .value.blue { color: #111; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.card h2 {
  font-size: 15px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card h2 .hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.section-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #666;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.section-tab.active {
  background: #111;
  border-color: #111;
  color: #fff;
  font-weight: 600;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}
.form-group label .req { color: var(--danger); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.form-group textarea {
  min-height: 110px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #111;
}
.form-full { grid-column: 1 / -1; }
.help {
  margin-top: 6px;
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.on { background: #f5f5f5; color: #111; }
.status-pill.off { background: #f5f5f5; color: #999; }
.status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.switch-row input { width: 18px; height: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: .15s ease;
  background: #f5f5f5;
  color: #222;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-success { background: #111; color: #fff; border-color: #111; }
.btn-success:hover { background: #333; }
.btn-danger { background: #fff; color: var(--danger); border-color: #ffccc7; padding: 5px 10px; font-size: 12px; }
.btn-edit { background: #fff; color: #666; border: 1px solid #ddd; padding: 5px 10px; font-size: 12px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost {
  background: #fff;
  border: 1px solid #ddd;
  color: #333;
}
.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: #fafafa;
  padding: 11px 12px;
  text-align: left;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  vertical-align: middle;
}
tr:hover td { background: #fafafa; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  background: #999;
}
.img-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #eee;
}
.form-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.form-row .form-group { margin-bottom: 0; flex: 1; }
.hidden { display: none !important; }

.callout {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid var(--line);
  color: #555;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.callout.warn {
  background: #fffbe6;
  border-color: #ffe58f;
  color: #ad6800;
}

/* 居中弹窗 */
body.drawer-lock { overflow: hidden; }
.drawer-mask,
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.drawer-mask.open,
.modal-mask.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer-panel,
.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,.18);
  transform: translateY(12px) scale(.98);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-mask.open .drawer-panel,
.modal-mask.open .modal-panel {
  transform: translateY(0) scale(1);
}
.drawer-head,
.modal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-head h3,
.modal-head h3 { font-size: 16px; margin: 0; }
.drawer-body,
.modal-body {
  padding: 16px 18px 20px;
  overflow: auto;
  flex: 1;
}
.drawer-foot,
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #fff;
  flex-shrink: 0;
}
.icon-btn {
  border: 0;
  background: #f5f5f5;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: #666;
  font-size: 18px;
  line-height: 1;
}
.icon-btn:hover { background: #eee; color: #111; }
.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-row input[type=text] { flex: 1; }
.upload-preview {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); display: none; margin-top: 8px;
}
.product-gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.product-gallery-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f6f7f8;
}
.product-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-gallery-item button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
/* 居中轻提示 */
.kn-toast {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
  padding: 24px;
}
.kn-toast.show { opacity: 1; }
.kn-toast-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 92vw);
  background: #fff;
  color: #111;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.12);
  transform: translateY(8px) scale(.98);
  transition: transform .22s ease;
}
.kn-toast.show .kn-toast-card { transform: translateY(0) scale(1); }
.kn-toast-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.kn-toast.err .kn-toast-ico { background: #cf1322; }
.kn-toast-text {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

/* 居中提示 / 确认弹窗 */
.kn-tip-mask {
  position: fixed;
  inset: 0;
  z-index: 2300;
  background: rgba(0,0,0,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.kn-tip-mask.open {
  opacity: 1;
  pointer-events: auto;
}
.kn-tip-panel {
  width: min(400px, 92vw);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #ececec;
  box-shadow: 0 20px 50px rgba(0,0,0,.16);
  padding: 28px 24px 20px;
  text-align: center;
  transform: translateY(10px) scale(.98);
  transition: transform .2s ease;
}
.kn-tip-mask.open .kn-tip-panel {
  transform: translateY(0) scale(1);
}
.kn-tip-ico {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: #111;
}
.kn-tip-ico.err { background: #cf1322; }
.kn-tip-ico.ask { background: #555; }
.kn-tip-title {
  font-size: 17px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}
.kn-tip-msg {
  font-size: 14px;
  line-height: 1.55;
  color: #555;
  word-break: break-word;
  margin-bottom: 20px;
}
.kn-tip-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.kn-tip-actions .btn {
  min-width: 96px;
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
}
