/* ==============================================
   极越AI智能内部运营平台 - Design System v1.5
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---- Tokens ------------------------------------------------ */
:root {
  --bg: #F1F2F8;
  --bg-2: #E9EAF4;
  --surface: #FFFFFF;
  --surface-2: #FAFAFD;
  --border: #EAEBF4;
  --border-strong: #DCDDEC;

  --text: #0F172A;
  --text-2: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --primary: #5046E5;
  --primary-2: #7C3AED;
  --primary-soft: #EEF1FE;
  --primary-glow: rgba(80, 70, 229, 0.18);
  --gradient-primary: linear-gradient(135deg, #5046E5 0%, #7C3AED 100%);
  --gradient-soft: linear-gradient(135deg, #EEF1FE 0%, #F3EBFF 100%);

  --success: #10B981;
  --success-soft: #D1FAE5;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  --info: #3B82F6;
  --info-soft: #DBEAFE;

  --c1: #5046E5;
  --c2: #06B6D4;
  --c3: #10B981;
  --c4: #F97316;
  --c5: #EC4899;

  --sidebar-bg: #15132E;
  --sidebar-text: rgba(255, 255, 255, 0.55);
  --sidebar-text-active: #FFFFFF;
  --sidebar-active-bg: rgba(255, 255, 255, 0.08);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.06), 0 16px 48px rgba(15, 23, 42, 0.06);
  --shadow-primary: 0 4px 20px rgba(80, 70, 229, 0.28);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 999px;

  --t-fast: 0.15s cubic-bezier(.4,0,.2,1);
  --t: 0.25s cubic-bezier(.4,0,.2,1);

  --side-w: 220px;
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: 0; color: inherit; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---- Auth Shell -------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.20) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(80, 70, 229, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.10) 0%, transparent 60%),
    var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-shell::before, .auth-shell::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}
.auth-shell::before {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(80, 70, 229, 0.4), transparent 60%);
  top: -80px; left: -80px;
}
.auth-shell::after {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.32), transparent 60%);
  bottom: -100px; right: -100px;
}
.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-2xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.auth-brand .mark {
  width: 44px; height: 44px;
  background: var(--gradient-primary);
  border-radius: 12px;
  position: relative;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}
.auth-brand .mark::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(2px);
}
.auth-brand h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.auth-brand .sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.auth-card h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-card .lead {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 13px;
}

