:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1c2333;
  --muted: #7a8298;
  --line: #e6e9f2;
  --primary: #2f6bff;
  --primary-dark: #1f53cc;
  --green: #17a55a;
  --amber: #d98a00;
  --red: #d64545;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(30, 45, 90, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px;
}

/* 布局 */
body { display: flex; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: #121a33; color: #eef1f8;
  display: flex; flex-direction: column; padding: 18px 12px; min-height: 100vh;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px;
}
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: #8f9bb8; }

nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  text-align: left; padding: 11px 12px; border: 0; border-radius: 9px;
  background: transparent; color: #c6cee4; cursor: pointer; font-size: 14px;
  transition: .15s;
}
.nav-btn:hover { background: #1c2647; color: #fff; }
.nav-btn.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-foot { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 12px; }
.pill {
  font-size: 11px; padding: 3px 8px; border-radius: 20px;
  background: #1c2647; color: #9fb0d8;
}

.main { flex: 1; padding: 26px 30px 60px; max-width: 1200px; }
.view-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: #3a4663; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card, .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card { margin-bottom: 14px; }
.product-card { cursor: pointer; transition: .15s; }
.product-card:hover { border-color: var(--primary); }
.product-card .name { font-weight: 700; font-size: 15px; }
.product-card .meta { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.7; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #3a4663; }
.form-grid .full { grid-column: 1 / -1; }
input, textarea, select {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fbfcfe;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #bcd0ff; border-color: var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; align-items: center; }

/* 按钮 */
.btn {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: #c7cfe2; background: #f6f8fc; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { border: 0; background: transparent; color: var(--muted); }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer; transition: .15s;
}
.list-item:hover { border-color: var(--primary); }
.list-item .t { font-weight: 600; }
.list-item .s { color: var(--muted); font-size: 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: #5a6582; font-weight: 600; background: #f7f9fd; white-space: nowrap; }
.table.kv td:first-child { color: var(--muted); width: 110px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* 标签 / 徽标 */
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #eef3ff; color: var(--primary); font-weight: 600; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.badge.generated { background: #fff3df; color: var(--amber); }
.badge.reviewed { background: #e8f4ff; color: #2470d8; }
.badge.submitted { background: #e6f7ee; color: var(--green); }
.badge.draft { background: #f0f1f5; color: var(--muted); }

.status-pending { color: var(--amber); font-weight: 600; }
.status-done { color: var(--green); font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }

.detail-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15, 22, 42, .5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; width: min(720px, 100%); max-height: 84vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-box pre {
  margin: 0; padding: 16px 18px; overflow: auto; white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.7;
}

/* 提示 */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1c2333; color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: 13px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

@media (max-width: 720px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand-title, .brand-sub, .nav-btn span, .sidebar-foot { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
