:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ea;
  --line-strong: #cbd5e1;
  --panel: #ffffff;
  --surface: #f5f7fa;
  --surface-strong: #eef3f7;
  --teal: #0f766e;
  --teal-soft: #dff8f3;
  --amber: #b45309;
  --amber-soft: #fff3d8;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }
a { color: inherit; }
.app-shell { min-height: 100vh; }
.loading-screen { min-height: 100vh; display: grid; place-items: center; gap: 16px; align-content: center; color: var(--muted); }
.loading-screen img { width: 72px; height: 72px; }
.public-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 390px; }
.public-main { padding: 32px; display: flex; flex-direction: column; gap: 22px; }
.public-side { min-height: 100vh; background: var(--panel); border-left: 1px solid var(--line); padding: 32px 28px; display: flex; flex-direction: column; gap: 22px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row img { width: 44px; height: 44px; }
.brand-title { font-weight: 760; font-size: 18px; }
.brand-subtitle { color: var(--muted); font-size: 13px; }
.public-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.public-heading h1, .page-heading h1 { margin: 0; font-size: 26px; line-height: 1.2; }
.public-heading p, .page-heading p { margin: 8px 0 0; color: var(--muted); }
.segment { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; }
.segment button { min-width: 96px; padding: 8px 12px; color: var(--muted); background: transparent; border-radius: 6px; white-space: nowrap; }
.segment button.active { color: var(--ink); background: var(--surface-strong); font-weight: 700; }
.form-panel, .login-panel, .compact-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.form-panel { padding: 22px; }
.login-panel, .compact-panel { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field span { color: #334155; font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea, .search {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); border-radius: 7px; padding: 10px 11px; outline: none; min-height: 42px;
}
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 7px; background: var(--ink); color: #fff; font-weight: 760; white-space: nowrap; }
.btn.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.ghost { background: transparent; color: var(--muted); }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 7px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.icon { width: 18px; height: 18px; display: inline-block; }
.message { min-height: 20px; color: var(--muted); font-size: 13px; }
.message.ok { color: var(--teal); }
.message.error { color: var(--rose); }
.demo-list { display: grid; gap: 10px; margin-top: 12px; }
.demo-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 13px; }
.demo-item strong { color: var(--ink); }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { min-height: 100vh; background: #111827; color: #e5e7eb; display: flex; flex-direction: column; padding: 22px 16px; gap: 22px; }
.sidebar .brand-subtitle { color: #9ca3af; }
.nav-list { display: grid; gap: 7px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; border-radius: 7px; color: #cbd5e1; background: transparent; text-align: left; }
.nav-btn.active, .nav-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; }
.user-card { padding: 12px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
.user-card strong { display: block; color: #fff; }
.user-card span { color: #9ca3af; font-size: 13px; }
.main-content { min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { min-width: 220px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 4px; font-size: 24px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr); gap: 16px; align-items: start; }
.list-grid { display: grid; gap: 12px; }
.product-card, .training-card, .lead-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-head h2, .training-card h2, .compact-panel h2, .login-panel h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; color: #334155; background: var(--surface-strong); border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.teal { color: var(--teal); background: var(--teal-soft); }
.pill.amber { color: var(--amber); background: var(--amber-soft); }
.pill.blue { color: var(--blue); background: var(--blue-soft); }
.pill.rose { color: var(--rose); background: var(--rose-soft); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.detail-box { padding: 12px; background: var(--surface); border-radius: 7px; border: 1px solid var(--line); }
.detail-box strong { display: block; margin-bottom: 5px; font-size: 13px; }
.detail-box ul { margin: 0; padding-left: 18px; color: var(--muted); }
.ai-panel { position: sticky; top: 20px; display: grid; gap: 12px; }
.ai-output { min-height: 180px; padding: 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; white-space: pre-wrap; color: #334155; }
.source-list { display: grid; gap: 8px; }
.source-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 13px; }
.source-item strong { display: block; color: var(--ink); }
.training-card { display: grid; gap: 12px; }
.training-card p { margin: 0; color: var(--muted); }
.checklist { display: grid; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; color: #334155; }
.check-item input { width: 17px; height: 17px; accent-color: var(--teal); }
.table-panel { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475569; font-size: 13px; background: var(--surface); }
td { color: #334155; }
tr:last-child td { border-bottom: 0; }
.amount { font-weight: 800; color: var(--ink); }
.empty { padding: 26px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); border-radius: 8px; }
.mobile-header { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
@media (max-width: 1060px) {
  .public-layout, .workspace { grid-template-columns: 1fr; }
  .public-side { min-height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .sidebar { display: none; }
  .workspace.nav-open .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: min(82vw, 290px); z-index: 10; box-shadow: var(--shadow); }
  .mobile-header { display: flex; }
  .main-content { padding: 18px; }
  .content-grid { grid-template-columns: 1fr; }
  .ai-panel { position: static; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .public-main, .public-side { padding: 20px; }
  .public-header, .topbar { flex-direction: column; align-items: stretch; }
  .form-grid, .detail-grid, .metrics { grid-template-columns: 1fr; }
  .segment { width: 100%; }
  .segment button { min-width: 0; }
  .toolbar { align-items: stretch; }
  .search, .toolbar .btn, .toolbar select { width: 100%; }
}