/* ---- App Shell --------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
}
.sidebar {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}
.sidebar-logo {
  min-height: 52px;
  background: var(--gradient-primary);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  color: white;
  font-size: 13px;
  line-height: 1.1;
  padding: 10px 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-primary);
}
.sidebar-logo strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
}
.sidebar-logo span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.76);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidebar-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  color: var(--sidebar-text);
  padding: 0 12px;
  transition: var(--t);
  position: relative;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-nav a:hover { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }
.sidebar-nav a.active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: white;
  border-radius: 0 2px 2px 0;
}
.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin-top: auto;
}

/* ---- Topbar ------------------------------------------------ */
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
}
.topbar .crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.topbar .crumb a { transition: var(--t); }
.topbar .crumb a:hover { color: var(--primary); }
.topbar .crumb strong { color: var(--text); font-weight: 600; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px 5px 5px;
  background: var(--surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.user-chip .who { font-size: 13px; line-height: 1.2; }
.user-chip .who small { display: block; color: var(--text-muted); font-size: 11px; margin-top: 2px; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  background: var(--gradient-primary);
  font-size: 13px;
  flex-shrink: 0;
}

.page-content {
  padding: 8px 32px 40px;
  flex: 1;
}

/* ---- Cards ------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.card.flat { box-shadow: none; }
.card.elev { box-shadow: var(--shadow); }
.card-pad { padding: 24px; }

/* ---- Hero -------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F3FF 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  margin-bottom: 24px;
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
}
.hero::before {
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.28), transparent);
  top: -60px; right: 200px;
}
.hero::after {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(80, 70, 229, 0.20), transparent);
  bottom: -120px; right: -80px;
}
.hero > * { position: relative; z-index: 1; }
.hero .greeting {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hero .hello {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  line-height: 1.15;
}
.hero .lead {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 560px;
}
.hero-shape {
  width: 168px; height: 168px;
  border-radius: 50%;
  background: var(--gradient-primary);
  position: relative;
  box-shadow: 0 24px 60px rgba(80, 70, 229, 0.32), 0 8px 32px rgba(124, 58, 237, 0.24);
  flex-shrink: 0;
}
.hero-shape::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0));
}
.hero-shape::after {
  content: '';
  position: absolute;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  filter: blur(8px);
  top: 28px; left: 32px;
}

/* ---- Stats ------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--t);
  box-shadow: var(--shadow-xs);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -4px currentColor;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.bg-1 { background: linear-gradient(135deg, #5046E5, #7C3AED); color: rgba(80,70,229,0.6); }
.stat-icon.bg-2 { background: linear-gradient(135deg, #06B6D4, #3B82F6); color: rgba(6,182,212,0.6); }
.stat-icon.bg-3 { background: linear-gradient(135deg, #10B981, #059669); color: rgba(16,185,129,0.6); }
.stat-icon.bg-4 { background: linear-gradient(135deg, #F97316, #F43F5E); color: rgba(249,115,22,0.6); }
.stat-icon svg { color: white; }
.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card .value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ---- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 13px;
  transition: var(--t);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(80, 70, 229, 0.36); }
.btn-light {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-light:hover { background: var(--bg-2); }
.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.28);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(16, 185, 129, 0.36); }
.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}
.btn-primary:disabled,
.btn-success:disabled {
  background: #E5E7EB;
  color: #64748B;
  border-color: #E5E7EB;
}
.btn-primary:disabled:hover,
.btn-success:disabled:hover {
  transform: none;
  box-shadow: none;
}
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-2); }
.btn-block { width: 100%; justify-content: center; padding: 13px 18px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---- Forms ------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field label,
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field .control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px;
  transition: var(--t);
  outline: 0;
}
.field .control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.field-error {
  background: var(--danger-soft);
  color: #B91C1C;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---- Staff report uploader -------------------------------- */
.report-uploader { margin-bottom: 28px; }
.daily-upload-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 13px;
}
.daily-upload-note strong { color: var(--text); }
.upload-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 180px minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
}
.upload-file-field { margin-bottom: 16px; }
.upload-actions {
  margin-bottom: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.workflow-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
}
.workflow-step {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.workflow-step.active { background: var(--primary-soft); color: var(--primary); }
.workflow-step.done { background: var(--success-soft); color: #047857; }
.upload-status {
  min-height: 28px;
  padding-top: 6px;
  font-size: 13px;
}
.upload-status[data-state="error"] { color: #B91C1C; }
.upload-status[data-state="ok"] { color: #047857; }
.upload-status[data-state="warning"] { color: #B45309; }
.submit-guard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #92400E;
  font-size: 13px;
}
.submit-guard strong { color: #78350F; }
.submit-guard span { color: #92400E; }
.submit-guard[hidden] { display: none; }
.metric-editor {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.metric-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.metric-editor-head strong { display: block; font-size: 15px; }
.metric-editor-head small { display: block; color: var(--text-muted); margin-top: 3px; }
.recognition-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  align-items: start;
}
.recognition-workbench.simple {
  grid-template-columns: minmax(0, 1fr);
}
.recognition-workbench [hidden] {
  display: none !important;
}
.recognition-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 14px;
}
.recognition-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.recognition-panel-head strong {
  display: block;
  font-size: 14px;
}
.recognition-panel-head small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
}
.recognition-field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recognition-field-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, .7fr) minmax(130px, .6fr) minmax(120px, .5fr) minmax(110px, .5fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.recognition-workbench.simple .recognition-field-row {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 0.72fr);
  min-height: 62px;
}
.recognition-field-row.extra {
  grid-template-columns: minmax(160px, 1fr) 132px minmax(132px, .75fr) minmax(110px, .6fr) minmax(100px, .55fr);
}
.recognition-field-source {
  min-width: 0;
}
.recognition-field-source strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.recognition-field-source span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recognition-field-row .control {
  height: 36px;
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
}
.recognition-field-row .compact-input {
  min-width: 0;
}
.recognition-run-row {
  display: block;
}
.recognition-run-row summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.recognition-run-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.recognition-run-field {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface-2);
}
.recognition-run-field strong,
.recognition-run-field span {
  display: block;
  font-size: 12px;
}
.recognition-run-field span {
  color: var(--text-muted);
  margin-top: 3px;
}
.recognized-metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.recognized-metric-strip span {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
}
.metric-field span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.metric-field small {
  display: block;
  color: var(--text-light);
  font-size: 11px;
  margin-top: 5px;
}
.metric-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---- Sales AI workbench ----------------------------------- */
.section-head.compact {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head.compact h2 {
  margin: 0;
  font-size: 16px;
}
.section-head.compact p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}
.sales-ai-workspace {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}
.sales-ai-workspace-chat {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}
.sales-ai-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.86)),
    radial-gradient(circle at 92% 8%, rgba(80,70,229,0.14), transparent 34%);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}
.sales-ai-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 9px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sales-ai-hero h1 {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
}
.sales-ai-hero p {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--text-muted);
  line-height: 1.7;
}
.sales-ai-hero-stats {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}
.sales-ai-hero-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.sales-ai-hero-stats strong {
  color: var(--text);
  font-size: 14px;
}
.sales-ai-shell {
  min-height: min(760px, calc(100vh - 232px));
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}
.sales-ai-workspace-chat .sales-ai-shell {
  min-height: calc(100vh - 132px);
}
.sales-ai-rail,
.sales-ai-chat,
.sales-ai-context .sales-context-card {
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255,255,255,0.88);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.06);
}
.sales-ai-rail {
  min-height: 0;
  align-self: start;
  position: sticky;
  top: 82px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: 14px;
  border-radius: 22px;
}
.sales-history-search {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #F8FAFC;
  color: var(--text);
  outline: none;
}
.sales-history-search:focus {
  border-color: rgba(80, 70, 229, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(80, 70, 229, 0.08);
}
.sales-new-chat {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  background: #0F172A;
  color: #fff;
  font-weight: 750;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  transition: var(--t);
}
.sales-new-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
}
.sales-new-chat span::before {
  content: "+";
}
.sales-new-chat span {
  font-size: 18px;
  line-height: 1;
}
.sales-rail-section {
  display: grid;
  gap: 10px;
}
.sales-rail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.sales-rail-title small {
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  text-align: center;
}
.sales-product-list,
.sales-session-list {
  display: grid;
  gap: 9px;
}
.sales-session-group {
  display: grid;
  gap: 8px;
}
.sales-session-date {
  padding: 6px 4px 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
}
.sales-product-item,
.sales-session-item,
.sales-empty-mini {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(248, 250, 252, 0.72);
  color: var(--text);
  transition: var(--t);
}
.sales-product-item:hover,
.sales-session-item:hover {
  border-color: rgba(80, 70, 229, 0.32);
  background: #fff;
  transform: translateY(-1px);
}
.sales-product-item.active,
.sales-session-item.active {
  border-color: rgba(80, 70, 229, 0.46);
  background: linear-gradient(135deg, #F7F8FF, #FFFFFF);
  box-shadow: inset 3px 0 0 var(--primary);
}
.sales-product-item strong,
.sales-session-item strong,
.sales-empty-mini strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-product-item span,
.sales-session-item span,
.sales-empty-mini span,
.sales-session-item small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-empty-mini {
  border-style: dashed;
}
.sales-ai-form-grid {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.sales-ai-chat {
  min-width: 0;
  min-height: min(760px, calc(100vh - 232px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 24px;
}
.sales-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.78);
}
.sales-chat-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sales-chat-head > div:first-child {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  gap: 2px 9px;
}
.sales-chat-head > div:first-child .sales-live-dot {
  grid-row: 1 / span 2;
  align-self: center;
}
.sales-chat-head strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-chat-head small {
  grid-column: 2;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-chat-head > span,
.sales-chat-head-actions > span {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.sales-chat-head > span[data-state="running"],
.sales-chat-head-actions > span[data-state="running"] {
  background: var(--primary-soft);
  color: var(--primary);
}
.sales-chat-head > span[data-state="error"],
.sales-chat-head-actions > span[data-state="error"] {
  background: var(--danger-soft);
  color: var(--danger);
}
.sales-chat-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.sales-mobile-chip {
  display: none;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.sales-live-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}
.sales-chat-thread {
  min-height: 420px;
  overflow: auto;
  padding: 28px min(4vw, 42px);
  background:
    linear-gradient(180deg, rgba(248,250,252,0.86), rgba(241,245,249,0.58)),
    radial-gradient(circle at 0 0, rgba(80,70,229,0.08), transparent 28%);
}
.sales-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 820px);
  gap: 12px;
  margin-bottom: 18px;
}
.sales-message.user {
  grid-template-columns: minmax(0, 760px) 34px;
  justify-content: end;
}
.sales-message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
  background: #0F172A;
  color: #fff;
  border-color: #0F172A;
}
.sales-message.user .message-card {
  grid-column: 1;
  grid-row: 1;
  background: #0F172A;
  color: #fff;
  border-color: rgba(15, 23, 42, 0.88);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.13);
}
.sales-message.user .message-meta,
.sales-message.user .message-card p {
  color: #fff;
}
.sales-message.user .message-meta {
  opacity: 0.72;
}
.message-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(80, 70, 229, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, #FFFFFF, #F2F5FF);
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}
.message-card {
  padding: 16px 17px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}
.message-meta {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.message-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.82;
  white-space: pre-wrap;
}
.prompt-suggestions,
.source-inline-list,
.sales-result-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.prompt-suggestions button,
.source-inline-list span,
.sales-result-sources span {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
}
.prompt-suggestions button {
  cursor: pointer;
  transition: var(--t);
}
.prompt-suggestions button:hover {
  border-color: rgba(80, 70, 229, 0.32);
  color: var(--primary);
  background: var(--primary-soft);
}
.sales-composer {
  margin: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.86);
}
.composer-box {
  overflow: hidden;
  padding: 13px 13px 12px;
  border: 1px solid rgba(154, 140, 255, 0.46);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
  transition: var(--t);
}
.composer-box:focus-within {
  border-color: rgba(80, 70, 229, 0.68);
  box-shadow:
    0 0 0 4px rgba(80, 70, 229, 0.08),
    0 18px 42px rgba(15, 23, 42, 0.08);
}
.sales-ai-input {
  width: 100%;
  min-height: 82px;
  max-height: 240px;
  padding: 8px 4px 10px;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  resize: none;
}
.sales-ai-input:focus {
  box-shadow: none;
}
.sales-ai-input::placeholder {
  color: var(--text-light);
}
.composer-foot,
.composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.composer-foot {
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(226, 232, 240, 0.72);
}
.composer-tools {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  color: var(--text-muted);
  font-size: 12px;
}
.composer-tool-label {
  display: none;
}
.composer-select {
  min-width: 150px;
  display: block;
  position: relative;
}
.composer-select > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.composer-select select {
  width: 100%;
  min-height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #F8FAFC;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 750;
  outline: 0;
}
.composer-select select:focus {
  border-color: rgba(80, 70, 229, 0.62);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(80, 70, 229, 0.08);
}
.composer-tools span + span::before {
  content: "/";
  margin-right: 10px;
  color: var(--text-light);
}
.send-round {
  flex-shrink: 0;
  min-width: 88px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: #0F172A;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: var(--t);
}
.send-round:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}
.send-round:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}
.sales-ai-context {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 18px;
}
.sales-ai-context .sales-context-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
}
.sales-context-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sales-context-title strong {
  color: var(--text);
  font-size: 15px;
}
.sales-context-title span {
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}
.sales-context-card label {
  display: grid;
  gap: 7px;
}
.sales-context-card label span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}
.sales-context-card .control {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
}
.sales-result-card {
  min-height: 300px;
}
.sales-result-body {
  min-height: 138px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.75);
}
.sales-result-body p {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
}
.sales-result-sources {
  margin-top: 0;
}

.sales-mobile-sheet[hidden] {
  display: none;
}
.sales-mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
}
.sales-mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
}
.sales-mobile-sheet-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}
.sales-mobile-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sales-mobile-sheet-head strong,
.sales-mobile-sheet-head span {
  display: block;
}
.sales-mobile-sheet-head strong {
  color: var(--text);
  font-size: 15px;
}
.sales-mobile-sheet-head span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}
.sales-mobile-session-list {
  display: grid;
  gap: 9px;
}

.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.36);
}
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.18);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0;
  font-size: 17px;
}
.modal-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.daily-submit-checks {
  display: grid;
  gap: 10px;
  padding: 18px 20px 4px;
}
.daily-submit-checks div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.daily-submit-checks strong { font-size: 13px; }
.daily-submit-checks span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.daily-submit-checks span[data-state="ok"] { color: #047857; }
.daily-submit-checks span[data-state="warn"] { color: #B45309; }
.daily-submit-checks span[data-state="wait"] { color: var(--text-muted); }
.daily-submit-modal .field {
  display: block;
  padding: 14px 20px 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 20px 20px;
}

/* ---- Tabs -------------------------------------------------- */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 2px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.tabs button {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--t);
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Project Grid & Card ----------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--t);
  cursor: pointer;
  display: block;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(80, 70, 229, 0.3);
  box-shadow: 0 16px 40px rgba(80, 70, 229, 0.10);
}
.project-card .pi {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 18px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
  letter-spacing: -0.02em;
}
.project-card .pi-1 { background: linear-gradient(135deg, #5046E5, #7C3AED); }
.project-card .pi-2 { background: linear-gradient(135deg, #06B6D4, #3B82F6); }
.project-card .pi-3 { background: linear-gradient(135deg, #10B981, #059669); }
.project-card .pi-4 { background: linear-gradient(135deg, #F97316, #F43F5E); }
.project-card .pi-5 { background: linear-gradient(135deg, #EC4899, #BE185D); }
.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.project-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
  line-height: 1.5;
}
.project-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-light);
}
.project-card .badges { display: flex; gap: 6px; }

/* ---- Badges & Chips ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.badge-soft { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: #047857; }
.badge-warning { background: var(--warning-soft); color: #B45309; }
.badge-muted { background: var(--bg-2); color: var(--text-muted); }
.badge-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(80, 70, 229, 0.25);
  padding: 4px 10px;
}

/* ---- External System Links -------------------------------- */
.external-links-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-xs);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.section-head p {
  color: var(--text-muted);
  font-size: 12px;
}
.external-link-groups {
  display: grid;
  gap: 12px;
}
.external-link-group {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.external-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.group-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #06B6D4, #5046E5);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.18);
  flex-shrink: 0;
}
.external-group-title strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.external-group-title small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}
.external-link-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.external-link-item {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: var(--t);
}
.external-link-item:hover {
  border-color: rgba(80, 70, 229, 0.35);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.external-link-name {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.external-link-desc {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.external-link-item svg {
  color: var(--primary);
  flex-shrink: 0;
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---- Page Header ------------------------------------------- */
.page-head {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.page-head .sub { color: var(--text-muted); font-size: 13px; }

/* ---- Empty / Alert ----------------------------------------- */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}
.empty .icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--gradient-soft);
  display: grid;
  place-items: center;
  color: var(--primary);
}
.empty h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* ---- Detail page ------------------------------------------- */
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.back-link {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  transition: var(--t);
}
.back-link:hover { color: var(--primary); }
.detail-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.detail-desc { color: var(--text-muted); font-size: 14px; max-width: 640px; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.meta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.meta-card .label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 600;
}
.meta-card .value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.meta-card .value small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.content-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  min-height: 280px;
  box-shadow: var(--shadow-xs);
}

/* ---- Prompt cards ------------------------------------------ */
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.prompt-head .name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.prompt-body { padding: 20px; }
.prompt-body pre {
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  max-height: 360px;
  overflow: auto;
}

/* ---- Markdown content -------------------------------------- */
.md-content { font-size: 14px; line-height: 1.75; color: var(--text); }
.md-content > *:first-child { margin-top: 0 !important; }
.md-content h1, .md-content h2, .md-content h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1.4em 0 0.5em;
}
.md-content h1 { font-size: 22px; }
.md-content h2 { font-size: 18px; }
.md-content h3 { font-size: 15px; color: var(--primary); }
.md-content p { margin-bottom: 12px; }
.md-content ul, .md-content ol { margin: 0 0 14px 24px; }
.md-content li { margin-bottom: 4px; }
.md-content code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--primary);
}
.md-content pre {
  background: var(--bg-2);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 14px 0;
  font-size: 12.5px;
}
.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.md-content th, .md-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.md-content th { background: var(--surface-2); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.md-content tr:last-child td { border-bottom: 0; }
.md-content blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  padding: 12px 16px;
  margin: 14px 0;
  border-radius: 4px;
  color: var(--text-2);
}
.md-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.md-content strong { font-weight: 700; color: var(--text); }
.md-content hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---- Login Split Layout ------------------------------------ */
.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  padding: 72px 56px;
  color: white;
  overflow: hidden;
}

.login-brand-bg {
  position: absolute;
  inset: 0;
  /* 真实办公场景 - Unsplash photo by Israel Andrade (人们围桌讨论的现代办公室) */
  background-image:
    linear-gradient(135deg, rgba(80, 70, 229, 0.62) 0%, rgba(67, 56, 202, 0.55) 50%, rgba(124, 58, 237, 0.50) 100%),
    url('https://images.unsplash.com/photo-1497366754035-f200968a6e72?ixlib=rb-4.0.3&auto=format&fit=crop&w=1600&q=85');
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.login-brand-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 1;
}
.login-brand-glow-1 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(255,255,255,0.25), transparent 60%);
  top: -100px; right: -80px;
}
.login-brand-glow-2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(252, 165, 165, 0.35), transparent 60%);
  bottom: -60px; left: 100px;
}

.login-brand-content {
  position: relative;
  z-index: 2;
  max-width: 460px;
}

.brand-mark {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 36px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.brand-mark svg { color: white; }

.brand-name {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.brand-tagline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  opacity: 0.75;
  margin-bottom: 28px;
}

.brand-desc {
  font-size: 16px;
  line-height: 1.65;
  opacity: 0.92;
  max-width: 420px;
  margin-bottom: 36px;
}

.brand-feats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 48px;
}
.brand-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  opacity: 0.92;
}
.brand-feat .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.brand-foot {
  font-size: 12px;
  opacity: 0.65;
  letter-spacing: 0.04em;
}

.login-form-side {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  min-height: 100vh;
}

.login-form-wrap {
  width: 100%;
  max-width: 380px;
}

.login-h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--text);
}

.login-lead {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.login-foot {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { padding: 36px 28px; min-height: 240px; }
  .brand-mark { width: 48px; height: 48px; margin-bottom: 20px; }
  .brand-name { font-size: 26px; }
  .brand-desc { font-size: 14px; margin-bottom: 20px; }
  .brand-feats { display: none; }
  .brand-foot { display: none; }
  .login-form-side { padding: 32px 20px; min-height: auto; }
}

/* ---- Doc toolbar (复制全文 / 全屏阅读) -------------------- */
.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.doc-meta-text {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.doc-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hidden-raw {
  position: absolute !important;
  left: -10000px !important;
  top: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---- Fullscreen reading overlay --------------------------- */
.fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  animation: fs-fade-in 0.18s ease-out;
}
.fs-overlay[hidden] { display: none !important; }
.fs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.fs-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.fs-content {
  flex: 1;
  overflow: auto;
  padding: 40px 80px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  font-size: 16px;
  line-height: 1.85;
}
body.no-scroll { overflow: hidden; }

@keyframes fs-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 720px) {
  .fs-bar { padding: 12px 16px; }
  .fs-content { padding: 24px 20px; font-size: 15px; }
}

/* ---- Util -------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ---- Responsive -------------------------------------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .detail-meta { grid-template-columns: repeat(2, 1fr); }
  .upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-actions { justify-content: flex-start; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recognition-workbench { grid-template-columns: 1fr; }
  .recognition-field-row,
  .recognition-field-row.extra { grid-template-columns: minmax(180px, 1fr) minmax(130px, .7fr) minmax(120px, .6fr); }
  .sales-ai-hero { align-items: flex-start; flex-direction: column; }
  .sales-ai-hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .sales-ai-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .sales-ai-form-grid { grid-template-columns: 1fr; }
  .sales-ai-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-shape { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .topbar { height: 56px; }
  .topbar .crumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-chip { padding: 4px; }
  .user-chip .who { display: none; }
  .page-content { padding: 0 10px 10px; }
  .external-link-group { grid-template-columns: 1fr; }
  .section-head { align-items: stretch; flex-direction: column; }
  .detail-head { flex-direction: column; }
  .detail-title { font-size: 22px; }
  .upload-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .recognition-field-row,
  .recognition-field-row.extra { grid-template-columns: 1fr; }
  .sales-ai-workspace {
    min-height: calc(100svh - 56px) !important;
    height: calc(100svh - 56px) !important;
    display: block !important;
    gap: 0 !important;
    margin: 0 -10px -10px !important;
    overflow: hidden !important;
    background: #EEF2F7;
  }
  .sales-ai-hero {
    display: none !important;
  }
  .sales-ai-shell {
    display: block !important;
    min-height: 0 !important;
    height: 100% !important;
  }
  .sales-ai-rail,
  .sales-ai-context {
    display: none !important;
  }
  .sales-ai-form-grid {
    display: block !important;
    min-height: 0 !important;
    height: 100% !important;
  }
  .sales-ai-chat {
    min-height: 0 !important;
    height: 100% !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #F8FAFC !important;
  }
  .sales-chat-head {
    align-items: center;
    flex-direction: row;
    min-height: 56px;
    padding: 10px 14px;
    background: rgba(248,250,252,0.96);
    backdrop-filter: blur(14px);
  }
  .sales-chat-head > div:first-child {
    flex: 1;
  }
  .sales-chat-head-actions { min-width: 0; flex-shrink: 0; }
  .sales-chat-head-actions > span {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sales-mobile-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sales-chat-thread {
    min-height: 0;
    padding: 14px 12px 10px;
    background:
      linear-gradient(180deg, rgba(248,250,252,0.92), rgba(241,245,249,0.78)),
      radial-gradient(circle at 0 0, rgba(80,70,229,0.06), transparent 34%);
  }
  .sales-message {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    margin-bottom: 14px;
  }
  .sales-message.user {
    grid-template-columns: minmax(0, 1fr) 28px;
    justify-content: end;
  }
  .sales-message.user .message-avatar { grid-column: 2; grid-row: 1; }
  .sales-message.user .message-card { grid-column: 1; grid-row: 1; }
  .message-avatar { width: 32px; height: 32px; }
  .message-card {
    padding: 13px 14px;
    border-radius: 16px;
  }
  .message-card p {
    font-size: 14px;
    line-height: 1.72;
  }
  .message-meta {
    margin-bottom: 6px;
  }
  .source-inline-list {
    gap: 6px;
    margin-top: 10px;
  }
  .source-inline-list span {
    min-height: 28px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .prompt-suggestions {
    gap: 7px;
    margin-top: 11px;
  }
  .prompt-suggestions button {
    min-height: 29px;
    padding: 5px 9px;
    font-size: 11px;
  }
  .sales-composer {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(226,232,240,0.9);
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(16px);
  }
  .composer-box {
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  }
  .sales-ai-input {
    min-height: 76px;
    max-height: 128px;
    padding: 4px 4px 8px;
  }
  .composer-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .composer-tools {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    order: -1;
  }
  .composer-tool-label,
  .composer-tools span[data-source-count] {
    display: none;
  }
  .composer-tools span + span::before { content: none; }
  .composer-select {
    min-width: 0;
    display: block;
    position: relative;
  }
  .composer-select > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .composer-select select {
    width: 100%;
    min-height: 34px;
    padding: 0 24px 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #F8FAFC;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 750;
    outline: 0;
  }
  .composer-select select:focus {
    border-color: rgba(80, 70, 229, 0.62);
    box-shadow: 0 0 0 3px rgba(80, 70, 229, 0.08);
  }
  .send-round {
    align-self: center;
    width: auto;
    min-width: 78px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
  }
  .send-round span {
    display: inline;
  }
}
@media (max-width: 430px) {
  .sales-ai-chat {
    height: 100% !important;
    min-height: 0 !important;
  }
  .sales-chat-head {
    padding: 9px 12px;
  }
  .sales-chat-head strong {
    max-width: 132px;
    font-size: 14px;
  }
  .sales-chat-head-actions > span {
    display: none;
  }
  .sales-mobile-chip {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 11px;
  }
  .composer-tools {
    grid-template-columns: minmax(88px, 1fr) 68px 76px;
    gap: 6px;
  }
  .composer-select select {
    min-height: 34px;
    padding-left: 9px;
    font-size: 11px;
  }
  .sales-ai-input {
    min-height: 72px;
  }
}
